Upgrade to Gradle 8 and SDK 34

This commit tries to limit the changes required to what is needed to make the project compile again. This includes the Kotlin and Room update.
This commit is contained in:
Torsten Grote 2024-01-23 17:55:27 -03:00 committed by Hans-Christoph Steiner
parent 6109f98476
commit 35affc09db
21 changed files with 1332 additions and 620 deletions

View File

@ -30,7 +30,7 @@ workflow:
- test -e $cmdline_tools_latest && export PATH="$cmdline_tools_latest:$PATH"
- export GRADLE_USER_HOME=$PWD/.gradle
- export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
- export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdk\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
- echo y | sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" > /dev/null
# index-v1.jar tests need SHA1 support still, TODO use apksig to validate JAR sigs
- sed -i 's,SHA1 denyAfter 20[0-9][0-9],SHA1 denyAfter 2026,'
@ -206,7 +206,7 @@ libs database schema:
- apt-get update
- apt-get -qy --no-install-recommends install default-jdk-headless git sdkmanager
- export ANDROID_HOME=/opt/android-sdk
- export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
- export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdk\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
- sdkmanager "platforms;android-$ANDROID_COMPILE_SDK" "build-tools;30.0.3"
- ./gradlew :libs:database:kaptDebugKotlin
- git --no-pager diff --exit-code

View File

@ -23,9 +23,10 @@ def getVersionName = { ->
def privilegedExtensionApplicationId = '"org.fdroid.fdroid.privileged"'
android {
buildToolsVersion "33.0.2"
namespace "org.fdroid.fdroid"
buildToolsVersion "34.0.0"
compileSdkVersion 33
compileSdk 34
defaultConfig {
versionCode 1019050
@ -93,8 +94,8 @@ android {
compileOptions {
compileOptions.encoding = "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
aaptOptions {
@ -102,11 +103,13 @@ android {
}
buildFeatures {
buildConfig true
compose true
aidl true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.6"
kotlinCompilerExtensionVersion = "1.5.8"
}
testOptions {
@ -202,7 +205,6 @@ dependencies {
fullImplementation 'org.jmdns:jmdns:3.5.5'
fullImplementation 'org.nanohttpd:nanohttpd:2.3.1'
// upgrading this requires compileSdk 34 and thus gradle 8
implementation platform('androidx.compose:compose-bom:2023.06.01')
implementation 'androidx.compose.material:material'
implementation 'androidx.compose.material:material-icons-extended'

View File

@ -205,50 +205,40 @@ public class SwapWorkflowActivity extends AppCompatActivity {
*/
public void onToolbarBackPressed() {
int nextStep = R.layout.swap_start_swap;
switch (currentView.getLayoutResId()) {
case R.layout.swap_confirm_receive:
nextStep = backstack.peek();
break;
case R.layout.swap_connecting:
nextStep = R.layout.swap_select_apps;
break;
case R.layout.swap_join_wifi:
if (currentView.getLayoutResId() == R.layout.swap_confirm_receive) {
nextStep = backstack.peek();
} else if (currentView.getLayoutResId() == R.layout.swap_connecting) {
nextStep = R.layout.swap_select_apps;
} else if (currentView.getLayoutResId() == R.layout.swap_join_wifi) {
nextStep = R.layout.swap_start_swap;
} else if (currentView.getLayoutResId() == R.layout.swap_nfc) {
nextStep = R.layout.swap_join_wifi;
} else if (currentView.getLayoutResId() == R.layout.swap_select_apps) {
if (!backstack.isEmpty() && backstack.peek() == R.layout.swap_start_swap) {
nextStep = R.layout.swap_start_swap;
break;
case R.layout.swap_nfc:
} else if (getSwapService() != null && getSwapService().isConnectingWithPeer()) {
nextStep = R.layout.swap_success;
} else {
nextStep = R.layout.swap_join_wifi;
break;
case R.layout.swap_select_apps:
if (!backstack.isEmpty() && backstack.peek() == R.layout.swap_start_swap) {
nextStep = R.layout.swap_start_swap;
} else if (getSwapService() != null && getSwapService().isConnectingWithPeer()) {
nextStep = R.layout.swap_success;
} else {
nextStep = R.layout.swap_join_wifi;
}
break;
case R.layout.swap_send_fdroid:
}
} else if (currentView.getLayoutResId() == R.layout.swap_send_fdroid) {
nextStep = R.layout.swap_start_swap;
} else if (currentView.getLayoutResId() == R.layout.swap_start_swap) {
if (getSwapService() != null && getSwapService().isConnectingWithPeer()) {
nextStep = R.layout.swap_success;
} else {
SwapService.stop(this);
finish();
return;
}
} else if (currentView.getLayoutResId() == R.layout.swap_success) {
nextStep = R.layout.swap_start_swap;
} else if (currentView.getLayoutResId() == R.layout.swap_wifi_qr) {
if (!backstack.isEmpty() && backstack.peek() == R.layout.swap_start_swap) {
nextStep = R.layout.swap_start_swap;
break;
case R.layout.swap_start_swap:
if (getSwapService() != null && getSwapService().isConnectingWithPeer()) {
nextStep = R.layout.swap_success;
} else {
SwapService.stop(this);
finish();
return;
}
break;
case R.layout.swap_success:
nextStep = R.layout.swap_start_swap;
break;
case R.layout.swap_wifi_qr:
if (!backstack.isEmpty() && backstack.peek() == R.layout.swap_start_swap) {
nextStep = R.layout.swap_start_swap;
} else {
nextStep = R.layout.swap_join_wifi;
}
break;
} else {
nextStep = R.layout.swap_join_wifi;
}
}
currentSwapViewLayoutRes = nextStep;
inflateSwapView(currentSwapViewLayoutRes);
@ -302,28 +292,27 @@ public class SwapWorkflowActivity extends AppCompatActivity {
menu.clear();
MenuInflater menuInflater = getMenuInflater();
switch (currentView.getLayoutResId()) {
case R.layout.swap_select_apps:
menuInflater.inflate(R.menu.swap_next_search, menu);
if (getSwapService().isConnectingWithPeer()) {
setUpNextButton(menu, R.string.next, R.drawable.ic_nearby);
} else {
setUpNextButton(menu, R.string.next, null);
}
setUpSearchView(menu);
return true;
case R.layout.swap_success:
menuInflater.inflate(R.menu.swap_search, menu);
setUpSearchView(menu);
return true;
case R.layout.swap_join_wifi:
menuInflater.inflate(R.menu.swap_next, menu);
setUpNextButton(menu, R.string.next, R.drawable.ic_arrow_forward);
return true;
case R.layout.swap_nfc:
menuInflater.inflate(R.menu.swap_next, menu);
setUpNextButton(menu, R.string.skip, R.drawable.ic_arrow_forward);
return true;
if (currentView.getLayoutResId() == R.layout.swap_select_apps) {
menuInflater.inflate(R.menu.swap_next_search, menu);
if (getSwapService().isConnectingWithPeer()) {
setUpNextButton(menu, R.string.next, R.drawable.ic_nearby);
} else {
setUpNextButton(menu, R.string.next, null);
}
setUpSearchView(menu);
return true;
} else if (currentView.getLayoutResId() == R.layout.swap_success) {
menuInflater.inflate(R.menu.swap_search, menu);
setUpSearchView(menu);
return true;
} else if (currentView.getLayoutResId() == R.layout.swap_join_wifi) {
menuInflater.inflate(R.menu.swap_next, menu);
setUpNextButton(menu, R.string.next, R.drawable.ic_arrow_forward);
return true;
} else if (currentView.getLayoutResId() == R.layout.swap_nfc) {
menuInflater.inflate(R.menu.swap_next, menu);
setUpNextButton(menu, R.string.skip, R.drawable.ic_arrow_forward);
return true;
}
return super.onPrepareOptionsMenu(menu);
@ -349,16 +338,12 @@ public class SwapWorkflowActivity extends AppCompatActivity {
private void sendNext() {
int currentLayoutResId = currentView.getLayoutResId();
switch (currentLayoutResId) {
case R.layout.swap_select_apps:
onAppsSelected();
break;
case R.layout.swap_join_wifi:
inflateSwapView(R.layout.swap_select_apps);
break;
case R.layout.swap_nfc:
inflateSwapView(R.layout.swap_wifi_qr);
break;
if (currentLayoutResId == R.layout.swap_select_apps) {
onAppsSelected();
} else if (currentLayoutResId == R.layout.swap_join_wifi) {
inflateSwapView(R.layout.swap_select_apps);
} else if (currentLayoutResId == R.layout.swap_nfc) {
inflateSwapView(R.layout.swap_wifi_qr);
}
}
@ -422,10 +407,8 @@ public class SwapWorkflowActivity extends AppCompatActivity {
newIntent = false;
}
switch (currentSwapViewLayoutRes) {
case R.layout.swap_start_swap:
updateWifiBannerVisibility();
break;
if (currentSwapViewLayoutRes == R.layout.swap_start_swap) {
updateWifiBannerVisibility();
}
}
@ -541,20 +524,18 @@ public class SwapWorkflowActivity extends AppCompatActivity {
return;
}
switch (currentSwapViewLayoutRes) {
case R.layout.swap_start_swap:
showIntro();
return;
case R.layout.swap_nfc:
if (!attemptToShowNfc()) {
inflateSwapView(R.layout.swap_wifi_qr);
return;
}
break;
case R.layout.swap_connecting:
// TODO: Properly decide what to do here (i.e. returning to the activity after it was connecting)...
inflateSwapView(R.layout.swap_start_swap);
if (currentSwapViewLayoutRes == R.layout.swap_start_swap) {
showIntro();
return;
} else if (currentSwapViewLayoutRes == R.layout.swap_nfc) {
if (!attemptToShowNfc()) {
inflateSwapView(R.layout.swap_wifi_qr);
return;
}
} else if (currentSwapViewLayoutRes == R.layout.swap_connecting) {
// TODO: Properly decide what to do here (i.e. returning to the activity after it was connecting)...
inflateSwapView(R.layout.swap_start_swap);
return;
}
inflateSwapView(currentSwapViewLayoutRes);
}
@ -562,10 +543,8 @@ public class SwapWorkflowActivity extends AppCompatActivity {
public void inflateSwapView(@LayoutRes int viewRes) {
inflateSwapView(viewRes, false);
switch (viewRes) {
case R.layout.swap_start_swap:
updateWifiBannerVisibility();
break;
if (viewRes == R.layout.swap_start_swap) {
updateWifiBannerVisibility();
}
}
@ -596,21 +575,19 @@ public class SwapWorkflowActivity extends AppCompatActivity {
getSwapService().initTimer();
if (!backPressed) {
switch (currentSwapViewLayoutRes) {
case R.layout.swap_connecting:
case R.layout.swap_confirm_receive:
// do not add to backstack
break;
default:
if (backstack.isEmpty()) {
if (viewRes != R.layout.swap_start_swap) {
backstack.push(currentSwapViewLayoutRes);
}
} else {
if (backstack.peek() != currentSwapViewLayoutRes) {
backstack.push(currentSwapViewLayoutRes);
}
if (currentSwapViewLayoutRes == R.layout.swap_connecting ||
currentSwapViewLayoutRes == R.layout.swap_confirm_receive) {
// do not add to backstack
} else {
if (backstack.isEmpty()) {
if (viewRes != R.layout.swap_start_swap) {
backstack.push(currentSwapViewLayoutRes);
}
} else {
if (backstack.peek() != currentSwapViewLayoutRes) {
backstack.push(currentSwapViewLayoutRes);
}
}
}
}
@ -624,45 +601,37 @@ public class SwapWorkflowActivity extends AppCompatActivity {
toolbar.setTitle(currentView.getToolbarTitle());
toolbar.setNavigationOnClickListener(v -> onToolbarBackPressed());
toolbar.setNavigationOnClickListener(v -> {
switch (currentView.getLayoutResId()) {
case R.layout.swap_start_swap:
SwapService.stop(this);
finish();
return;
default:
currentSwapViewLayoutRes = R.layout.swap_start_swap;
if (currentView.getLayoutResId() == R.layout.swap_start_swap) {
SwapService.stop(this);
finish();
return;
} else {
currentSwapViewLayoutRes = R.layout.swap_start_swap;
}
inflateSwapView(currentSwapViewLayoutRes);
});
if (viewRes == R.layout.swap_start_swap) {
toolbar.setNavigationIcon(R.drawable.ic_close);
} else {
toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_material);
toolbar.setNavigationIcon(R.drawable.ic_arrow_back);
}
container.addView(view);
supportInvalidateOptionsMenu();
switch (currentView.getLayoutResId()) {
case R.layout.swap_send_fdroid:
setUpFromWifi();
setUpUseBluetoothButton();
break;
case R.layout.swap_wifi_qr:
setUpFromWifi();
setUpQrScannerButton();
break;
case R.layout.swap_nfc:
setUpNfcView();
break;
case R.layout.swap_select_apps:
LocalRepoService.create(this, getSwapService().getAppsToSwap());
break;
case R.layout.swap_connecting:
setUpConnectingView();
break;
case R.layout.swap_start_swap:
setUpStartVisibility();
break;
if (currentView.getLayoutResId() == R.layout.swap_send_fdroid) {
setUpFromWifi();
setUpUseBluetoothButton();
} else if (currentView.getLayoutResId() == R.layout.swap_wifi_qr) {
setUpFromWifi();
setUpQrScannerButton();
} else if (currentView.getLayoutResId() == R.layout.swap_nfc) {
setUpNfcView();
} else if (currentView.getLayoutResId() == R.layout.swap_select_apps) {
LocalRepoService.create(this, getSwapService().getAppsToSwap());
} else if (currentView.getLayoutResId() == R.layout.swap_connecting) {
setUpConnectingView();
} else if (currentView.getLayoutResId() == R.layout.swap_start_swap) {
setUpStartVisibility();
}
}
@ -1046,40 +1015,37 @@ public class SwapWorkflowActivity extends AppCompatActivity {
}
String qrUriString = null;
switch (currentView.getLayoutResId()) {
case R.layout.swap_join_wifi:
setUpJoinWifi();
return;
case R.layout.swap_send_fdroid:
qrUriString = buttonLabel;
break;
case R.layout.swap_wifi_qr:
Uri sharingUri = Utils.getSharingUri(FDroidApp.repo);
StringBuilder qrUrlBuilder = new StringBuilder(scheme);
qrUrlBuilder.append(sharingUri.getHost());
if (sharingUri.getPort() != 80) {
qrUrlBuilder.append(':');
qrUrlBuilder.append(sharingUri.getPort());
}
qrUrlBuilder.append(sharingUri.getPath());
boolean first = true;
if (currentView.getLayoutResId() == R.layout.swap_join_wifi) {
setUpJoinWifi();
return;
} else if (currentView.getLayoutResId() == R.layout.swap_send_fdroid) {
qrUriString = buttonLabel;
} else if (currentView.getLayoutResId() == R.layout.swap_wifi_qr) {
Uri sharingUri = Utils.getSharingUri(FDroidApp.repo);
StringBuilder qrUrlBuilder = new StringBuilder(scheme);
qrUrlBuilder.append(sharingUri.getHost());
if (sharingUri.getPort() != 80) {
qrUrlBuilder.append(':');
qrUrlBuilder.append(sharingUri.getPort());
}
qrUrlBuilder.append(sharingUri.getPath());
boolean first = true;
Set<String> names = sharingUri.getQueryParameterNames();
for (String name : names) {
if (!"ssid".equals(name)) {
if (first) {
qrUrlBuilder.append('?');
first = false;
} else {
qrUrlBuilder.append('&');
}
qrUrlBuilder.append(name);
qrUrlBuilder.append('=');
qrUrlBuilder.append(sharingUri.getQueryParameter(name));
Set<String> names = sharingUri.getQueryParameterNames();
for (String name : names) {
if (!"ssid".equals(name)) {
if (first) {
qrUrlBuilder.append('?');
first = false;
} else {
qrUrlBuilder.append('&');
}
qrUrlBuilder.append(name);
qrUrlBuilder.append('=');
qrUrlBuilder.append(sharingUri.getQueryParameter(name));
}
qrUriString = qrUrlBuilder.toString();
break;
}
qrUriString = qrUrlBuilder.toString();
}
ImageView qrImage = container.findViewById(R.id.wifi_qr_code);

View File

@ -24,7 +24,6 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.fdroid.fdroid"
android:installLocation="auto">
<supports-screens

View File

@ -1,16 +1,12 @@
package org.fdroid.fdroid;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
import android.nfc.NfcAdapter;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
@Deprecated
public class NfcHelper {
private static final String TAG = "NfcHelper";
@ -20,37 +16,18 @@ public class NfcHelper {
}
public static boolean setPushMessage(AppCompatActivity activity, Uri toShare) {
NfcAdapter adapter = getAdapter(activity);
if (adapter != null) {
adapter.setNdefPushMessage(new NdefMessage(new NdefRecord[]{
NdefRecord.createUri(toShare),
}), activity);
return true;
}
// removed in Android 14: https://www.xda-developers.com/android-beam-permanent-removal-android-14/
// adapter.setNdefPushMessage();
return false;
}
public static void setAndroidBeam(AppCompatActivity activity, String packageName) {
PackageManager pm = activity.getPackageManager();
NfcAdapter nfcAdapter = getAdapter(activity);
if (nfcAdapter != null) {
ApplicationInfo appInfo;
try {
appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
Uri[] uris = {
Uri.parse("file://" + appInfo.publicSourceDir),
};
nfcAdapter.setBeamPushUris(uris, activity);
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Could not get application info", e);
}
}
// removed in SDK 34: https://www.xda-developers.com/android-beam-permanent-removal-android-14/
// nfcAdapter.setBeamPushUris(uris, activity);
}
public static void disableAndroidBeam(AppCompatActivity activity) {
NfcAdapter nfcAdapter = getAdapter(activity);
if (nfcAdapter != null) {
nfcAdapter.setBeamPushUris(null, activity);
}
// removed in Android 14: https://www.xda-developers.com/android-beam-permanent-removal-android-14/
// nfcAdapter.setBeamPushUris(null, activity);
}
}

View File

@ -757,7 +757,7 @@ public final class Utils {
public static void applySwipeLayoutColors(SwipeRefreshLayout swipeLayout) {
TypedValue typedValue = new TypedValue();
Resources.Theme theme = swipeLayout.getContext().getTheme();
theme.resolveAttribute(R.attr.colorPrimary, typedValue, true);
theme.resolveAttribute(android.R.attr.colorPrimary, typedValue, true);
swipeLayout.setColorSchemeColors(typedValue.data);
}

View File

@ -134,50 +134,46 @@ public class InstallHistoryActivity extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_share:
ShareCompat.IntentBuilder intentBuilder = ShareCompat.IntentBuilder.from(this);
if (showingInstallHistory) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Repos:\n");
for (Repository repo : FDroidApp.getRepoManager(this).getRepositories()) {
if (repo.getEnabled()) {
stringBuilder.append("* ");
stringBuilder.append(repo.getAddress());
stringBuilder.append('\n');
}
int itemId = item.getItemId();
if (itemId == R.id.menu_share) {
ShareCompat.IntentBuilder intentBuilder = ShareCompat.IntentBuilder.from(this);
if (showingInstallHistory) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Repos:\n");
for (Repository repo : FDroidApp.getRepoManager(this).getRepositories()) {
if (repo.getEnabled()) {
stringBuilder.append("* ");
stringBuilder.append(repo.getAddress());
stringBuilder.append('\n');
}
intentBuilder
.setText(stringBuilder.toString())
.setStream(InstallHistoryService.LOG_URI)
.setType("text/plain")
.setSubject(getString(R.string.send_history_csv, appName))
.setChooserTitle(R.string.send_install_history);
} else {
intentBuilder
.setText(textView.getText())
.setType("application/json")
.setSubject(getString(R.string.send_fdroid_metrics_json, appName))
.setChooserTitle(R.string.send_fdroid_metrics_report);
}
Intent intent = intentBuilder.getIntent();
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);
break;
case R.id.menu_delete:
if (showingInstallHistory) {
getContentResolver().delete(InstallHistoryService.LOG_URI, null, null);
}
textView.setText("");
break;
case R.id.menu_show:
if (showingInstallHistory) {
showFDroidMetricsReport();
} else {
showInstallHistory();
}
break;
intentBuilder
.setText(stringBuilder.toString())
.setStream(InstallHistoryService.LOG_URI)
.setType("text/plain")
.setSubject(getString(R.string.send_history_csv, appName))
.setChooserTitle(R.string.send_install_history);
} else {
intentBuilder
.setText(textView.getText())
.setType("application/json")
.setSubject(getString(R.string.send_fdroid_metrics_json, appName))
.setChooserTitle(R.string.send_fdroid_metrics_report);
}
Intent intent = intentBuilder.getIntent();
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);
} else if (itemId == R.id.menu_delete) {
if (showingInstallHistory) {
getContentResolver().delete(InstallHistoryService.LOG_URI, null, null);
}
textView.setText("");
} else if (itemId == R.id.menu_show) {
if (showingInstallHistory) {
showFDroidMetricsReport();
} else {
showInstallHistory();
}
}
return super.onOptionsItemSelected(item);
}

View File

@ -43,18 +43,14 @@ public class LatestAdapter extends RecyclerView.Adapter<AppCardController> {
@Override
public AppCardController onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
int layout;
switch (viewType) {
case R.id.latest_large_tile:
layout = R.layout.app_card_large;
break;
case R.id.latest_small_tile:
layout = R.layout.app_card_horizontal;
break;
case R.id.latest_regular_list:
layout = R.layout.app_card_list_item;
break;
default:
throw new IllegalArgumentException("Unknown view type when rendering \"What's New\": " + viewType);
if (viewType == R.id.latest_large_tile) {
layout = R.layout.app_card_large;
} else if (viewType == R.id.latest_small_tile) {
layout = R.layout.app_card_horizontal;
} else if (viewType == R.id.latest_regular_list) {
layout = R.layout.app_card_list_item;
} else {
throw new IllegalArgumentException("Unknown view type when rendering \"What's New\": " + viewType);
}
return new AppCardController(activity, activity.getLayoutInflater().inflate(layout, parent, false));

View File

@ -87,25 +87,19 @@ class MainViewAdapter extends RecyclerView.Adapter<MainViewController> {
@Override
public MainViewController onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
MainViewController holder = createEmptyView(activity);
switch (viewType) {
case R.id.latest:
holder.bindLatestView();
break;
case R.id.categories:
holder.bindCategoriesView();
break;
case R.id.nearby:
holder.bindSwapView();
break;
case R.id.updates:
// Hold of until onViewAttachedToWindow, because that is where we want to start listening
// for broadcast events (which is what the data binding does).
break;
case R.id.settings:
holder.bindSettingsView();
break;
default:
throw new IllegalStateException("Unknown view type " + viewType);
if (viewType == R.id.latest) {
holder.bindLatestView();
} else if (viewType == R.id.categories) {
holder.bindCategoriesView();
} else if (viewType == R.id.nearby) {
holder.bindSwapView();
} else if (viewType == R.id.updates) {
// Hold of until onViewAttachedToWindow, because that is where we want to start listening
// for broadcast events (which is what the data binding does).
} else if (viewType == R.id.settings) {
holder.bindSettingsView();
} else {
throw new IllegalStateException("Unknown view type " + viewType);
}
return holder;
}

View File

@ -279,23 +279,23 @@ public class RepoDetailsActivity extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent;
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.menu_delete:
promptForDelete();
return true;
case R.id.menu_enable_nfc:
intent = new Intent(this, NfcNotEnabledActivity.class);
startActivity(intent);
return true;
case R.id.action_share:
intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, shareUrl);
startActivity(Intent.createChooser(intent,
getResources().getString(R.string.share_repository)));
int itemId = item.getItemId();
if (itemId == android.R.id.home) {
NavUtils.navigateUpFromSameTask(this);
return true;
} else if (itemId == R.id.menu_delete) {
promptForDelete();
return true;
} else if (itemId == R.id.menu_enable_nfc) {
intent = new Intent(this, NfcNotEnabledActivity.class);
startActivity(intent);
return true;
} else if (itemId == R.id.action_share) {
intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, shareUrl);
startActivity(Intent.createChooser(intent,
getResources().getString(R.string.share_repository)));
}
return super.onOptionsItemSelected(item);
@ -318,7 +318,7 @@ public class RepoDetailsActivity extends AppCompatActivity {
}
boolean needsEnableNfcMenuItem;
needsEnableNfcMenuItem = !nfcAdapter.isNdefPushEnabled();
needsEnableNfcMenuItem = false; // TODO remove NFC code
menuItem.setVisible(needsEnableNfcMenuItem);
}

View File

@ -4,9 +4,9 @@ buildscript {
maven { url 'https://maven.google.com/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10"
classpath 'com.android.tools.build:gradle:8.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.9.10"
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=db9c8211ed63f61f60292c69e80d89196f9eb36665e369e7f00ac4cc841c2219
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionSha256Sum=c16d517b50dd28b3f5838f0e844b7520b8f1eb610f2f29de7e4e04a1b7c9c79b
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -8,7 +8,8 @@ plugins {
}
android {
compileSdkVersion 33
namespace "org.fdroid.database"
compileSdk 34
defaultConfig {
minSdkVersion 21
@ -43,8 +44,8 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
testOptions {
unitTests {
@ -52,7 +53,7 @@ android {
}
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
freeCompilerArgs += "-Xexplicit-api=strict"
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
@ -73,9 +74,9 @@ dependencies {
implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
implementation "androidx.room:room-runtime:2.5.2"
implementation "androidx.room:room-ktx:2.5.2"
kapt "androidx.room:room-compiler:2.5.2"
implementation "androidx.room:room-runtime:2.6.1"
implementation "androidx.room:room-ktx:2.6.1"
kapt "androidx.room:room-compiler:2.6.1"
implementation 'io.github.microutils:kotlin-logging:2.1.21'
@ -89,7 +90,7 @@ dependencies {
testImplementation 'androidx.test:core:1.5.0'
testImplementation 'androidx.test.ext:junit:1.1.5'
testImplementation 'androidx.arch.core:core-testing:2.2.0'
testImplementation "androidx.room:room-testing:2.5.2"
testImplementation "androidx.room:room-testing:2.6.1"
testImplementation 'org.robolectric:robolectric:4.10.3'
testImplementation 'commons-io:commons-io:2.6'
testImplementation 'ch.qos.logback:logback-classic:1.4.5'
@ -103,7 +104,7 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.arch.core:core-testing:2.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.room:room-testing:2.5.2"
androidTestImplementation "androidx.room:room-testing:2.6.1"
androidTestImplementation 'commons-io:commons-io:2.6'
}

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fdroid.database">
<manifest>
</manifest>

View File

@ -7,9 +7,9 @@ plugins {
}
kotlin {
android {
compilations.all {
kotlinOptions.jvmTarget = '1.8'
androidTarget {
compilations.configureEach {
kotlinOptions.jvmTarget = '17'
}
publishLibraryVariants("release")
}
@ -22,7 +22,7 @@ kotlin {
// else throw new GradleException("Host OS is not supported in Kotlin/Native.")
sourceSets {
all {
configureEach {
languageSettings {
optIn('kotlin.RequiresOptIn')
explicitApi('strict')
@ -90,19 +90,21 @@ kotlin {
}
android {
compileSdkVersion 33
namespace "org.fdroid.download"
compileSdk 34
sourceSets {
main.manifest.srcFile('src/androidMain/AndroidManifest.xml')
getByName("androidTest").java.srcDir(file("src/androidAndroidTest/kotlin"))
}
defaultConfig {
minSdkVersion 21
targetSdkVersion 34 // needed for instrumentation tests
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
testInstrumentationRunnerArguments disableAnalytics: 'true'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
lintOptions {
checkReleaseBuilds false

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fdroid.download">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

View File

@ -1,6 +1,6 @@
plugins {
id 'org.jetbrains.kotlin.multiplatform'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.0'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.22'
id 'com.android.library'
id 'org.jetbrains.dokka'
id "org.jlleitschuh.gradle.ktlint" version "10.2.1"
@ -9,8 +9,8 @@ plugins {
kotlin {
android {
compilations.all {
kotlinOptions.jvmTarget = '1.8'
compilations.configureEach {
kotlinOptions.jvmTarget = '17'
}
publishLibraryVariants("release")
}
@ -25,7 +25,7 @@ kotlin {
// else throw new GradleException("Host OS is not supported in Kotlin/Native.")
sourceSets {
all {
configureEach {
languageSettings {
optIn('kotlin.RequiresOptIn')
explicitApi('strict')
@ -60,7 +60,7 @@ kotlin {
}
androidMain {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-reflect:1.8.20"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.9.22"
implementation 'androidx.core:core-ktx:1.10.1'
}
}
@ -89,7 +89,8 @@ kotlin {
}
android {
compileSdkVersion 33
namespace "org.fdroid.index"
compileSdk 34
sourceSets {
main.manifest.srcFile('src/androidMain/AndroidManifest.xml')
getByName("androidTest").java.srcDir(file("src/androidAndroidTest/kotlin"))
@ -102,8 +103,8 @@ android {
testInstrumentationRunnerArguments disableAnalytics: 'true'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
testOptions {
unitTests.returnDefaultValues = true

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.fdroid.index">
<manifest>
</manifest>

View File

@ -4,14 +4,18 @@ plugins {
id "org.jlleitschuh.gradle.ktlint" version "10.2.1"
}
kotlin {
jvmToolchain(17)
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
// not really an Android library, but index is not publishing for JVM at the moment
android {
compileSdkVersion 33
namespace 'org.fdroid.test'
compileSdk 34
defaultConfig {
minSdkVersion 21
}

View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.fdroid.test" />
<manifest/>