Quellcode durchsuchen

FragmentUtils: Directly cast context as SettingsActivity

ContextThemeWrapper#getContext seems to be an instance of ContextImpl now which
is not public API and also not what we want. Directly cast context as SettingsActivity
which seems to work exactly how we need this to.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
master
Harsh Shandilya vor 5 Jahren
Ursprung
Commit
c545b5e65f
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. +2
    -2
      app/src/main/java/com/wireguard/android/util/FragmentUtils.java

+ 2
- 2
app/src/main/java/com/wireguard/android/util/FragmentUtils.java Datei anzeigen

@@ -18,8 +18,8 @@ public final class FragmentUtils {
public static SettingsActivity getPrefActivity(final Preference preference) {
final Context context = preference.getContext();
if (context instanceof ContextThemeWrapper) {
if (((ContextThemeWrapper) context).getBaseContext() instanceof SettingsActivity) {
return ((SettingsActivity) ((ContextThemeWrapper) context).getBaseContext());
if (context instanceof SettingsActivity) {
return ((SettingsActivity) context);
}
}
return null;


Laden…
Abbrechen
Speichern