From 734b9e46623b2ff6715db49c7b6fb9b34b0905ac Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 27 Sep 2019 17:26:56 +0530 Subject: 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 --- app/src/main/java/com/wireguard/android/util/FragmentUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/com/wireguard/android/util/FragmentUtils.java b/app/src/main/java/com/wireguard/android/util/FragmentUtils.java index a3e622b2..5fb9a3bc 100644 --- a/app/src/main/java/com/wireguard/android/util/FragmentUtils.java +++ b/app/src/main/java/com/wireguard/android/util/FragmentUtils.java @@ -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; -- cgit v1.2.3