aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceFragmentCompat.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/SecurityPreferenceFragment.java12
2 files changed, 19 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceFragmentCompat.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceFragmentCompat.java
index 695131cf..3357918a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceFragmentCompat.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceFragmentCompat.java
@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
+import androidx.preference.PreferenceScreen;
import ml.docilealligator.infinityforreddit.CustomFontReceiver;
import ml.docilealligator.infinityforreddit.CustomThemeWrapperReceiver;
@@ -20,9 +21,13 @@ public abstract class CustomFontPreferenceFragmentCompat extends PreferenceFragm
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- int preferenceCount = getPreferenceScreen().getPreferenceCount();
+ PreferenceScreen preferenceScreen = getPreferenceScreen();
+ if (preferenceScreen == null)
+ return;
+
+ int preferenceCount = preferenceScreen.getPreferenceCount();
for (int i = 0; i < preferenceCount; i++) {
- Preference preference = getPreferenceScreen().getPreference(i);
+ Preference preference = preferenceScreen.getPreference(i);
if (preference instanceof CustomThemeWrapperReceiver) {
((CustomThemeWrapperReceiver) preference).setCustomThemeWrapper(activity.customThemeWrapper);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SecurityPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SecurityPreferenceFragment.java
index a1d49a82..b62a6b98 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SecurityPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SecurityPreferenceFragment.java
@@ -34,8 +34,14 @@ public class SecurityPreferenceFragment extends CustomFontPreferenceFragmentComp
@Named("default")
SharedPreferences sharedPreferences;
+ String rootKey;
+
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ this.rootKey = rootKey;
+ }
+
+ private void createPreferences() {
PreferenceManager preferenceManager = getPreferenceManager();
preferenceManager.setSharedPreferencesName(SharedPreferencesUtils.SECURITY_SHARED_PREFERENCES_FILE);
setPreferencesFromResource(R.xml.security_preferences, rootKey);
@@ -81,6 +87,12 @@ public class SecurityPreferenceFragment extends CustomFontPreferenceFragmentComp
BiometricPrompt biometricPrompt = new BiometricPrompt(SecurityPreferenceFragment.this,
executor, new BiometricPrompt.AuthenticationCallback() {
@Override
+ public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) {
+ super.onAuthenticationSucceeded(result);
+ createPreferences();
+ }
+
+ @Override
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
activity.onBackPressed();
}