Persist state of clipboard history checkbox
Some checks failed
Check layouts / Generated files (push) Has been cancelled
Check layouts / check_layout.output (push) Has been cancelled
Check translations / check-translations (push) Has been cancelled
Make Apk CI / Build-Apk (push) Has been cancelled

This commit is contained in:
Jules Aguillon 2024-12-06 00:10:05 +01:00
parent 91751afec8
commit dc922b0258
3 changed files with 8 additions and 3 deletions

View File

@ -11,6 +11,7 @@ final class ClipboardHistoryCheckBox extends CheckBox
public ClipboardHistoryCheckBox(Context ctx, AttributeSet attrs)
{
super(ctx, attrs);
setChecked(Config.globalConfig().clipboard_history_enabled);
setOnCheckedChangeListener(this);
}

View File

@ -30,11 +30,9 @@ public final class ClipboardHistoryService
public static void set_history_enabled(boolean e)
{
Config.globalConfig().set_clipboard_history_enabled(e);
if (_service == null)
return;
Config.globalPrefs().edit()
.putBoolean("clipboard_history_enabled", e)
.commit();
if (e)
_service.add_current_clip();
else

View File

@ -207,6 +207,12 @@ public final class Config
e.apply();
}
public void set_clipboard_history_enabled(boolean e)
{
clipboard_history_enabled = e;
_prefs.edit().putBoolean("clipboard_history_enabled", e).commit();
}
KeyValue action_key()
{
// Update the name to avoid caching in KeyModifier