Merge branch 'AppCompatActivity' into 'master'

Change Activity to AppCompatActivity

See merge request fdroid/fdroidclient!969
This commit is contained in:
Hans-Christoph Steiner 2021-01-28 16:52:58 +00:00
commit 2086f50d05
45 changed files with 180 additions and 169 deletions

View File

@ -19,14 +19,14 @@
package org.fdroid.fdroid.nearby; package org.fdroid.fdroid.nearby;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent; import android.content.Intent;
/** /**
* Dummy version for basic app flavor. * Dummy version for basic app flavor.
*/ */
public class TreeUriScannerIntentService { public class TreeUriScannerIntentService {
public static void onActivityResult(Activity activity, Intent intent) { public static void onActivityResult(AppCompatActivity activity, Intent intent) {
throw new IllegalStateException("unimplemented"); throw new IllegalStateException("unimplemented");
} }
} }

View File

@ -1,7 +1,7 @@
package org.fdroid.fdroid.nearby; package org.fdroid.fdroid.nearby;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
@ -195,7 +195,7 @@ public class SwapSuccessView extends SwapView implements LoaderManager.LoaderCal
private final ContentObserver appObserver = new ContentObserver(new Handler()) { private final ContentObserver appObserver = new ContentObserver(new Handler()) {
@Override @Override
public void onChange(boolean selfChange) { public void onChange(boolean selfChange) {
Activity activity = getActivity(); AppCompatActivity activity = getActivity();
if (activity != null && app != null) { if (activity != null && app != null) {
app = AppProvider.Helper.findSpecificApp( app = AppProvider.Helper.findSpecificApp(
activity.getContentResolver(), activity.getContentResolver(),

View File

@ -1,7 +1,7 @@
package org.fdroid.fdroid.nearby; package org.fdroid.fdroid.nearby;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
@ -594,7 +594,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
} }
private void sendFDroidApk() { private void sendFDroidApk() {
((FDroidApp) getApplication()).sendViaBluetooth(this, Activity.RESULT_OK, BuildConfig.APPLICATION_ID); ((FDroidApp) getApplication()).sendViaBluetooth(this, AppCompatActivity.RESULT_OK, BuildConfig.APPLICATION_ID);
} }
/** /**

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.panic; package org.fdroid.fdroid.panic;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
@ -83,7 +83,7 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
prefHide.setEnabled(false); prefHide.setEnabled(false);
prefResetRepos.setChecked(false); prefResetRepos.setChecked(false);
prefResetRepos.setEnabled(false); prefResetRepos.setEnabled(false);
getActivity().setResult(Activity.RESULT_CANCELED); getActivity().setResult(AppCompatActivity.RESULT_CANCELED);
} else { } else {
prefHide.setEnabled(true); prefHide.setEnabled(true);
prefResetRepos.setEnabled(true); prefResetRepos.setEnabled(true);
@ -235,13 +235,13 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
PanicResponder.setTriggerPackageName(getActivity()); PanicResponder.setTriggerPackageName(getActivity());
showPanicApp(PanicResponder.getTriggerPackageName(getActivity())); showPanicApp(PanicResponder.getTriggerPackageName(getActivity()));
getActivity().setResult(Activity.RESULT_OK); getActivity().setResult(AppCompatActivity.RESULT_OK);
} }
}; };
DialogInterface.OnClickListener cancelListener = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener cancelListener = new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
getActivity().setResult(Activity.RESULT_CANCELED); getActivity().setResult(AppCompatActivity.RESULT_CANCELED);
getActivity().finish(); getActivity().finish();
} }
}; };

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.panic; package org.fdroid.fdroid.panic;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context; import android.content.Context;
@ -32,15 +32,15 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
* This {@link Activity} is purely to run events in response to a panic trigger. * This {@link AppCompatActivity} 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} * 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 * 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 * 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 * {@link #onCreate(Bundle)} and {@link #finish()} must be called at the end of
* that method. * that method.
* *
* @see PanicResponder#receivedTriggerFromConnectedApp(Activity) * @see PanicResponder#receivedTriggerFromConnectedApp(AppCompatActivity)
*/ */
public class PanicResponderActivity extends AppCompatActivity { public class PanicResponderActivity extends AppCompatActivity {

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.panic; package org.fdroid.fdroid.panic;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -14,7 +14,7 @@ import java.util.Set;
public class SelectInstalledAppListAdapter extends InstalledAppListAdapter { public class SelectInstalledAppListAdapter extends InstalledAppListAdapter {
private final Set<String> selectedApps; private final Set<String> selectedApps;
SelectInstalledAppListAdapter(Activity activity) { SelectInstalledAppListAdapter(AppCompatActivity activity) {
super(activity); super(activity);
Preferences prefs = Preferences.get(); Preferences prefs = Preferences.get();
selectedApps = prefs.getPanicWipeSet(); selectedApps = prefs.getPanicWipeSet();

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.panic; package org.fdroid.fdroid.panic;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import android.view.View; import android.view.View;
@ -18,7 +18,7 @@ public class SelectInstalledAppListItemController extends InstalledAppListItemCo
private final Set<String> selectedApps; private final Set<String> selectedApps;
public SelectInstalledAppListItemController(Activity activity, View itemView, Set<String> selectedApps) { public SelectInstalledAppListItemController(AppCompatActivity activity, View itemView, Set<String> selectedApps) {
super(activity, itemView); super(activity, itemView);
this.selectedApps = selectedApps; this.selectedApps = selectedApps;
} }

View File

@ -1,10 +1,12 @@
package org.fdroid.fdroid.views.main; 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 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.R;
import org.fdroid.fdroid.views.PreferencesFragment; import org.fdroid.fdroid.views.PreferencesFragment;
import org.fdroid.fdroid.views.updates.UpdatesViewBinder; import org.fdroid.fdroid.views.updates.UpdatesViewBinder;

View File

@ -1,7 +1,7 @@
package org.fdroid.fdroid.views.main; package org.fdroid.fdroid.views.main;
import android.Manifest; import android.Manifest;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.UriPermission; import android.content.UriPermission;
@ -69,7 +69,7 @@ public class NearbyViewBinder {
private static File externalStorage = null; private static File externalStorage = null;
private static View swapView; 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); swapView = activity.getLayoutInflater().inflate(R.layout.main_tab_swap, parent, true);
TextView subtext = swapView.findViewById(R.id.both_parties_need_fdroid_text); TextView subtext = swapView.findViewById(R.id.both_parties_need_fdroid_text);
@ -213,11 +213,11 @@ public class NearbyViewBinder {
} }
} }
Activity activity = null; AppCompatActivity activity = null;
if (context instanceof Activity) { if (context instanceof AppCompatActivity) {
activity = (Activity) context; activity = (AppCompatActivity) context;
} else if (swapView != null && swapView.getContext() instanceof Activity) { } else if (swapView != null && swapView.getContext() instanceof AppCompatActivity) {
activity = (Activity) swapView.getContext(); activity = (AppCompatActivity) swapView.getContext();
} }
if (activity != null) { if (activity != null) {

View File

@ -16,7 +16,6 @@
package com.google.zxing.integration.android; package com.google.zxing.integration.android;
import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -25,9 +24,11 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.util.Log; import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -48,8 +49,8 @@ import java.util.Map;
* <p>It does require that the Barcode Scanner (or work-alike) application is installed. The * <p>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.</p> * {@link #initiateScan()} method will prompt the user to download the application, if needed.</p>
* *
* <p>There are a few steps to using this integration. First, your {@link Activity} must implement * <p>There are a few steps to using this integration. First, your {@link AppCompatActivity} must implement
* the method {@link Activity#onActivityResult(int, int, Intent)} and include a line of code like this:</p> * the method {@link AppCompatActivity#onActivityResult(int, int, Intent)} and include a line of code like this:</p>
* *
* <pre>{@code * <pre>{@code
* public void onActivityResult(int requestCode, int resultCode, Intent intent) { * public void onActivityResult(int requestCode, int resultCode, Intent intent) {
@ -73,7 +74,8 @@ import java.util.Map;
* *
* <p>Note that {@link #initiateScan()} returns an {@link AlertDialog} which is non-null if the * <p>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. * 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.</p> * method.</p>
* *
* <p>You can use {@link #setTitle(String)} to customize the title of this download prompt dialog (or, use * <p>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? // What else supports this intent?
); );
private final Activity activity; private final AppCompatActivity activity;
private final Fragment fragment; private final Fragment fragment;
private String title; private String title;
@ -151,9 +153,9 @@ public class IntentIntegrator {
private final Map<String, Object> moreExtras = new HashMap<>(3); private final Map<String, Object> 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.activity = activity;
this.fragment = null; this.fragment = null;
initializeConfiguration(); initializeConfiguration();
@ -162,10 +164,10 @@ public class IntentIntegrator {
/** /**
* @param fragment {@link Fragment} invoking the integration. * @param fragment {@link Fragment} invoking the integration.
* {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead * {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead
* of an {@link Activity} * of an {@link AppCompatActivity}
*/ */
public IntentIntegrator(Fragment fragment) { public IntentIntegrator(Fragment fragment) {
this.activity = fragment.getActivity(); this.activity = (AppCompatActivity) fragment.getActivity();
this.fragment = fragment; this.fragment = fragment;
initializeConfiguration(); initializeConfiguration();
} }
@ -333,7 +335,7 @@ public class IntentIntegrator {
* *
* @param intent Intent to start. * @param intent Intent to start.
* @param code Request code for the activity * @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) * @see android.app.Fragment#startActivityForResult(Intent, int)
*/ */
protected void startActivityForResult(Intent intent, int code) { protected void startActivityForResult(Intent intent, int code) {
@ -402,8 +404,8 @@ public class IntentIntegrator {
} }
/** /**
* <p>Call this from your {@link Activity}'s * <p>Call this from your {@link AppCompatActivity}'s
* {@link Activity#onActivityResult(int, int, Intent)} method.</p> * {@link AppCompatActivity#onActivityResult(int, int, Intent)} method.</p>
* *
* @param requestCode request code from {@code onActivityResult()} * @param requestCode request code from {@code onActivityResult()}
* @param resultCode result 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) { public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == REQUEST_CODE) { if (requestCode == REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) { if (resultCode == AppCompatActivity.RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT"); String contents = intent.getStringExtra("SCAN_RESULT");
String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT"); String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT");
byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES"); byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES");

View File

@ -31,7 +31,7 @@ import java.util.Locale;
* <p> * <p>
* This only really properly queues {@link Intent}s that get filtered out. The * 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 * {@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 * multiple mirrors are discovered at once, only one in that session will
* likely be added. * likely be added.
*/ */

View File

@ -24,7 +24,7 @@
package org.fdroid.fdroid; package org.fdroid.fdroid;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo; import android.app.ActivityManager.RunningAppProcessInfo;
import android.app.Application; import android.app.Application;
@ -159,7 +159,7 @@ public class FDroidApp extends Application {
curTheme = Preferences.get().getTheme(); curTheme = Preferences.get().getTheme();
} }
public void applyTheme(Activity activity) { public void applyTheme(AppCompatActivity activity) {
activity.setTheme(getCurThemeResId()); activity.setTheme(getCurThemeResId());
setSecureWindow(activity); setSecureWindow(activity);
} }
@ -181,12 +181,12 @@ public class FDroidApp extends Application {
return curTheme == Theme.light; return curTheme == Theme.light;
} }
public void applyDialogTheme(Activity activity) { public void applyDialogTheme(AppCompatActivity activity) {
activity.setTheme(getCurDialogThemeResId()); activity.setTheme(getCurDialogThemeResId());
setSecureWindow(activity); setSecureWindow(activity);
} }
public void setSecureWindow(Activity activity) { public void setSecureWindow(AppCompatActivity activity) {
if (Preferences.get().preventScreenshots()) { if (Preferences.get().preventScreenshots()) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); 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.} * Force reload the {@link AppCompatActivity to make theme changes take effect.}
* Same as {@link Languages#forceChangeLanguage(Activity)} * 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(); Intent intent = activity.getIntent();
if (intent == null) { // when launched as LAUNCHER if (intent == null) { // when launched as LAUNCHER
return; return;
@ -602,8 +602,8 @@ public class FDroidApp extends Application {
return getSharedPreferences("at-start-time", Context.MODE_PRIVATE); return getSharedPreferences("at-start-time", Context.MODE_PRIVATE);
} }
public void sendViaBluetooth(Activity activity, int resultCode, String packageName) { public void sendViaBluetooth(AppCompatActivity activity, int resultCode, String packageName) {
if (resultCode == Activity.RESULT_CANCELED) { if (resultCode == AppCompatActivity.RESULT_CANCELED) {
return; return;
} }

View File

@ -1,7 +1,6 @@
package org.fdroid.fdroid; package org.fdroid.fdroid;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ContextWrapper; import android.content.ContextWrapper;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
@ -9,6 +8,8 @@ import android.content.res.Resources;
import android.os.Build; import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.appcompat.app.AppCompatActivity;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
@ -35,7 +36,7 @@ public final class Languages {
DEFAULT_LOCALE = Locale.getDefault(); DEFAULT_LOCALE = Locale.getDefault();
} }
private Languages(Activity activity) { private Languages(AppCompatActivity activity) {
Set<Locale> localeSet = new LinkedHashSet<>(); Set<Locale> localeSet = new LinkedHashSet<>();
localeSet.addAll(Arrays.asList(LOCALES_TO_TEST)); 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 * @return the singleton to work with
*/ */
public static Languages get(Activity activity) { public static Languages get(AppCompatActivity activity) {
if (singleton == null) { if (singleton == null) {
singleton = new Languages(activity); 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) { if (Build.VERSION.SDK_INT >= 24) {
Utils.debugLog(TAG, "Languages.forceChangeLanguage() ignored on >= android-24"); Utils.debugLog(TAG, "Languages.forceChangeLanguage() ignored on >= android-24");
return; return;

View File

@ -1,7 +1,7 @@
package org.fdroid.fdroid; package org.fdroid.fdroid;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.Context; import android.content.Context;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
@ -20,7 +20,7 @@ public class NfcHelper {
return NfcAdapter.getDefaultAdapter(context.getApplicationContext()); 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); NfcAdapter adapter = getAdapter(activity);
if (adapter != null) { if (adapter != null) {
adapter.setNdefPushMessage(new NdefMessage(new NdefRecord[]{ adapter.setNdefPushMessage(new NdefMessage(new NdefRecord[]{
@ -32,7 +32,7 @@ public class NfcHelper {
} }
@TargetApi(16) @TargetApi(16)
public static void setAndroidBeam(Activity activity, String packageName) { public static void setAndroidBeam(AppCompatActivity activity, String packageName) {
if (Build.VERSION.SDK_INT < 16) { if (Build.VERSION.SDK_INT < 16) {
return; return;
} }
@ -53,7 +53,7 @@ public class NfcHelper {
} }
@TargetApi(16) @TargetApi(16)
public static void disableAndroidBeam(Activity activity) { public static void disableAndroidBeam(AppCompatActivity activity) {
if (Build.VERSION.SDK_INT < 16) { if (Build.VERSION.SDK_INT < 16) {
return; return;
} }

View File

@ -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. * screen keyboard is currently visible or not.
*/ */
public static class KeyboardStateMonitor { public static class KeyboardStateMonitor {
@ -952,7 +952,7 @@ public final class Utils {
private boolean visible = false; 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) { public KeyboardStateMonitor(final View contentView) {
contentView.getViewTreeObserver().addOnGlobalLayoutListener( contentView.getViewTreeObserver().addOnGlobalLayoutListener(

View File

@ -1,22 +1,24 @@
package org.fdroid.fdroid.data; package org.fdroid.fdroid.data;
import android.app.Activity;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import org.fdroid.fdroid.Utils; import org.fdroid.fdroid.Utils;
/** /**
* Replies with the public download URL for the OBB that belongs to the * 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 * 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 * app, the {@code resultCode} will be {@link AppCompatActivity#RESULT_CANCELED}. The
* request must be sent with {@link Activity#startActivityForResult(Intent, int)} * request must be sent with {@link AppCompatActivity#startActivityForResult(Intent, int)}
* in order to receive a reply, which will include an {@link Intent} with the * 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. * 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 TAG = "ObbUrlActivity";
public static final String ACTION_GET_OBB_MAIN_URL = "org.fdroid.fdroid.action.GET_OBB_MAIN_URL"; public static final String ACTION_GET_OBB_MAIN_URL = "org.fdroid.fdroid.action.GET_OBB_MAIN_URL";

View File

@ -21,7 +21,7 @@
package org.fdroid.fdroid.installer; package org.fdroid.fdroid.installer;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Intent; import android.content.Intent;
@ -162,17 +162,17 @@ public class DefaultInstallerActivity extends FragmentActivity {
switch (requestCode) { switch (requestCode) {
case REQUEST_CODE_INSTALL: case REQUEST_CODE_INSTALL:
switch (resultCode) { switch (resultCode) {
case Activity.RESULT_OK: case AppCompatActivity.RESULT_OK:
installer.sendBroadcastInstall(canonicalUri, installer.sendBroadcastInstall(canonicalUri,
Installer.ACTION_INSTALL_COMPLETE); Installer.ACTION_INSTALL_COMPLETE);
break; break;
case Activity.RESULT_CANCELED: case AppCompatActivity.RESULT_CANCELED:
installer.sendBroadcastInstall(canonicalUri, installer.sendBroadcastInstall(canonicalUri,
Installer.ACTION_INSTALL_INTERRUPTED); Installer.ACTION_INSTALL_INTERRUPTED);
break; break;
case Activity.RESULT_FIRST_USER: case AppCompatActivity.RESULT_FIRST_USER:
default: default:
// AOSP returns Activity.RESULT_FIRST_USER on error // AOSP returns AppCompatActivity.RESULT_FIRST_USER on error
installer.sendBroadcastInstall(canonicalUri, installer.sendBroadcastInstall(canonicalUri,
Installer.ACTION_INSTALL_INTERRUPTED, Installer.ACTION_INSTALL_INTERRUPTED,
getString(R.string.install_error_unknown)); getString(R.string.install_error_unknown));
@ -182,13 +182,13 @@ public class DefaultInstallerActivity extends FragmentActivity {
break; break;
case REQUEST_CODE_UNINSTALL: case REQUEST_CODE_UNINSTALL:
switch (resultCode) { switch (resultCode) {
case Activity.RESULT_OK: case AppCompatActivity.RESULT_OK:
installer.sendBroadcastUninstall(Installer.ACTION_UNINSTALL_COMPLETE); installer.sendBroadcastUninstall(Installer.ACTION_UNINSTALL_COMPLETE);
break; break;
case Activity.RESULT_CANCELED: case AppCompatActivity.RESULT_CANCELED:
installer.sendBroadcastUninstall(Installer.ACTION_UNINSTALL_INTERRUPTED); installer.sendBroadcastUninstall(Installer.ACTION_UNINSTALL_INTERRUPTED);
break; break;
case Activity.RESULT_FIRST_USER: case AppCompatActivity.RESULT_FIRST_USER:
default: default:
// AOSP UninstallAppProgress returns RESULT_FIRST_USER on error // AOSP UninstallAppProgress returns RESULT_FIRST_USER on error
installer.sendBroadcastUninstall(Installer.ACTION_UNINSTALL_INTERRUPTED, installer.sendBroadcastUninstall(Installer.ACTION_UNINSTALL_INTERRUPTED,

View File

@ -19,7 +19,7 @@
package org.fdroid.fdroid.installer; package org.fdroid.fdroid.installer;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
@ -52,7 +52,7 @@ public class ErrorDialogActivity extends FragmentActivity {
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
setResult(Activity.RESULT_OK); setResult(AppCompatActivity.RESULT_OK);
finish(); finish();
} }
}); });
@ -60,7 +60,7 @@ public class ErrorDialogActivity extends FragmentActivity {
new DialogInterface.OnCancelListener() { new DialogInterface.OnCancelListener() {
@Override @Override
public void onCancel(DialogInterface dialog) { public void onCancel(DialogInterface dialog) {
setResult(Activity.RESULT_CANCELED); setResult(AppCompatActivity.RESULT_CANCELED);
finish(); finish();
} }
}); });

View File

@ -80,7 +80,7 @@ public abstract class Installer {
/** /**
* Returns permission screen for given apk. * 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, * Returns null if Installer handles that on itself, e.g., with DefaultInstaller,
* or if no new permissions have been introduced during an update * or if no new permissions have been introduced during an update
*/ */

View File

@ -115,7 +115,7 @@ public class ObfInstallerService extends IntentService {
if (intent != null && intent.resolveActivity(getPackageManager()) != null) { if (intent != null && intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent); startActivity(intent);
} else { } 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); sendBroadcastInstall(Installer.ACTION_INSTALL_COMPLETE, canonicalUri, apk, null);
} }

View File

@ -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. * 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 * 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) { public static boolean isQueuedOrActive(String canonicalUrl) {
if (TextUtils.isEmpty(canonicalUrl)) { //NOPMD - suggests unreadable format if (TextUtils.isEmpty(canonicalUrl)) { //NOPMD - suggests unreadable format

View File

@ -24,10 +24,6 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; 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.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -36,7 +32,13 @@ import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TabHost; import android.widget.TabHost;
import android.widget.TextView; 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 com.nostra13.universalimageloader.core.ImageLoader;
import org.fdroid.fdroid.FDroidApp; import org.fdroid.fdroid.FDroidApp;
import org.fdroid.fdroid.R; import org.fdroid.fdroid.R;
import org.fdroid.fdroid.Utils; 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 * Parts are based on AOSP src/com/android/packageinstaller/PackageInstallerActivity.java
* latest included commit: c23d802958158d522e7350321ad9ac6d43013883 * latest included commit: c23d802958158d522e7350321ad9ac6d43013883
*/ */
public class InstallConfirmActivity extends FragmentActivity implements OnCancelListener, OnClickListener { public class InstallConfirmActivity extends AppCompatActivity implements OnCancelListener, OnClickListener {
private Intent intent; private Intent intent;

View File

@ -17,7 +17,7 @@
package org.fdroid.fdroid.privileged.views; package org.fdroid.fdroid.privileged.views;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.Context; import android.content.Context;
import android.graphics.Rect; import android.graphics.Rect;
import androidx.annotation.NonNull; 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; context = activity;
this.tabHost = tabHost; this.tabHost = tabHost;
viewPager = pager; viewPager = pager;

View File

@ -19,7 +19,7 @@
package org.fdroid.fdroid.privileged.views; package org.fdroid.fdroid.privileged.views;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
@ -89,7 +89,7 @@ public class UninstallDialogActivity extends FragmentActivity {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Intent data = new Intent(); Intent data = new Intent();
data.putExtra(Installer.EXTRA_APK, apk); data.putExtra(Installer.EXTRA_APK, apk);
setResult(Activity.RESULT_OK, intent); setResult(AppCompatActivity.RESULT_OK, intent);
finish(); finish();
} }
}); });
@ -97,7 +97,7 @@ public class UninstallDialogActivity extends FragmentActivity {
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
setResult(Activity.RESULT_CANCELED); setResult(AppCompatActivity.RESULT_CANCELED);
finish(); finish();
} }
}); });
@ -105,7 +105,7 @@ public class UninstallDialogActivity extends FragmentActivity {
new DialogInterface.OnCancelListener() { new DialogInterface.OnCancelListener() {
@Override @Override
public void onCancel(DialogInterface dialog) { public void onCancel(DialogInterface dialog) {
setResult(Activity.RESULT_CANCELED); setResult(AppCompatActivity.RESULT_CANCELED);
finish(); finish();
} }
}); });

View File

@ -1,7 +1,7 @@
package org.fdroid.fdroid.qr; package org.fdroid.fdroid.qr;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Point; import android.graphics.Point;
import android.os.AsyncTask; import android.os.AsyncTask;
@ -17,11 +17,11 @@ import org.fdroid.fdroid.Utils;
public class QrGenAsyncTask extends AsyncTask<String, Void, Void> { public class QrGenAsyncTask extends AsyncTask<String, Void, Void> {
private static final String TAG = "QrGenAsyncTask"; private static final String TAG = "QrGenAsyncTask";
private final Activity activity; private final AppCompatActivity activity;
private final int viewId; private final int viewId;
private Bitmap qrBitmap; private Bitmap qrBitmap;
public QrGenAsyncTask(Activity activity, int viewId) { public QrGenAsyncTask(AppCompatActivity activity, int viewId) {
this.activity = activity; this.activity = activity;
this.viewId = viewId; this.viewId = viewId;
} }

View File

@ -22,7 +22,6 @@
package org.fdroid.fdroid.views; package org.fdroid.fdroid.views;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothManager; import android.bluetooth.BluetoothManager;
@ -36,23 +35,26 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; 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.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.widget.Toast; 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.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoader;
import org.fdroid.fdroid.AppUpdateStatusManager; import org.fdroid.fdroid.AppUpdateStatusManager;
import org.fdroid.fdroid.FDroidApp; import org.fdroid.fdroid.FDroidApp;
import org.fdroid.fdroid.NfcHelper; import org.fdroid.fdroid.NfcHelper;
@ -314,14 +316,14 @@ public class AppDetailsActivity extends AppCompatActivity
fdroidApp.sendViaBluetooth(this, resultCode, app.packageName); fdroidApp.sendViaBluetooth(this, resultCode, app.packageName);
break; break;
case REQUEST_PERMISSION_DIALOG: case REQUEST_PERMISSION_DIALOG:
if (resultCode == Activity.RESULT_OK) { if (resultCode == AppCompatActivity.RESULT_OK) {
Uri uri = data.getData(); Uri uri = data.getData();
Apk apk = ApkProvider.Helper.findByUri(this, uri, Schema.ApkTable.Cols.ALL); Apk apk = ApkProvider.Helper.findByUri(this, uri, Schema.ApkTable.Cols.ALL);
InstallManagerService.queue(this, app, apk); InstallManagerService.queue(this, app, apk);
} }
break; break;
case REQUEST_UNINSTALL_DIALOG: case REQUEST_UNINSTALL_DIALOG:
if (resultCode == Activity.RESULT_OK) { if (resultCode == AppCompatActivity.RESULT_OK) {
startUninstall(); startUninstall();
} }
break; break;

View File

@ -26,7 +26,6 @@
package org.fdroid.fdroid.views; package org.fdroid.fdroid.views;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -36,6 +35,7 @@ import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.WindowManager; import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.CheckBoxPreference; import androidx.preference.CheckBoxPreference;
import androidx.preference.EditTextPreference; import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference; import androidx.preference.ListPreference;
@ -160,7 +160,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat
PreferenceCategory category = (PreferenceCategory) findPreference("pref_category_display"); PreferenceCategory category = (PreferenceCategory) findPreference("pref_category_display");
category.removePreference(languagePref); category.removePreference(languagePref);
} else { } else {
Languages languages = Languages.get(getActivity()); Languages languages = Languages.get((AppCompatActivity) getActivity());
languagePref.setDefaultValue(Languages.USE_SYSTEM_DEFAULT); languagePref.setDefaultValue(Languages.USE_SYSTEM_DEFAULT);
languagePref.setEntries(languages.getAllNames()); languagePref.setEntries(languages.getAllNames());
languagePref.setEntryValues(languages.getSupportedLocales()); languagePref.setEntryValues(languages.getSupportedLocales());
@ -259,7 +259,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat
case Preferences.PREF_THEME: case Preferences.PREF_THEME:
entrySummary(key); entrySummary(key);
if (changing) { if (changing) {
Activity activity = getActivity(); AppCompatActivity activity = (AppCompatActivity) getActivity();
FDroidApp fdroidApp = (FDroidApp) activity.getApplication(); FDroidApp fdroidApp = (FDroidApp) activity.getApplication();
fdroidApp.reloadTheme(); fdroidApp.reloadTheme();
fdroidApp.applyTheme(activity); fdroidApp.applyTheme(activity);
@ -290,7 +290,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat
case Preferences.PREF_LANGUAGE: case Preferences.PREF_LANGUAGE:
entrySummary(key); entrySummary(key);
if (changing) { if (changing) {
Activity activity = getActivity(); AppCompatActivity activity = (AppCompatActivity) getActivity();
Languages.setLanguage(activity); Languages.setLanguage(activity);
RepoProvider.Helper.clearEtags(getActivity()); RepoProvider.Helper.clearEtags(getActivity());
@ -462,7 +462,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat
public boolean onPreferenceChange(Preference preference, Object enabled) { public boolean onPreferenceChange(Preference preference, Object enabled) {
if ((Boolean) enabled) { if ((Boolean) enabled) {
enableProxyCheckPref.setChecked(false); enableProxyCheckPref.setChecked(false);
final Activity activity = getActivity(); final AppCompatActivity activity = (AppCompatActivity) getActivity();
if (!OrbotHelper.isOrbotInstalled(activity)) { if (!OrbotHelper.isOrbotInstalled(activity)) {
Intent intent = OrbotHelper.getOrbotInstallIntent(activity); Intent intent = OrbotHelper.getOrbotInstallIntent(activity);
activity.startActivityForResult(intent, REQUEST_INSTALL_ORBOT); activity.startActivityForResult(intent, REQUEST_INSTALL_ORBOT);

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.apps; package org.fdroid.fdroid.views.apps;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.database.Cursor; import android.database.Cursor;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -12,10 +12,10 @@ import org.fdroid.fdroid.data.Schema;
class AppListAdapter extends RecyclerView.Adapter<StandardAppListItemController> { class AppListAdapter extends RecyclerView.Adapter<StandardAppListItemController> {
private Cursor cursor; private Cursor cursor;
private final Activity activity; private final AppCompatActivity activity;
private final AppListItemDivider divider; private final AppListItemDivider divider;
AppListAdapter(Activity activity) { AppListAdapter(AppCompatActivity activity) {
this.activity = activity; this.activity = activity;
divider = new AppListItemDivider(activity); divider = new AppListItemDivider(activity);
setHasStableIds(true); setHasStableIds(true);

View File

@ -1,7 +1,7 @@
package org.fdroid.fdroid.views.apps; package org.fdroid.fdroid.views.apps;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
@ -68,7 +68,7 @@ public abstract class AppListItemController extends RecyclerView.ViewHolder {
private static Preferences prefs; private static Preferences prefs;
protected final Activity activity; protected final AppCompatActivity activity;
@NonNull @NonNull
private final ImageView icon; private final ImageView icon;
@ -111,7 +111,7 @@ public abstract class AppListItemController extends RecyclerView.ViewHolder {
private AppUpdateStatus currentStatus; private AppUpdateStatus currentStatus;
@TargetApi(21) @TargetApi(21)
public AppListItemController(final Activity activity, View itemView) { public AppListItemController(final AppCompatActivity activity, View itemView) {
super(itemView); super(itemView);
this.activity = activity; this.activity = activity;
if (prefs == null) { if (prefs == null) {

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.apps; package org.fdroid.fdroid.views.apps;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import android.view.View; import android.view.View;
@ -18,7 +18,7 @@ import org.fdroid.fdroid.data.App;
* </ul> * </ul>
*/ */
public class StandardAppListItemController extends AppListItemController { public class StandardAppListItemController extends AppListItemController {
public StandardAppListItemController(Activity activity, View itemView) { public StandardAppListItemController(AppCompatActivity activity, View itemView) {
super(activity, itemView); super(activity, itemView);
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.categories; package org.fdroid.fdroid.views.categories;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
@ -53,9 +53,9 @@ public class AppCardController extends RecyclerView.ViewHolder
@Nullable @Nullable
private App currentApp; 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); super(itemView);
this.activity = activity; this.activity = activity;

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.categories; package org.fdroid.fdroid.views.categories;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.database.Cursor; import android.database.Cursor;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -12,9 +12,9 @@ import org.fdroid.fdroid.data.App;
class AppPreviewAdapter extends RecyclerView.Adapter<AppCardController> { class AppPreviewAdapter extends RecyclerView.Adapter<AppCardController> {
private Cursor cursor; private Cursor cursor;
private final Activity activity; private final AppCompatActivity activity;
AppPreviewAdapter(Activity activity) { AppPreviewAdapter(AppCompatActivity activity) {
this.activity = activity; this.activity = activity;
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.categories; package org.fdroid.fdroid.views.categories;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.loader.app.LoaderManager; import androidx.loader.app.LoaderManager;
import androidx.recyclerview.widget.ListAdapter; import androidx.recyclerview.widget.ListAdapter;
@ -13,10 +13,10 @@ import java.util.List;
public class CategoryAdapter extends ListAdapter<String, CategoryController> { public class CategoryAdapter extends ListAdapter<String, CategoryController> {
private final Activity activity; private final AppCompatActivity activity;
private final LoaderManager loaderManager; private final LoaderManager loaderManager;
public CategoryAdapter(Activity activity, LoaderManager loaderManager) { public CategoryAdapter(AppCompatActivity activity, LoaderManager loaderManager) {
super(new DiffUtil.ItemCallback<String>() { super(new DiffUtil.ItemCallback<String>() {
@Override @Override
public boolean areItemsTheSame(String oldItem, String newItem) { public boolean areItemsTheSame(String oldItem, String newItem) {

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.categories; package org.fdroid.fdroid.views.categories;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
@ -40,14 +40,14 @@ public class CategoryController extends RecyclerView.ViewHolder implements Loade
private final AppPreviewAdapter appCardsAdapter; private final AppPreviewAdapter appCardsAdapter;
private final FrameLayout background; private final FrameLayout background;
private final Activity activity; private final AppCompatActivity activity;
private final LoaderManager loaderManager; private final LoaderManager loaderManager;
private final DisplayImageOptions displayImageOptions; private final DisplayImageOptions displayImageOptions;
private static int categoryItemCount = 20; private static int categoryItemCount = 20;
private String currentCategory; private String currentCategory;
CategoryController(final Activity activity, LoaderManager loaderManager, View itemView) { CategoryController(final AppCompatActivity activity, LoaderManager loaderManager, View itemView) {
super(itemView); super(itemView);
this.activity = activity; this.activity = activity;

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.installed; package org.fdroid.fdroid.views.installed;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.database.Cursor; import android.database.Cursor;
import android.provider.BaseColumns; import android.provider.BaseColumns;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -13,12 +13,12 @@ import org.fdroid.fdroid.data.App;
public class InstalledAppListAdapter extends RecyclerView.Adapter<InstalledAppListItemController> { public class InstalledAppListAdapter extends RecyclerView.Adapter<InstalledAppListItemController> {
protected final Activity activity; protected final AppCompatActivity activity;
@Nullable @Nullable
private Cursor cursor; private Cursor cursor;
protected InstalledAppListAdapter(Activity activity) { protected InstalledAppListAdapter(AppCompatActivity activity) {
this.activity = activity; this.activity = activity;
setHasStableIds(true); setHasStableIds(true);
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.installed; package org.fdroid.fdroid.views.installed;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import android.view.View; import android.view.View;
@ -18,7 +18,7 @@ import org.fdroid.fdroid.views.apps.AppListItemState;
* a specific version of this app. * a specific version of this app.
*/ */
public class InstalledAppListItemController extends AppListItemController { public class InstalledAppListItemController extends AppListItemController {
public InstalledAppListItemController(Activity activity, View itemView) { public InstalledAppListItemController(AppCompatActivity activity, View itemView) {
super(activity, itemView); super(activity, itemView);
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.updates.items; package org.fdroid.fdroid.views.updates.items;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -22,16 +22,16 @@ public class AppStatus extends AppUpdateData {
public final AppUpdateStatusManager.AppUpdateStatus status; public final AppUpdateStatusManager.AppUpdateStatus status;
public AppStatus(Activity activity, AppUpdateStatusManager.AppUpdateStatus status) { public AppStatus(AppCompatActivity activity, AppUpdateStatusManager.AppUpdateStatus status) {
super(activity); super(activity);
this.status = status; this.status = status;
} }
public static class Delegate extends AdapterDelegate<List<AppUpdateData>> { public static class Delegate extends AdapterDelegate<List<AppUpdateData>> {
private final Activity activity; private final AppCompatActivity activity;
public Delegate(Activity activity) { public Delegate(AppCompatActivity activity) {
this.activity = activity; this.activity = activity;
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.updates.items; package org.fdroid.fdroid.views.updates.items;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
@ -21,7 +21,7 @@ import org.fdroid.fdroid.views.updates.UpdatesAdapter;
* * Recently installed and ready to run. * * Recently installed and ready to run.
*/ */
public class AppStatusListItemController extends AppListItemController { public class AppStatusListItemController extends AppListItemController {
public AppStatusListItemController(Activity activity, View itemView) { public AppStatusListItemController(AppCompatActivity activity, View itemView) {
super(activity, itemView); super(activity, itemView);
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.updates.items; 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 * 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}. * 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 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; this.activity = activity;
} }
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.updates.items; package org.fdroid.fdroid.views.updates.items;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -24,16 +24,16 @@ public class KnownVulnApp extends AppUpdateData {
public final App app; public final App app;
public KnownVulnApp(Activity activity, App app) { public KnownVulnApp(AppCompatActivity activity, App app) {
super(activity); super(activity);
this.app = app; this.app = app;
} }
public static class Delegate extends AdapterDelegate<List<AppUpdateData>> { public static class Delegate extends AdapterDelegate<List<AppUpdateData>> {
private final Activity activity; private final AppCompatActivity activity;
public Delegate(Activity activity) { public Delegate(AppCompatActivity activity) {
this.activity = activity; this.activity = activity;
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.updates.items; package org.fdroid.fdroid.views.updates.items;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
@ -32,7 +32,7 @@ import org.fdroid.fdroid.views.updates.UpdatesAdapter;
* (e.g. uninstall, update, disable). * (e.g. uninstall, update, disable).
*/ */
public class KnownVulnAppListItemController extends AppListItemController { public class KnownVulnAppListItemController extends AppListItemController {
public KnownVulnAppListItemController(Activity activity, View itemView) { public KnownVulnAppListItemController(AppCompatActivity activity, View itemView) {
super(activity, itemView); super(activity, itemView);
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.updates.items; package org.fdroid.fdroid.views.updates.items;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -22,16 +22,16 @@ public class UpdateableApp extends AppUpdateData {
public final App app; public final App app;
public UpdateableApp(Activity activity, App app) { public UpdateableApp(AppCompatActivity activity, App app) {
super(activity); super(activity);
this.app = app; this.app = app;
} }
public static class Delegate extends AdapterDelegate<List<AppUpdateData>> { public static class Delegate extends AdapterDelegate<List<AppUpdateData>> {
private final Activity activity; private final AppCompatActivity activity;
public Delegate(Activity activity) { public Delegate(AppCompatActivity activity) {
this.activity = activity; this.activity = activity;
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.updates.items; package org.fdroid.fdroid.views.updates.items;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
@ -22,7 +22,7 @@ import org.fdroid.fdroid.views.updates.UpdatesAdapter;
* {@link AppStatusListItemController}. * {@link AppStatusListItemController}.
*/ */
public class UpdateableAppListItemController extends AppListItemController { public class UpdateableAppListItemController extends AppListItemController {
public UpdateableAppListItemController(Activity activity, View itemView) { public UpdateableAppListItemController(AppCompatActivity activity, View itemView) {
super(activity, itemView); super(activity, itemView);
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.updates.items; package org.fdroid.fdroid.views.updates.items;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
@ -29,7 +29,7 @@ public class UpdateableAppsHeader extends AppUpdateData {
public final List<UpdateableApp> apps; public final List<UpdateableApp> apps;
public final UpdatesAdapter adapter; public final UpdatesAdapter adapter;
public UpdateableAppsHeader(Activity activity, public UpdateableAppsHeader(AppCompatActivity activity,
UpdatesAdapter updatesAdapter, List<UpdateableApp> updateableApps) { UpdatesAdapter updatesAdapter, List<UpdateableApp> updateableApps) {
super(activity); super(activity);
apps = updateableApps; apps = updateableApps;
@ -40,7 +40,7 @@ public class UpdateableAppsHeader extends AppUpdateData {
private final LayoutInflater inflater; private final LayoutInflater inflater;
public Delegate(Activity activity) { public Delegate(AppCompatActivity activity) {
inflater = activity.getLayoutInflater(); inflater = activity.getLayoutInflater();
} }

View File

@ -1,6 +1,6 @@
package org.fdroid.fdroid.views.whatsnew; package org.fdroid.fdroid.views.whatsnew;
import android.app.Activity; import androidx.appcompat.app.AppCompatActivity;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.database.Cursor; import android.database.Cursor;
@ -19,10 +19,10 @@ import org.fdroid.fdroid.views.categories.AppCardController;
public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> { public class WhatsNewAdapter extends RecyclerView.Adapter<AppCardController> {
private Cursor cursor; private Cursor cursor;
private final Activity activity; private final AppCompatActivity activity;
private final RecyclerView.ItemDecoration appListDecorator; private final RecyclerView.ItemDecoration appListDecorator;
public WhatsNewAdapter(Activity activity) { public WhatsNewAdapter(AppCompatActivity activity) {
this.activity = activity; this.activity = activity;
appListDecorator = new WhatsNewAdapter.ItemDecorator(activity); appListDecorator = new WhatsNewAdapter.ItemDecorator(activity);
} }