Added option to disable list caching

pull/215/head
M66B 6 months ago
parent 7ae97bd05f
commit 9ee005281c

@ -184,6 +184,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SeekBar sbSqliteCache;
private ImageButton ibSqliteCache;
private SwitchCompat swLegacyQueries;
private SwitchCompat swCacheLists;
private SwitchCompat swOauthTabs;
private TextView tvStartDelay;
private SeekBar sbStartDelay;
@ -290,7 +291,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"emergency_file", "work_manager", "task_description", // "external_storage",
"sqlite_integrity_check", "wal", "sqlite_checkpoints", "sqlite_analyze", "sqlite_auto_vacuum", "sqlite_sync_extra", "sqlite_cache",
"legacy_queries",
"oauth_tabs",
"cache_lists", "oauth_tabs",
"start_delay", "chunk_size", "thread_range",
"autoscroll_editor", "undo_manager",
"browser_zoom", "fake_dark",
@ -442,6 +443,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
sbSqliteCache = view.findViewById(R.id.sbSqliteCache);
ibSqliteCache = view.findViewById(R.id.ibSqliteCache);
swLegacyQueries = view.findViewById(R.id.swLegacyQueries);
swCacheLists = view.findViewById(R.id.swCacheLists);
swOauthTabs = view.findViewById(R.id.swOauthTabs);
tvStartDelay = view.findViewById(R.id.tvStartDelay);
sbStartDelay = view.findViewById(R.id.sbStartDelay);
@ -1288,6 +1290,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swCacheLists.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton v, boolean checked) {
prefs.edit().putBoolean("cache_lists", checked).apply();
}
});
swOauthTabs.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton v, boolean checked) {
@ -2431,7 +2440,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
sbSqliteCache.setProgress(sqlite_cache);
swLegacyQueries.setChecked(prefs.getBoolean("legacy_queries", false));
swCacheLists.setChecked(prefs.getBoolean("cache_lists", true));
swOauthTabs.setChecked(prefs.getBoolean("oauth_tabs", true));
int start_delay = prefs.getInt("start_delay", 0);

@ -90,6 +90,10 @@ public class ViewModelMessages extends ViewModel {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean legacy = prefs.getBoolean("legacy_queries", false);
boolean cache_lists = prefs.getBoolean("cache_lists", true);
if (!cache_lists)
models.clear();
Args args = new Args(context,
viewType, type, account, folder,
@ -303,6 +307,8 @@ public class ViewModelMessages extends ViewModel {
Log.i("Last model=" + last);
}
Helper.gc("model:get");
Log.i("Returning model=" + viewType);
dump();

@ -1186,6 +1186,17 @@
app:layout_constraintTop_toBottomOf="@id/tvSqliteCacheHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCacheLists"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_cache_lists"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swLegacyQueries"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swOauthTabs"
android:layout_width="0dp"
@ -1194,7 +1205,7 @@
android:text="@string/title_advanced_oauth_tabs"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swLegacyQueries"
app:layout_constraintTop_toBottomOf="@id/swCacheLists"
app:switchPadding="12dp" />
<TextView

@ -945,6 +945,7 @@
<string name="title_advanced_sync_extra" translatable="false">sqlite sync extra</string>
<string name="title_advanced_sqlite_cache" translatable="false">sqlite cache: %1$s %% - %2$s</string>
<string name="title_advanced_legacy_queries" translatable="false">Legacy queries</string>
<string name="title_advanced_cache_lists" translatable="false">Cache lists</string>
<string name="title_advanced_oauth_tabs" translatable="false">OAuth tabs</string>
<string name="title_advanced_start_delay" translatable="false">Start delay: %1$d s</string>
<string name="title_advanced_chunk_size" translatable="false">Chunk size: %1$d</string>

Loading…
Cancel
Save