Moved authentication setting to behavior

This commit is contained in:
M66B
2019-07-09 12:23:35 +02:00
parent ed0a57f707
commit 7f867220b0
6 changed files with 40 additions and 39 deletions

View File

@@ -45,11 +45,12 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swCollapse;
private SwitchCompat swAutoRead;
private SwitchCompat swAutoMove;
private SwitchCompat swAuthentication;
private SwitchCompat swDisableTracking;
private final static String[] RESET_OPTIONS = new String[]{
"pull", "autoscroll", "swipenav", "doubletap", "autoexpand", "autoclose", "autonext",
"collapse", "autoread", "automove", "disable_tracking"
"collapse", "autoread", "automove", "authentication", "disable_tracking"
};
@Override
@@ -72,6 +73,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swCollapse = view.findViewById(R.id.swCollapse);
swAutoRead = view.findViewById(R.id.swAutoRead);
swAutoMove = view.findViewById(R.id.swAutoMove);
swAuthentication = view.findViewById(R.id.swAuthentication);
swDisableTracking = view.findViewById(R.id.swDisableTracking);
setOptions();
@@ -151,6 +153,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swAuthentication.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("authentication", checked).apply();
}
});
swDisableTracking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -213,6 +222,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swCollapse.setChecked(prefs.getBoolean("collapse", false));
swAutoRead.setChecked(prefs.getBoolean("autoread", false));
swAutoMove.setChecked(!prefs.getBoolean("automove", false));
swAuthentication.setChecked(prefs.getBoolean("authentication", true));
swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true));
}
}

View File

@@ -50,7 +50,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private TextView tvSubscriptionPro;
private SwitchCompat swSubscribedOnly;
private SwitchCompat swEnglish;
private SwitchCompat swAuthentication;
private SwitchCompat swWatchdog;
private SwitchCompat swUpdates;
private SwitchCompat swCrashReports;
@@ -64,7 +63,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private Group grpDebug;
private final static String[] RESET_OPTIONS = new String[]{
"badge", "subscriptions", "subscribed_only", "english", "authentication", "watchdog", "updates", "crash_reports", "debug"
"badge", "subscriptions", "subscribed_only", "english", "watchdog", "updates", "crash_reports", "debug"
};
private final static String[] RESET_QUESTIONS = new String[]{
@@ -86,7 +85,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvSubscriptionPro = view.findViewById(R.id.tvSubscriptionPro);
swSubscribedOnly = view.findViewById(R.id.swSubscribedOnly);
swEnglish = view.findViewById(R.id.swEnglish);
swAuthentication = view.findViewById(R.id.swAuthentication);
swWatchdog = view.findViewById(R.id.swWatchdog);
swUpdates = view.findViewById(R.id.swUpdates);
swCrashReports = view.findViewById(R.id.swCrashReports);
@@ -138,13 +136,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swAuthentication.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("authentication", checked).apply();
}
});
swWatchdog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -243,7 +234,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swSubscribedOnly.setChecked(prefs.getBoolean("subscribed_only", false));
swEnglish.setChecked(prefs.getBoolean("english", false));
swAuthentication.setChecked(prefs.getBoolean("authentication", true));
swWatchdog.setChecked(prefs.getBoolean("watchdog", true));
swUpdates.setChecked(prefs.getBoolean("updates", true));
swUpdates.setVisibility(Helper.isPlayStoreInstall(getContext()) ? View.GONE : View.VISIBLE);