Added auto optimize setting

This commit is contained in:
M66B
2020-02-22 17:13:14 +01:00
parent d0032d2d5d
commit 341701ff3f
4 changed files with 29 additions and 2 deletions

View File

@@ -55,6 +55,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private TextView tvFtsPro;
private SwitchCompat swEnglish;
private SwitchCompat swWatchdog;
private SwitchCompat swOptimize;
private SwitchCompat swUpdates;
private SwitchCompat swExperiments;
private TextView tvExperimentsHint;
@@ -73,7 +74,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private Group grpDebug;
private final static String[] RESET_OPTIONS = new String[]{
"fts", "english", "watchdog", "updates", "experiments", "crash_reports", "debug"
"fts", "english", "watchdog", "auto_optimize", "updates", "experiments", "crash_reports", "debug"
};
private final static String[] RESET_QUESTIONS = new String[]{
@@ -99,6 +100,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvFtsPro = view.findViewById(R.id.tvFtsPro);
swEnglish = view.findViewById(R.id.swEnglish);
swWatchdog = view.findViewById(R.id.swWatchdog);
swOptimize = view.findViewById(R.id.swOptimize);
swUpdates = view.findViewById(R.id.swUpdates);
swExperiments = view.findViewById(R.id.swExperiments);
tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint);
@@ -185,6 +187,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swOptimize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("auto_optimize", checked).apply();
}
});
swUpdates.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -360,6 +369,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swFts.setChecked(prefs.getBoolean("fts", false));
swEnglish.setChecked(prefs.getBoolean("english", false));
swWatchdog.setChecked(prefs.getBoolean("watchdog", true));
swOptimize.setChecked(prefs.getBoolean("auto_optimize", true));
swUpdates.setChecked(prefs.getBoolean("updates", true));
swUpdates.setVisibility(
Helper.isPlayStoreInstall() || !Helper.hasValidFingerprint(getContext())