From e2979f632d8a25824500cfa710ccf31c5ff594a4 Mon Sep 17 00:00:00 2001 From: proletarius101 Date: Thu, 28 Jan 2021 16:52:58 +0000 Subject: [PATCH] Change Activity to AppCompatActivity --- .../nearby/TreeUriScannerIntentService.java | 4 +-- .../fdroid/fdroid/nearby/SwapSuccessView.java | 4 +-- .../fdroid/nearby/SwapWorkflowActivity.java | 4 +-- .../panic/PanicPreferencesFragment.java | 8 ++--- .../fdroid/panic/PanicResponderActivity.java | 10 +++---- .../panic/SelectInstalledAppListAdapter.java | 4 +-- .../SelectInstalledAppListItemController.java | 4 +-- .../fdroid/views/main/MainViewController.java | 10 ++++--- .../fdroid/views/main/NearbyViewBinder.java | 14 ++++----- .../integration/android/IntentIntegrator.java | 30 ++++++++++--------- .../fdroid/fdroid/AddRepoIntentService.java | 2 +- .../java/org/fdroid/fdroid/FDroidApp.java | 20 ++++++------- .../java/org/fdroid/fdroid/Languages.java | 15 +++++----- .../java/org/fdroid/fdroid/NfcHelper.java | 8 ++--- .../main/java/org/fdroid/fdroid/Utils.java | 4 +-- .../fdroid/fdroid/data/ObbUrlActivity.java | 10 ++++--- .../installer/DefaultInstallerActivity.java | 16 +++++----- .../fdroid/installer/ErrorDialogActivity.java | 6 ++-- .../fdroid/fdroid/installer/Installer.java | 2 +- .../fdroid/installer/ObfInstallerService.java | 2 +- .../fdroid/fdroid/net/DownloaderService.java | 2 +- .../views/InstallConfirmActivity.java | 12 ++++---- .../fdroid/privileged/views/TabsAdapter.java | 4 +-- .../views/UninstallDialogActivity.java | 8 ++--- .../org/fdroid/fdroid/qr/QrGenAsyncTask.java | 6 ++-- .../fdroid/views/AppDetailsActivity.java | 26 ++++++++-------- .../fdroid/views/PreferencesFragment.java | 10 +++---- .../fdroid/views/apps/AppListAdapter.java | 6 ++-- .../views/apps/AppListItemController.java | 6 ++-- .../apps/StandardAppListItemController.java | 4 +-- .../views/categories/AppCardController.java | 6 ++-- .../views/categories/AppPreviewAdapter.java | 6 ++-- .../views/categories/CategoryAdapter.java | 6 ++-- .../views/categories/CategoryController.java | 6 ++-- .../installed/InstalledAppListAdapter.java | 6 ++-- .../InstalledAppListItemController.java | 4 +-- .../fdroid/views/updates/items/AppStatus.java | 8 ++--- .../items/AppStatusListItemController.java | 4 +-- .../views/updates/items/AppUpdateData.java | 6 ++-- .../views/updates/items/KnownVulnApp.java | 8 ++--- .../items/KnownVulnAppListItemController.java | 4 +-- .../views/updates/items/UpdateableApp.java | 8 ++--- .../UpdateableAppListItemController.java | 4 +-- .../updates/items/UpdateableAppsHeader.java | 6 ++-- .../views/whatsnew/WhatsNewAdapter.java | 6 ++-- 45 files changed, 180 insertions(+), 169 deletions(-) diff --git a/app/src/basic/java/org/fdroid/fdroid/nearby/TreeUriScannerIntentService.java b/app/src/basic/java/org/fdroid/fdroid/nearby/TreeUriScannerIntentService.java index 979187247..f98619fbc 100644 --- a/app/src/basic/java/org/fdroid/fdroid/nearby/TreeUriScannerIntentService.java +++ b/app/src/basic/java/org/fdroid/fdroid/nearby/TreeUriScannerIntentService.java @@ -19,14 +19,14 @@ package org.fdroid.fdroid.nearby; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; /** * Dummy version for basic app flavor. */ public class TreeUriScannerIntentService { - public static void onActivityResult(Activity activity, Intent intent) { + public static void onActivityResult(AppCompatActivity activity, Intent intent) { throw new IllegalStateException("unimplemented"); } } diff --git a/app/src/full/java/org/fdroid/fdroid/nearby/SwapSuccessView.java b/app/src/full/java/org/fdroid/fdroid/nearby/SwapSuccessView.java index bc19e2e73..052b422e9 100644 --- a/app/src/full/java/org/fdroid/fdroid/nearby/SwapSuccessView.java +++ b/app/src/full/java/org/fdroid/fdroid/nearby/SwapSuccessView.java @@ -1,7 +1,7 @@ package org.fdroid.fdroid.nearby; import android.annotation.TargetApi; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; @@ -195,7 +195,7 @@ public class SwapSuccessView extends SwapView implements LoaderManager.LoaderCal private final ContentObserver appObserver = new ContentObserver(new Handler()) { @Override public void onChange(boolean selfChange) { - Activity activity = getActivity(); + AppCompatActivity activity = getActivity(); if (activity != null && app != null) { app = AppProvider.Helper.findSpecificApp( activity.getContentResolver(), diff --git a/app/src/full/java/org/fdroid/fdroid/nearby/SwapWorkflowActivity.java b/app/src/full/java/org/fdroid/fdroid/nearby/SwapWorkflowActivity.java index 63a85edf9..d3db11795 100644 --- a/app/src/full/java/org/fdroid/fdroid/nearby/SwapWorkflowActivity.java +++ b/app/src/full/java/org/fdroid/fdroid/nearby/SwapWorkflowActivity.java @@ -1,7 +1,7 @@ package org.fdroid.fdroid.nearby; import android.annotation.TargetApi; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.bluetooth.BluetoothAdapter; import android.content.BroadcastReceiver; import android.content.ComponentName; @@ -594,7 +594,7 @@ public class SwapWorkflowActivity extends AppCompatActivity { } private void sendFDroidApk() { - ((FDroidApp) getApplication()).sendViaBluetooth(this, Activity.RESULT_OK, BuildConfig.APPLICATION_ID); + ((FDroidApp) getApplication()).sendViaBluetooth(this, AppCompatActivity.RESULT_OK, BuildConfig.APPLICATION_ID); } /** diff --git a/app/src/full/java/org/fdroid/fdroid/panic/PanicPreferencesFragment.java b/app/src/full/java/org/fdroid/fdroid/panic/PanicPreferencesFragment.java index ddf61b1a1..a3ea6802d 100644 --- a/app/src/full/java/org/fdroid/fdroid/panic/PanicPreferencesFragment.java +++ b/app/src/full/java/org/fdroid/fdroid/panic/PanicPreferencesFragment.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.panic; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.ComponentName; import android.content.DialogInterface; import android.content.Intent; @@ -83,7 +83,7 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat prefHide.setEnabled(false); prefResetRepos.setChecked(false); prefResetRepos.setEnabled(false); - getActivity().setResult(Activity.RESULT_CANCELED); + getActivity().setResult(AppCompatActivity.RESULT_CANCELED); } else { prefHide.setEnabled(true); prefResetRepos.setEnabled(true); @@ -235,13 +235,13 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat public void onClick(DialogInterface dialogInterface, int i) { PanicResponder.setTriggerPackageName(getActivity()); showPanicApp(PanicResponder.getTriggerPackageName(getActivity())); - getActivity().setResult(Activity.RESULT_OK); + getActivity().setResult(AppCompatActivity.RESULT_OK); } }; DialogInterface.OnClickListener cancelListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { - getActivity().setResult(Activity.RESULT_CANCELED); + getActivity().setResult(AppCompatActivity.RESULT_CANCELED); getActivity().finish(); } }; diff --git a/app/src/full/java/org/fdroid/fdroid/panic/PanicResponderActivity.java b/app/src/full/java/org/fdroid/fdroid/panic/PanicResponderActivity.java index 3e4959315..02dd591ab 100644 --- a/app/src/full/java/org/fdroid/fdroid/panic/PanicResponderActivity.java +++ b/app/src/full/java/org/fdroid/fdroid/panic/PanicResponderActivity.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.panic; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.BroadcastReceiver; import android.content.ContentValues; import android.content.Context; @@ -32,15 +32,15 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; /** - * This {@link Activity} is purely to run events in response to a panic trigger. - * It needs to be an {@code Activity} rather than a {@link android.app.Service} + * This {@link AppCompatActivity} is purely to run events in response to a panic trigger. + * It needs to be an {@code AppCompatActivity} rather than a {@link android.app.Service} * so that it can fetch some of the required information about what sent the - * {@link Intent}. This is therefore an {@code Activity} without any UI, which + * {@link Intent}. This is therefore an {@code AppCompatActivity} without any UI, which * is a special case in Android. All the code must be in * {@link #onCreate(Bundle)} and {@link #finish()} must be called at the end of * that method. * - * @see PanicResponder#receivedTriggerFromConnectedApp(Activity) + * @see PanicResponder#receivedTriggerFromConnectedApp(AppCompatActivity) */ public class PanicResponderActivity extends AppCompatActivity { diff --git a/app/src/full/java/org/fdroid/fdroid/panic/SelectInstalledAppListAdapter.java b/app/src/full/java/org/fdroid/fdroid/panic/SelectInstalledAppListAdapter.java index a79c61b16..3e5666069 100644 --- a/app/src/full/java/org/fdroid/fdroid/panic/SelectInstalledAppListAdapter.java +++ b/app/src/full/java/org/fdroid/fdroid/panic/SelectInstalledAppListAdapter.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.panic; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import android.view.View; import android.view.ViewGroup; @@ -14,7 +14,7 @@ import java.util.Set; public class SelectInstalledAppListAdapter extends InstalledAppListAdapter { private final Set selectedApps; - SelectInstalledAppListAdapter(Activity activity) { + SelectInstalledAppListAdapter(AppCompatActivity activity) { super(activity); Preferences prefs = Preferences.get(); selectedApps = prefs.getPanicWipeSet(); diff --git a/app/src/full/java/org/fdroid/fdroid/panic/SelectInstalledAppListItemController.java b/app/src/full/java/org/fdroid/fdroid/panic/SelectInstalledAppListItemController.java index ed9410172..fd482cdfe 100644 --- a/app/src/full/java/org/fdroid/fdroid/panic/SelectInstalledAppListItemController.java +++ b/app/src/full/java/org/fdroid/fdroid/panic/SelectInstalledAppListItemController.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.panic; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import android.view.View; @@ -18,7 +18,7 @@ public class SelectInstalledAppListItemController extends InstalledAppListItemCo private final Set selectedApps; - public SelectInstalledAppListItemController(Activity activity, View itemView, Set selectedApps) { + public SelectInstalledAppListItemController(AppCompatActivity activity, View itemView, Set selectedApps) { super(activity, itemView); this.selectedApps = selectedApps; } diff --git a/app/src/full/java/org/fdroid/fdroid/views/main/MainViewController.java b/app/src/full/java/org/fdroid/fdroid/views/main/MainViewController.java index d00e9341d..67937d1bd 100644 --- a/app/src/full/java/org/fdroid/fdroid/views/main/MainViewController.java +++ b/app/src/full/java/org/fdroid/fdroid/views/main/MainViewController.java @@ -1,10 +1,12 @@ package org.fdroid.fdroid.views.main; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import androidx.appcompat.app.AppCompatActivity; -import androidx.recyclerview.widget.RecyclerView; import android.widget.FrameLayout; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.RecyclerView; + import org.fdroid.fdroid.R; import org.fdroid.fdroid.views.PreferencesFragment; import org.fdroid.fdroid.views.updates.UpdatesViewBinder; diff --git a/app/src/full/java/org/fdroid/fdroid/views/main/NearbyViewBinder.java b/app/src/full/java/org/fdroid/fdroid/views/main/NearbyViewBinder.java index 5d29e0c2f..4c0a6c64d 100644 --- a/app/src/full/java/org/fdroid/fdroid/views/main/NearbyViewBinder.java +++ b/app/src/full/java/org/fdroid/fdroid/views/main/NearbyViewBinder.java @@ -1,7 +1,7 @@ package org.fdroid.fdroid.views.main; import android.Manifest; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.content.UriPermission; @@ -69,7 +69,7 @@ public class NearbyViewBinder { private static File externalStorage = null; private static View swapView; - NearbyViewBinder(final Activity activity, FrameLayout parent) { + NearbyViewBinder(final AppCompatActivity activity, FrameLayout parent) { swapView = activity.getLayoutInflater().inflate(R.layout.main_tab_swap, parent, true); TextView subtext = swapView.findViewById(R.id.both_parties_need_fdroid_text); @@ -213,11 +213,11 @@ public class NearbyViewBinder { } } - Activity activity = null; - if (context instanceof Activity) { - activity = (Activity) context; - } else if (swapView != null && swapView.getContext() instanceof Activity) { - activity = (Activity) swapView.getContext(); + AppCompatActivity activity = null; + if (context instanceof AppCompatActivity) { + activity = (AppCompatActivity) context; + } else if (swapView != null && swapView.getContext() instanceof AppCompatActivity) { + activity = (AppCompatActivity) swapView.getContext(); } if (activity != null) { diff --git a/app/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java b/app/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java index 24ad413eb..f15883dc7 100644 --- a/app/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java +++ b/app/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java @@ -16,7 +16,6 @@ package com.google.zxing.integration.android; -import android.app.Activity; import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.DialogInterface; @@ -25,9 +24,11 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.net.Uri; import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.util.Log; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; + import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -48,8 +49,8 @@ import java.util.Map; *

It does require that the Barcode Scanner (or work-alike) application is installed. The * {@link #initiateScan()} method will prompt the user to download the application, if needed.

* - *

There are a few steps to using this integration. First, your {@link Activity} must implement - * the method {@link Activity#onActivityResult(int, int, Intent)} and include a line of code like this:

+ *

There are a few steps to using this integration. First, your {@link AppCompatActivity} must implement + * the method {@link AppCompatActivity#onActivityResult(int, int, Intent)} and include a line of code like this:

* *
{@code
  * public void onActivityResult(int requestCode, int resultCode, Intent intent) {
@@ -73,7 +74,8 @@ import java.util.Map;
  *
  * 

Note that {@link #initiateScan()} returns an {@link AlertDialog} which is non-null if the * user was prompted to download the application. This lets the calling app potentially manage the dialog. - * In particular, ideally, the app dismisses the dialog if it's still active in its {@link Activity#onPause()} + * In particular, ideally, the app dismisses the dialog if it's still active in its + * {@link AppCompatActivity#onPause()} * method.

* *

You can use {@link #setTitle(String)} to customize the title of this download prompt dialog (or, use @@ -140,7 +142,7 @@ public class IntentIntegrator { // What else supports this intent? ); - private final Activity activity; + private final AppCompatActivity activity; private final Fragment fragment; private String title; @@ -151,9 +153,9 @@ public class IntentIntegrator { private final Map moreExtras = new HashMap<>(3); /** - * @param activity {@link Activity} invoking the integration + * @param activity {@link AppCompatActivity} invoking the integration */ - public IntentIntegrator(Activity activity) { + public IntentIntegrator(AppCompatActivity activity) { this.activity = activity; this.fragment = null; initializeConfiguration(); @@ -162,10 +164,10 @@ public class IntentIntegrator { /** * @param fragment {@link Fragment} invoking the integration. * {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead - * of an {@link Activity} + * of an {@link AppCompatActivity} */ public IntentIntegrator(Fragment fragment) { - this.activity = fragment.getActivity(); + this.activity = (AppCompatActivity) fragment.getActivity(); this.fragment = fragment; initializeConfiguration(); } @@ -333,7 +335,7 @@ public class IntentIntegrator { * * @param intent Intent to start. * @param code Request code for the activity - * @see android.app.Activity#startActivityForResult(Intent, int) + * @see android.app.AppCompatActivity#startActivityForResult(Intent, int) * @see android.app.Fragment#startActivityForResult(Intent, int) */ protected void startActivityForResult(Intent intent, int code) { @@ -402,8 +404,8 @@ public class IntentIntegrator { } /** - *

Call this from your {@link Activity}'s - * {@link Activity#onActivityResult(int, int, Intent)} method.

+ *

Call this from your {@link AppCompatActivity}'s + * {@link AppCompatActivity#onActivityResult(int, int, Intent)} method.

* * @param requestCode request code from {@code onActivityResult()} * @param resultCode result code from {@code onActivityResult()} @@ -414,7 +416,7 @@ public class IntentIntegrator { */ public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == REQUEST_CODE) { - if (resultCode == Activity.RESULT_OK) { + if (resultCode == AppCompatActivity.RESULT_OK) { String contents = intent.getStringExtra("SCAN_RESULT"); String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT"); byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES"); diff --git a/app/src/main/java/org/fdroid/fdroid/AddRepoIntentService.java b/app/src/main/java/org/fdroid/fdroid/AddRepoIntentService.java index 396e04b48..318812bf3 100644 --- a/app/src/main/java/org/fdroid/fdroid/AddRepoIntentService.java +++ b/app/src/main/java/org/fdroid/fdroid/AddRepoIntentService.java @@ -31,7 +31,7 @@ import java.util.Locale; *

* This only really properly queues {@link Intent}s that get filtered out. The * {@code Intent}s that go on to {@code ManageReposActivity} will not wait - * until for that {@code Activity} to be ready to handle the next. So when + * until for that {@code AppCompatActivity} to be ready to handle the next. So when * multiple mirrors are discovered at once, only one in that session will * likely be added. */ diff --git a/app/src/main/java/org/fdroid/fdroid/FDroidApp.java b/app/src/main/java/org/fdroid/fdroid/FDroidApp.java index f79e45688..b533b27f9 100644 --- a/app/src/main/java/org/fdroid/fdroid/FDroidApp.java +++ b/app/src/main/java/org/fdroid/fdroid/FDroidApp.java @@ -24,7 +24,7 @@ package org.fdroid.fdroid; import android.annotation.TargetApi; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.app.ActivityManager; import android.app.ActivityManager.RunningAppProcessInfo; import android.app.Application; @@ -159,7 +159,7 @@ public class FDroidApp extends Application { curTheme = Preferences.get().getTheme(); } - public void applyTheme(Activity activity) { + public void applyTheme(AppCompatActivity activity) { activity.setTheme(getCurThemeResId()); setSecureWindow(activity); } @@ -181,12 +181,12 @@ public class FDroidApp extends Application { return curTheme == Theme.light; } - public void applyDialogTheme(Activity activity) { + public void applyDialogTheme(AppCompatActivity activity) { activity.setTheme(getCurDialogThemeResId()); setSecureWindow(activity); } - public void setSecureWindow(Activity activity) { + public void setSecureWindow(AppCompatActivity activity) { if (Preferences.get().preventScreenshots()) { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } @@ -206,12 +206,12 @@ public class FDroidApp extends Application { } /** - * Force reload the {@link Activity to make theme changes take effect.} - * Same as {@link Languages#forceChangeLanguage(Activity)} + * Force reload the {@link AppCompatActivity to make theme changes take effect.} + * Same as {@link Languages#forceChangeLanguage(AppCompatActivity)} * - * @param activity the {@code Activity} to force reload + * @param activity the {@code AppCompatActivity} to force reload */ - public static void forceChangeTheme(Activity activity) { + public static void forceChangeTheme(AppCompatActivity activity) { Intent intent = activity.getIntent(); if (intent == null) { // when launched as LAUNCHER return; @@ -602,8 +602,8 @@ public class FDroidApp extends Application { return getSharedPreferences("at-start-time", Context.MODE_PRIVATE); } - public void sendViaBluetooth(Activity activity, int resultCode, String packageName) { - if (resultCode == Activity.RESULT_CANCELED) { + public void sendViaBluetooth(AppCompatActivity activity, int resultCode, String packageName) { + if (resultCode == AppCompatActivity.RESULT_CANCELED) { return; } diff --git a/app/src/main/java/org/fdroid/fdroid/Languages.java b/app/src/main/java/org/fdroid/fdroid/Languages.java index f74d5f17b..86fc477e2 100644 --- a/app/src/main/java/org/fdroid/fdroid/Languages.java +++ b/app/src/main/java/org/fdroid/fdroid/Languages.java @@ -1,7 +1,6 @@ package org.fdroid.fdroid; import android.annotation.TargetApi; -import android.app.Activity; import android.content.ContextWrapper; import android.content.Intent; import android.content.res.Configuration; @@ -9,6 +8,8 @@ import android.content.res.Resources; import android.os.Build; import android.text.TextUtils; +import androidx.appcompat.app.AppCompatActivity; + import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashSet; @@ -35,7 +36,7 @@ public final class Languages { DEFAULT_LOCALE = Locale.getDefault(); } - private Languages(Activity activity) { + private Languages(AppCompatActivity activity) { Set localeSet = new LinkedHashSet<>(); localeSet.addAll(Arrays.asList(LOCALES_TO_TEST)); @@ -63,10 +64,10 @@ public final class Languages { } /** - * @param activity the {@link Activity} this is working as part of + * @param activity the {@link AppCompatActivity} this is working as part of * @return the singleton to work with */ - public static Languages get(Activity activity) { + public static Languages get(AppCompatActivity activity) { if (singleton == null) { singleton = new Languages(activity); } @@ -116,11 +117,11 @@ public final class Languages { } /** - * Force reload the {@link Activity to make language changes take effect.} + * Force reload the {@link AppCompatActivity to make language changes take effect.} * - * @param activity the {@code Activity} to force reload + * @param activity the {@code AppCompatActivity} to force reload */ - public static void forceChangeLanguage(Activity activity) { + public static void forceChangeLanguage(AppCompatActivity activity) { if (Build.VERSION.SDK_INT >= 24) { Utils.debugLog(TAG, "Languages.forceChangeLanguage() ignored on >= android-24"); return; diff --git a/app/src/main/java/org/fdroid/fdroid/NfcHelper.java b/app/src/main/java/org/fdroid/fdroid/NfcHelper.java index b25de27ba..ffe561f7a 100644 --- a/app/src/main/java/org/fdroid/fdroid/NfcHelper.java +++ b/app/src/main/java/org/fdroid/fdroid/NfcHelper.java @@ -1,7 +1,7 @@ package org.fdroid.fdroid; import android.annotation.TargetApi; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; @@ -20,7 +20,7 @@ public class NfcHelper { return NfcAdapter.getDefaultAdapter(context.getApplicationContext()); } - public static boolean setPushMessage(Activity activity, Uri toShare) { + public static boolean setPushMessage(AppCompatActivity activity, Uri toShare) { NfcAdapter adapter = getAdapter(activity); if (adapter != null) { adapter.setNdefPushMessage(new NdefMessage(new NdefRecord[]{ @@ -32,7 +32,7 @@ public class NfcHelper { } @TargetApi(16) - public static void setAndroidBeam(Activity activity, String packageName) { + public static void setAndroidBeam(AppCompatActivity activity, String packageName) { if (Build.VERSION.SDK_INT < 16) { return; } @@ -53,7 +53,7 @@ public class NfcHelper { } @TargetApi(16) - public static void disableAndroidBeam(Activity activity) { + public static void disableAndroidBeam(AppCompatActivity activity) { if (Build.VERSION.SDK_INT < 16) { return; } diff --git a/app/src/main/java/org/fdroid/fdroid/Utils.java b/app/src/main/java/org/fdroid/fdroid/Utils.java index 038ddda7a..eedd9110b 100644 --- a/app/src/main/java/org/fdroid/fdroid/Utils.java +++ b/app/src/main/java/org/fdroid/fdroid/Utils.java @@ -944,7 +944,7 @@ public final class Utils { } /** - * Keep an instance of this class as an field in an Activity for figuring out whether the on + * Keep an instance of this class as an field in an AppCompatActivity for figuring out whether the on * screen keyboard is currently visible or not. */ public static class KeyboardStateMonitor { @@ -952,7 +952,7 @@ public final class Utils { private boolean visible = false; /** - * @param contentView this must be the top most Container of the layout used by the Activity + * @param contentView this must be the top most Container of the layout used by the AppCompatActivity */ public KeyboardStateMonitor(final View contentView) { contentView.getViewTreeObserver().addOnGlobalLayoutListener( diff --git a/app/src/main/java/org/fdroid/fdroid/data/ObbUrlActivity.java b/app/src/main/java/org/fdroid/fdroid/data/ObbUrlActivity.java index fed9105a3..5b78cfea5 100644 --- a/app/src/main/java/org/fdroid/fdroid/data/ObbUrlActivity.java +++ b/app/src/main/java/org/fdroid/fdroid/data/ObbUrlActivity.java @@ -1,22 +1,24 @@ package org.fdroid.fdroid.data; -import android.app.Activity; import android.content.ComponentName; import android.content.Intent; import android.content.pm.PackageInfo; import android.net.Uri; import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; + import org.fdroid.fdroid.Utils; /** * Replies with the public download URL for the OBB that belongs to the * requesting app/version. If it doesn't know the OBB URL for the requesting - * app, the {@code resultCode} will be {@link Activity#RESULT_CANCELED}. The - * request must be sent with {@link Activity#startActivityForResult(Intent, int)} + * app, the {@code resultCode} will be {@link AppCompatActivity#RESULT_CANCELED}. The + * request must be sent with {@link AppCompatActivity#startActivityForResult(Intent, int)} * in order to receive a reply, which will include an {@link Intent} with the * URL as data and the SHA-256 hash as a String {@code Intent} extra. */ -public class ObbUrlActivity extends Activity { +public class ObbUrlActivity extends AppCompatActivity { public static final String TAG = "ObbUrlActivity"; public static final String ACTION_GET_OBB_MAIN_URL = "org.fdroid.fdroid.action.GET_OBB_MAIN_URL"; diff --git a/app/src/main/java/org/fdroid/fdroid/installer/DefaultInstallerActivity.java b/app/src/main/java/org/fdroid/fdroid/installer/DefaultInstallerActivity.java index 595718b83..4ba72296c 100644 --- a/app/src/main/java/org/fdroid/fdroid/installer/DefaultInstallerActivity.java +++ b/app/src/main/java/org/fdroid/fdroid/installer/DefaultInstallerActivity.java @@ -21,7 +21,7 @@ package org.fdroid.fdroid.installer; import android.annotation.SuppressLint; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.ActivityNotFoundException; import android.content.ContentResolver; import android.content.Intent; @@ -162,17 +162,17 @@ public class DefaultInstallerActivity extends FragmentActivity { switch (requestCode) { case REQUEST_CODE_INSTALL: switch (resultCode) { - case Activity.RESULT_OK: + case AppCompatActivity.RESULT_OK: installer.sendBroadcastInstall(canonicalUri, Installer.ACTION_INSTALL_COMPLETE); break; - case Activity.RESULT_CANCELED: + case AppCompatActivity.RESULT_CANCELED: installer.sendBroadcastInstall(canonicalUri, Installer.ACTION_INSTALL_INTERRUPTED); break; - case Activity.RESULT_FIRST_USER: + case AppCompatActivity.RESULT_FIRST_USER: default: - // AOSP returns Activity.RESULT_FIRST_USER on error + // AOSP returns AppCompatActivity.RESULT_FIRST_USER on error installer.sendBroadcastInstall(canonicalUri, Installer.ACTION_INSTALL_INTERRUPTED, getString(R.string.install_error_unknown)); @@ -182,13 +182,13 @@ public class DefaultInstallerActivity extends FragmentActivity { break; case REQUEST_CODE_UNINSTALL: switch (resultCode) { - case Activity.RESULT_OK: + case AppCompatActivity.RESULT_OK: installer.sendBroadcastUninstall(Installer.ACTION_UNINSTALL_COMPLETE); break; - case Activity.RESULT_CANCELED: + case AppCompatActivity.RESULT_CANCELED: installer.sendBroadcastUninstall(Installer.ACTION_UNINSTALL_INTERRUPTED); break; - case Activity.RESULT_FIRST_USER: + case AppCompatActivity.RESULT_FIRST_USER: default: // AOSP UninstallAppProgress returns RESULT_FIRST_USER on error installer.sendBroadcastUninstall(Installer.ACTION_UNINSTALL_INTERRUPTED, diff --git a/app/src/main/java/org/fdroid/fdroid/installer/ErrorDialogActivity.java b/app/src/main/java/org/fdroid/fdroid/installer/ErrorDialogActivity.java index 0c7cd6837..29fd90211 100644 --- a/app/src/main/java/org/fdroid/fdroid/installer/ErrorDialogActivity.java +++ b/app/src/main/java/org/fdroid/fdroid/installer/ErrorDialogActivity.java @@ -19,7 +19,7 @@ package org.fdroid.fdroid.installer; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; @@ -52,7 +52,7 @@ public class ErrorDialogActivity extends FragmentActivity { new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - setResult(Activity.RESULT_OK); + setResult(AppCompatActivity.RESULT_OK); finish(); } }); @@ -60,7 +60,7 @@ public class ErrorDialogActivity extends FragmentActivity { new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { - setResult(Activity.RESULT_CANCELED); + setResult(AppCompatActivity.RESULT_CANCELED); finish(); } }); diff --git a/app/src/main/java/org/fdroid/fdroid/installer/Installer.java b/app/src/main/java/org/fdroid/fdroid/installer/Installer.java index a5bd7f872..70beb9956 100644 --- a/app/src/main/java/org/fdroid/fdroid/installer/Installer.java +++ b/app/src/main/java/org/fdroid/fdroid/installer/Installer.java @@ -80,7 +80,7 @@ public abstract class Installer { /** * Returns permission screen for given apk. * - * @return Intent with Activity to show required permissions. + * @return Intent with AppCompatActivity to show required permissions. * Returns null if Installer handles that on itself, e.g., with DefaultInstaller, * or if no new permissions have been introduced during an update */ diff --git a/app/src/main/java/org/fdroid/fdroid/installer/ObfInstallerService.java b/app/src/main/java/org/fdroid/fdroid/installer/ObfInstallerService.java index 8673b7fba..ba67bd736 100644 --- a/app/src/main/java/org/fdroid/fdroid/installer/ObfInstallerService.java +++ b/app/src/main/java/org/fdroid/fdroid/installer/ObfInstallerService.java @@ -115,7 +115,7 @@ public class ObfInstallerService extends IntentService { if (intent != null && intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { - Log.i(TAG, "No Activity available to handle " + intent); + Log.i(TAG, "No AppCompatActivity available to handle " + intent); } sendBroadcastInstall(Installer.ACTION_INSTALL_COMPLETE, canonicalUri, apk, null); } diff --git a/app/src/main/java/org/fdroid/fdroid/net/DownloaderService.java b/app/src/main/java/org/fdroid/fdroid/net/DownloaderService.java index 23b9f5963..315875407 100644 --- a/app/src/main/java/org/fdroid/fdroid/net/DownloaderService.java +++ b/app/src/main/java/org/fdroid/fdroid/net/DownloaderService.java @@ -366,7 +366,7 @@ public class DownloaderService extends Service { /** * Check if a URL is waiting in the queue for downloading or if actively being downloaded. * This is useful for checking whether to re-register {@link android.content.BroadcastReceiver}s - * in {@link android.app.Activity#onResume()}. + * in {@link android.app.AppCompatActivity#onResume()}. */ public static boolean isQueuedOrActive(String canonicalUrl) { if (TextUtils.isEmpty(canonicalUrl)) { //NOPMD - suggests unreadable format diff --git a/app/src/main/java/org/fdroid/fdroid/privileged/views/InstallConfirmActivity.java b/app/src/main/java/org/fdroid/fdroid/privileged/views/InstallConfirmActivity.java index 3c2f315c9..378bead6b 100644 --- a/app/src/main/java/org/fdroid/fdroid/privileged/views/InstallConfirmActivity.java +++ b/app/src/main/java/org/fdroid/fdroid/privileged/views/InstallConfirmActivity.java @@ -24,10 +24,6 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.net.Uri; import android.os.Bundle; - -import androidx.core.content.ContextCompat; -import androidx.fragment.app.FragmentActivity; -import androidx.viewpager.widget.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; @@ -36,7 +32,13 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.TabHost; import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import androidx.viewpager.widget.ViewPager; + import com.nostra13.universalimageloader.core.ImageLoader; + import org.fdroid.fdroid.FDroidApp; import org.fdroid.fdroid.R; import org.fdroid.fdroid.Utils; @@ -51,7 +53,7 @@ import org.fdroid.fdroid.data.Schema; * Parts are based on AOSP src/com/android/packageinstaller/PackageInstallerActivity.java * latest included commit: c23d802958158d522e7350321ad9ac6d43013883 */ -public class InstallConfirmActivity extends FragmentActivity implements OnCancelListener, OnClickListener { +public class InstallConfirmActivity extends AppCompatActivity implements OnCancelListener, OnClickListener { private Intent intent; diff --git a/app/src/main/java/org/fdroid/fdroid/privileged/views/TabsAdapter.java b/app/src/main/java/org/fdroid/fdroid/privileged/views/TabsAdapter.java index 0677c83f8..14315b32d 100644 --- a/app/src/main/java/org/fdroid/fdroid/privileged/views/TabsAdapter.java +++ b/app/src/main/java/org/fdroid/fdroid/privileged/views/TabsAdapter.java @@ -17,7 +17,7 @@ package org.fdroid.fdroid.privileged.views; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.graphics.Rect; import androidx.annotation.NonNull; @@ -67,7 +67,7 @@ class TabsAdapter extends PagerAdapter } } - TabsAdapter(Activity activity, TabHost tabHost, ViewPager pager) { + TabsAdapter(AppCompatActivity activity, TabHost tabHost, ViewPager pager) { context = activity; this.tabHost = tabHost; viewPager = pager; diff --git a/app/src/main/java/org/fdroid/fdroid/privileged/views/UninstallDialogActivity.java b/app/src/main/java/org/fdroid/fdroid/privileged/views/UninstallDialogActivity.java index 753b0ac6e..e390b5106 100644 --- a/app/src/main/java/org/fdroid/fdroid/privileged/views/UninstallDialogActivity.java +++ b/app/src/main/java/org/fdroid/fdroid/privileged/views/UninstallDialogActivity.java @@ -19,7 +19,7 @@ package org.fdroid.fdroid.privileged.views; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ApplicationInfo; @@ -89,7 +89,7 @@ public class UninstallDialogActivity extends FragmentActivity { public void onClick(DialogInterface dialog, int which) { Intent data = new Intent(); data.putExtra(Installer.EXTRA_APK, apk); - setResult(Activity.RESULT_OK, intent); + setResult(AppCompatActivity.RESULT_OK, intent); finish(); } }); @@ -97,7 +97,7 @@ public class UninstallDialogActivity extends FragmentActivity { new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - setResult(Activity.RESULT_CANCELED); + setResult(AppCompatActivity.RESULT_CANCELED); finish(); } }); @@ -105,7 +105,7 @@ public class UninstallDialogActivity extends FragmentActivity { new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { - setResult(Activity.RESULT_CANCELED); + setResult(AppCompatActivity.RESULT_CANCELED); finish(); } }); diff --git a/app/src/main/java/org/fdroid/fdroid/qr/QrGenAsyncTask.java b/app/src/main/java/org/fdroid/fdroid/qr/QrGenAsyncTask.java index 2a50bc475..bf82979c8 100644 --- a/app/src/main/java/org/fdroid/fdroid/qr/QrGenAsyncTask.java +++ b/app/src/main/java/org/fdroid/fdroid/qr/QrGenAsyncTask.java @@ -1,7 +1,7 @@ package org.fdroid.fdroid.qr; import android.annotation.TargetApi; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.graphics.Bitmap; import android.graphics.Point; import android.os.AsyncTask; @@ -17,11 +17,11 @@ import org.fdroid.fdroid.Utils; public class QrGenAsyncTask extends AsyncTask { private static final String TAG = "QrGenAsyncTask"; - private final Activity activity; + private final AppCompatActivity activity; private final int viewId; private Bitmap qrBitmap; - public QrGenAsyncTask(Activity activity, int viewId) { + public QrGenAsyncTask(AppCompatActivity activity, int viewId) { this.activity = activity; this.viewId = viewId; } diff --git a/app/src/main/java/org/fdroid/fdroid/views/AppDetailsActivity.java b/app/src/main/java/org/fdroid/fdroid/views/AppDetailsActivity.java index ef22a9f1f..3280db0a3 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/AppDetailsActivity.java +++ b/app/src/main/java/org/fdroid/fdroid/views/AppDetailsActivity.java @@ -22,7 +22,6 @@ package org.fdroid.fdroid.views; import android.annotation.TargetApi; -import android.app.Activity; import android.app.PendingIntent; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothManager; @@ -36,23 +35,26 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; -import androidx.annotation.Nullable; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.core.content.ContextCompat; -import androidx.localbroadcastmanager.content.LocalBroadcastManager; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.appcompat.widget.Toolbar; import android.text.TextUtils; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.ViewTreeObserver; import android.widget.Toast; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; + import org.fdroid.fdroid.AppUpdateStatusManager; import org.fdroid.fdroid.FDroidApp; import org.fdroid.fdroid.NfcHelper; @@ -314,14 +316,14 @@ public class AppDetailsActivity extends AppCompatActivity fdroidApp.sendViaBluetooth(this, resultCode, app.packageName); break; case REQUEST_PERMISSION_DIALOG: - if (resultCode == Activity.RESULT_OK) { + if (resultCode == AppCompatActivity.RESULT_OK) { Uri uri = data.getData(); Apk apk = ApkProvider.Helper.findByUri(this, uri, Schema.ApkTable.Cols.ALL); InstallManagerService.queue(this, app, apk); } break; case REQUEST_UNINSTALL_DIALOG: - if (resultCode == Activity.RESULT_OK) { + if (resultCode == AppCompatActivity.RESULT_OK) { startUninstall(); } break; diff --git a/app/src/main/java/org/fdroid/fdroid/views/PreferencesFragment.java b/app/src/main/java/org/fdroid/fdroid/views/PreferencesFragment.java index 4caf90faa..74b9e1b8c 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/PreferencesFragment.java +++ b/app/src/main/java/org/fdroid/fdroid/views/PreferencesFragment.java @@ -26,7 +26,6 @@ package org.fdroid.fdroid.views; -import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -36,6 +35,7 @@ import android.os.Bundle; import android.text.TextUtils; import android.view.WindowManager; +import androidx.appcompat.app.AppCompatActivity; import androidx.preference.CheckBoxPreference; import androidx.preference.EditTextPreference; import androidx.preference.ListPreference; @@ -160,7 +160,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat PreferenceCategory category = (PreferenceCategory) findPreference("pref_category_display"); category.removePreference(languagePref); } else { - Languages languages = Languages.get(getActivity()); + Languages languages = Languages.get((AppCompatActivity) getActivity()); languagePref.setDefaultValue(Languages.USE_SYSTEM_DEFAULT); languagePref.setEntries(languages.getAllNames()); languagePref.setEntryValues(languages.getSupportedLocales()); @@ -259,7 +259,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat case Preferences.PREF_THEME: entrySummary(key); if (changing) { - Activity activity = getActivity(); + AppCompatActivity activity = (AppCompatActivity) getActivity(); FDroidApp fdroidApp = (FDroidApp) activity.getApplication(); fdroidApp.reloadTheme(); fdroidApp.applyTheme(activity); @@ -290,7 +290,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat case Preferences.PREF_LANGUAGE: entrySummary(key); if (changing) { - Activity activity = getActivity(); + AppCompatActivity activity = (AppCompatActivity) getActivity(); Languages.setLanguage(activity); RepoProvider.Helper.clearEtags(getActivity()); @@ -462,7 +462,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat public boolean onPreferenceChange(Preference preference, Object enabled) { if ((Boolean) enabled) { enableProxyCheckPref.setChecked(false); - final Activity activity = getActivity(); + final AppCompatActivity activity = (AppCompatActivity) getActivity(); if (!OrbotHelper.isOrbotInstalled(activity)) { Intent intent = OrbotHelper.getOrbotInstallIntent(activity); activity.startActivityForResult(intent, REQUEST_INSTALL_ORBOT); diff --git a/app/src/main/java/org/fdroid/fdroid/views/apps/AppListAdapter.java b/app/src/main/java/org/fdroid/fdroid/views/apps/AppListAdapter.java index a1a0170a3..e54f5ead7 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/apps/AppListAdapter.java +++ b/app/src/main/java/org/fdroid/fdroid/views/apps/AppListAdapter.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.apps; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.database.Cursor; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; @@ -12,10 +12,10 @@ import org.fdroid.fdroid.data.Schema; class AppListAdapter extends RecyclerView.Adapter { private Cursor cursor; - private final Activity activity; + private final AppCompatActivity activity; private final AppListItemDivider divider; - AppListAdapter(Activity activity) { + AppListAdapter(AppCompatActivity activity) { this.activity = activity; divider = new AppListItemDivider(activity); setHasStableIds(true); diff --git a/app/src/main/java/org/fdroid/fdroid/views/apps/AppListItemController.java b/app/src/main/java/org/fdroid/fdroid/views/apps/AppListItemController.java index 0d818f793..9cb587ecb 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/apps/AppListItemController.java +++ b/app/src/main/java/org/fdroid/fdroid/views/apps/AppListItemController.java @@ -1,7 +1,7 @@ package org.fdroid.fdroid.views.apps; import android.annotation.TargetApi; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; @@ -68,7 +68,7 @@ public abstract class AppListItemController extends RecyclerView.ViewHolder { private static Preferences prefs; - protected final Activity activity; + protected final AppCompatActivity activity; @NonNull private final ImageView icon; @@ -111,7 +111,7 @@ public abstract class AppListItemController extends RecyclerView.ViewHolder { private AppUpdateStatus currentStatus; @TargetApi(21) - public AppListItemController(final Activity activity, View itemView) { + public AppListItemController(final AppCompatActivity activity, View itemView) { super(itemView); this.activity = activity; if (prefs == null) { diff --git a/app/src/main/java/org/fdroid/fdroid/views/apps/StandardAppListItemController.java b/app/src/main/java/org/fdroid/fdroid/views/apps/StandardAppListItemController.java index 548cd6f4d..4fefe433c 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/apps/StandardAppListItemController.java +++ b/app/src/main/java/org/fdroid/fdroid/views/apps/StandardAppListItemController.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.apps; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import android.view.View; @@ -18,7 +18,7 @@ import org.fdroid.fdroid.data.App; * */ public class StandardAppListItemController extends AppListItemController { - public StandardAppListItemController(Activity activity, View itemView) { + public StandardAppListItemController(AppCompatActivity activity, View itemView) { super(activity, itemView); } diff --git a/app/src/main/java/org/fdroid/fdroid/views/categories/AppCardController.java b/app/src/main/java/org/fdroid/fdroid/views/categories/AppCardController.java index 70cb8c94f..2d7a09bb2 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/categories/AppCardController.java +++ b/app/src/main/java/org/fdroid/fdroid/views/categories/AppCardController.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.categories; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; @@ -53,9 +53,9 @@ public class AppCardController extends RecyclerView.ViewHolder @Nullable private App currentApp; - private final Activity activity; + private final AppCompatActivity activity; - public AppCardController(Activity activity, View itemView) { + public AppCardController(AppCompatActivity activity, View itemView) { super(itemView); this.activity = activity; diff --git a/app/src/main/java/org/fdroid/fdroid/views/categories/AppPreviewAdapter.java b/app/src/main/java/org/fdroid/fdroid/views/categories/AppPreviewAdapter.java index 22a7b5084..6d4541809 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/categories/AppPreviewAdapter.java +++ b/app/src/main/java/org/fdroid/fdroid/views/categories/AppPreviewAdapter.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.categories; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.database.Cursor; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; @@ -12,9 +12,9 @@ import org.fdroid.fdroid.data.App; class AppPreviewAdapter extends RecyclerView.Adapter { private Cursor cursor; - private final Activity activity; + private final AppCompatActivity activity; - AppPreviewAdapter(Activity activity) { + AppPreviewAdapter(AppCompatActivity activity) { this.activity = activity; } diff --git a/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryAdapter.java b/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryAdapter.java index ec7f1eb7b..8ddc35c41 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryAdapter.java +++ b/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryAdapter.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.categories; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import androidx.loader.app.LoaderManager; import androidx.recyclerview.widget.ListAdapter; @@ -13,10 +13,10 @@ import java.util.List; public class CategoryAdapter extends ListAdapter { - private final Activity activity; + private final AppCompatActivity activity; private final LoaderManager loaderManager; - public CategoryAdapter(Activity activity, LoaderManager loaderManager) { + public CategoryAdapter(AppCompatActivity activity, LoaderManager loaderManager) { super(new DiffUtil.ItemCallback() { @Override public boolean areItemsTheSame(String oldItem, String newItem) { diff --git a/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryController.java b/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryController.java index 12c731a02..98391dead 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryController.java +++ b/app/src/main/java/org/fdroid/fdroid/views/categories/CategoryController.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.categories; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.content.res.Resources; @@ -40,14 +40,14 @@ public class CategoryController extends RecyclerView.ViewHolder implements Loade private final AppPreviewAdapter appCardsAdapter; private final FrameLayout background; - private final Activity activity; + private final AppCompatActivity activity; private final LoaderManager loaderManager; private final DisplayImageOptions displayImageOptions; private static int categoryItemCount = 20; private String currentCategory; - CategoryController(final Activity activity, LoaderManager loaderManager, View itemView) { + CategoryController(final AppCompatActivity activity, LoaderManager loaderManager, View itemView) { super(itemView); this.activity = activity; diff --git a/app/src/main/java/org/fdroid/fdroid/views/installed/InstalledAppListAdapter.java b/app/src/main/java/org/fdroid/fdroid/views/installed/InstalledAppListAdapter.java index e2b6c262d..cb806b575 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/installed/InstalledAppListAdapter.java +++ b/app/src/main/java/org/fdroid/fdroid/views/installed/InstalledAppListAdapter.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.installed; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.database.Cursor; import android.provider.BaseColumns; import androidx.annotation.NonNull; @@ -13,12 +13,12 @@ import org.fdroid.fdroid.data.App; public class InstalledAppListAdapter extends RecyclerView.Adapter { - protected final Activity activity; + protected final AppCompatActivity activity; @Nullable private Cursor cursor; - protected InstalledAppListAdapter(Activity activity) { + protected InstalledAppListAdapter(AppCompatActivity activity) { this.activity = activity; setHasStableIds(true); } diff --git a/app/src/main/java/org/fdroid/fdroid/views/installed/InstalledAppListItemController.java b/app/src/main/java/org/fdroid/fdroid/views/installed/InstalledAppListItemController.java index a505a82d5..ccaacdf46 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/installed/InstalledAppListItemController.java +++ b/app/src/main/java/org/fdroid/fdroid/views/installed/InstalledAppListItemController.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.installed; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import android.view.View; @@ -18,7 +18,7 @@ import org.fdroid.fdroid.views.apps.AppListItemState; * a specific version of this app. */ public class InstalledAppListItemController extends AppListItemController { - public InstalledAppListItemController(Activity activity, View itemView) { + public InstalledAppListItemController(AppCompatActivity activity, View itemView) { super(activity, itemView); } diff --git a/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppStatus.java b/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppStatus.java index 3282e5110..86e64de76 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppStatus.java +++ b/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppStatus.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.updates.items; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import android.view.ViewGroup; @@ -22,16 +22,16 @@ public class AppStatus extends AppUpdateData { public final AppUpdateStatusManager.AppUpdateStatus status; - public AppStatus(Activity activity, AppUpdateStatusManager.AppUpdateStatus status) { + public AppStatus(AppCompatActivity activity, AppUpdateStatusManager.AppUpdateStatus status) { super(activity); this.status = status; } public static class Delegate extends AdapterDelegate> { - private final Activity activity; + private final AppCompatActivity activity; - public Delegate(Activity activity) { + public Delegate(AppCompatActivity activity) { this.activity = activity; } diff --git a/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppStatusListItemController.java b/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppStatusListItemController.java index 265f9f715..bcec7e308 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppStatusListItemController.java +++ b/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppStatusListItemController.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.updates.items; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.android.material.snackbar.Snackbar; @@ -21,7 +21,7 @@ import org.fdroid.fdroid.views.updates.UpdatesAdapter; * * Recently installed and ready to run. */ public class AppStatusListItemController extends AppListItemController { - public AppStatusListItemController(Activity activity, View itemView) { + public AppStatusListItemController(AppCompatActivity activity, View itemView) { super(activity, itemView); } diff --git a/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppUpdateData.java b/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppUpdateData.java index 303319e61..b5db40e90 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppUpdateData.java +++ b/app/src/main/java/org/fdroid/fdroid/views/updates/items/AppUpdateData.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.updates.items; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; /** * Used as a common base class for all data types in the {@link @@ -10,9 +10,9 @@ import android.app.Activity; * to specify a data type more specific than just {@link Object}. */ public abstract class AppUpdateData { // NOPMD This abstract class does not have any abstract methods - public final Activity activity; + public final AppCompatActivity activity; - public AppUpdateData(Activity activity) { + public AppUpdateData(AppCompatActivity activity) { this.activity = activity; } } diff --git a/app/src/main/java/org/fdroid/fdroid/views/updates/items/KnownVulnApp.java b/app/src/main/java/org/fdroid/fdroid/views/updates/items/KnownVulnApp.java index 269a251de..1342fd6eb 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/updates/items/KnownVulnApp.java +++ b/app/src/main/java/org/fdroid/fdroid/views/updates/items/KnownVulnApp.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.updates.items; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import android.view.ViewGroup; @@ -24,16 +24,16 @@ public class KnownVulnApp extends AppUpdateData { public final App app; - public KnownVulnApp(Activity activity, App app) { + public KnownVulnApp(AppCompatActivity activity, App app) { super(activity); this.app = app; } public static class Delegate extends AdapterDelegate> { - private final Activity activity; + private final AppCompatActivity activity; - public Delegate(Activity activity) { + public Delegate(AppCompatActivity activity) { this.activity = activity; } diff --git a/app/src/main/java/org/fdroid/fdroid/views/updates/items/KnownVulnAppListItemController.java b/app/src/main/java/org/fdroid/fdroid/views/updates/items/KnownVulnAppListItemController.java index d5752688f..88ca2e9f4 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/updates/items/KnownVulnAppListItemController.java +++ b/app/src/main/java/org/fdroid/fdroid/views/updates/items/KnownVulnAppListItemController.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.updates.items; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; @@ -32,7 +32,7 @@ import org.fdroid.fdroid.views.updates.UpdatesAdapter; * (e.g. uninstall, update, disable). */ public class KnownVulnAppListItemController extends AppListItemController { - public KnownVulnAppListItemController(Activity activity, View itemView) { + public KnownVulnAppListItemController(AppCompatActivity activity, View itemView) { super(activity, itemView); } diff --git a/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableApp.java b/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableApp.java index 8d0024a38..bbb0c354e 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableApp.java +++ b/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableApp.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.updates.items; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import android.view.ViewGroup; @@ -22,16 +22,16 @@ public class UpdateableApp extends AppUpdateData { public final App app; - public UpdateableApp(Activity activity, App app) { + public UpdateableApp(AppCompatActivity activity, App app) { super(activity); this.app = app; } public static class Delegate extends AdapterDelegate> { - private final Activity activity; + private final AppCompatActivity activity; - public Delegate(Activity activity) { + public Delegate(AppCompatActivity activity) { this.activity = activity; } diff --git a/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableAppListItemController.java b/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableAppListItemController.java index 29eab2bcc..67d9f2a9f 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableAppListItemController.java +++ b/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableAppListItemController.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.updates.items; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.android.material.snackbar.Snackbar; @@ -22,7 +22,7 @@ import org.fdroid.fdroid.views.updates.UpdatesAdapter; * {@link AppStatusListItemController}. */ public class UpdateableAppListItemController extends AppListItemController { - public UpdateableAppListItemController(Activity activity, View itemView) { + public UpdateableAppListItemController(AppCompatActivity activity, View itemView) { super(activity, itemView); } diff --git a/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableAppsHeader.java b/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableAppsHeader.java index eedcdd920..ba8f8aab8 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableAppsHeader.java +++ b/app/src/main/java/org/fdroid/fdroid/views/updates/items/UpdateableAppsHeader.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.updates.items; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import android.text.TextUtils; @@ -29,7 +29,7 @@ public class UpdateableAppsHeader extends AppUpdateData { public final List apps; public final UpdatesAdapter adapter; - public UpdateableAppsHeader(Activity activity, + public UpdateableAppsHeader(AppCompatActivity activity, UpdatesAdapter updatesAdapter, List updateableApps) { super(activity); apps = updateableApps; @@ -40,7 +40,7 @@ public class UpdateableAppsHeader extends AppUpdateData { private final LayoutInflater inflater; - public Delegate(Activity activity) { + public Delegate(AppCompatActivity activity) { inflater = activity.getLayoutInflater(); } diff --git a/app/src/main/java/org/fdroid/fdroid/views/whatsnew/WhatsNewAdapter.java b/app/src/main/java/org/fdroid/fdroid/views/whatsnew/WhatsNewAdapter.java index 3abf0c874..7d1ba624d 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/whatsnew/WhatsNewAdapter.java +++ b/app/src/main/java/org/fdroid/fdroid/views/whatsnew/WhatsNewAdapter.java @@ -1,6 +1,6 @@ package org.fdroid.fdroid.views.whatsnew; -import android.app.Activity; +import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.res.Resources; import android.database.Cursor; @@ -19,10 +19,10 @@ import org.fdroid.fdroid.views.categories.AppCardController; public class WhatsNewAdapter extends RecyclerView.Adapter { private Cursor cursor; - private final Activity activity; + private final AppCompatActivity activity; private final RecyclerView.ItemDecoration appListDecorator; - public WhatsNewAdapter(Activity activity) { + public WhatsNewAdapter(AppCompatActivity activity) { this.activity = activity; appListDecorator = new WhatsNewAdapter.ItemDecorator(activity); }