mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-30 05:44:51 +02:00
Removed cache lists options
List caching is managed automatically
This commit is contained in:
@@ -51,17 +51,16 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
private SwitchCompat swAuthentication;
|
||||
private SwitchCompat swParanoid;
|
||||
private TextView tvParanoidHint;
|
||||
private SwitchCompat swCacheLists;
|
||||
private TextView tvCacheListsHint;
|
||||
private SwitchCompat swWatchdog;
|
||||
private SwitchCompat swUpdates;
|
||||
private SwitchCompat swCrashReports;
|
||||
private SwitchCompat swDebug;
|
||||
|
||||
private TextView tvMemoryClass;
|
||||
private TextView tvLastCleanup;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"badge", "subscriptions", "subscribed_only", "english", "authentication", "paranoid", "cache_lists", "watchdog", "updates", "crash_reports", "debug"
|
||||
"badge", "subscriptions", "subscribed_only", "english", "authentication", "paranoid", "watchdog", "updates", "crash_reports", "debug"
|
||||
};
|
||||
|
||||
private final static String[] RESET_QUESTIONS = new String[]{
|
||||
@@ -85,13 +84,12 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
swAuthentication = view.findViewById(R.id.swAuthentication);
|
||||
swParanoid = view.findViewById(R.id.swParanoid);
|
||||
tvParanoidHint = view.findViewById(R.id.tvParanoidHint);
|
||||
swCacheLists = view.findViewById(R.id.swCacheLists);
|
||||
tvCacheListsHint = view.findViewById(R.id.tvCacheListsHint);
|
||||
swWatchdog = view.findViewById(R.id.swWatchdog);
|
||||
swUpdates = view.findViewById(R.id.swUpdates);
|
||||
swCrashReports = view.findViewById(R.id.swCrashReports);
|
||||
swDebug = view.findViewById(R.id.swDebug);
|
||||
|
||||
tvMemoryClass = view.findViewById(R.id.tvMemoryClass);
|
||||
tvLastCleanup = view.findViewById(R.id.tvLastCleanup);
|
||||
|
||||
setOptions();
|
||||
@@ -158,13 +156,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
});
|
||||
}
|
||||
|
||||
swCacheLists.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("cache_lists", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swWatchdog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
@@ -256,7 +247,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
swEnglish.setChecked(prefs.getBoolean("english", false));
|
||||
swAuthentication.setChecked(prefs.getBoolean("authentication", false));
|
||||
swParanoid.setChecked(prefs.getBoolean("paranoid", true));
|
||||
swCacheLists.setChecked(prefs.getBoolean("cache_lists", true));
|
||||
swWatchdog.setChecked(prefs.getBoolean("watchdog", true));
|
||||
swUpdates.setChecked(prefs.getBoolean("updates", true));
|
||||
swUpdates.setVisibility(Helper.isPlayStoreInstall(getContext()) ? View.GONE : View.VISIBLE);
|
||||
@@ -265,8 +255,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
|
||||
ActivityManager am = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
|
||||
int class_mb = am.getMemoryClass();
|
||||
|
||||
tvCacheListsHint.setText(getString(R.string.title_advanced_cache_list_hint, class_mb + " MB"));
|
||||
tvMemoryClass.setText(getString(R.string.title_advanced_memory_class, class_mb + " MB"));
|
||||
}
|
||||
|
||||
private void setLastCleanup(long time) {
|
||||
|
||||
@@ -159,14 +159,11 @@ public class ViewModelMessages extends ViewModel {
|
||||
owner.getLifecycle().addObserver(new LifecycleObserver() {
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
||||
public void onDestroyed() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean cache = prefs.getBoolean("cache_lists", true);
|
||||
|
||||
int free_mb = Log.getFreeMemMb();
|
||||
boolean lowmem = (free_mb < LOW_MEM_MB);
|
||||
|
||||
Log.i("Destroy model=" + viewType +
|
||||
" cache=" + cache + " lowmem=" + lowmem + " free=" + free_mb + " MB");
|
||||
" lowmem=" + lowmem + " free=" + free_mb + " MB");
|
||||
|
||||
Model model = models.get(viewType);
|
||||
if (model != null) {
|
||||
@@ -174,7 +171,7 @@ public class ViewModelMessages extends ViewModel {
|
||||
model.list.removeObservers(owner);
|
||||
}
|
||||
|
||||
if (viewType == AdapterMessage.ViewType.THREAD || !cache || lowmem) {
|
||||
if (viewType == AdapterMessage.ViewType.THREAD || lowmem) {
|
||||
Log.i("Remove model=" + viewType);
|
||||
remove(viewType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user