mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-31 11:52:13 +00:00
move toolbar preferences to a separate fragment
with 2 more settings coming soon this is probably justified
This commit is contained in:
parent
388366c242
commit
f8a2e2adcc
8 changed files with 127 additions and 48 deletions
|
@ -24,7 +24,6 @@ import helium314.keyboard.latin.utils.DialogUtilsKt;
|
|||
import helium314.keyboard.latin.utils.PopupKeysUtilsKt;
|
||||
import helium314.keyboard.latin.utils.SubtypeSettingsKt;
|
||||
import helium314.keyboard.latin.utils.SubtypeUtilsKt;
|
||||
import helium314.keyboard.latin.utils.ToolbarUtilsKt;
|
||||
|
||||
import kotlin.collections.ArraysKt;
|
||||
|
||||
|
@ -37,7 +36,6 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
|||
super.onCreate(icicle);
|
||||
addPreferencesFromResource(R.xml.prefs_screen_preferences);
|
||||
|
||||
final Resources res = getResources();
|
||||
final Context context = getActivity();
|
||||
|
||||
// When we are called from the Settings application but we are not already running, some
|
||||
|
@ -66,21 +64,6 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
|||
PopupKeysUtilsKt.POPUP_KEYS_LABEL_DEFAULT, R.string.hint_source, (x) -> null);
|
||||
return true;
|
||||
});
|
||||
findPreference(Settings.PREF_TOOLBAR_KEYS).setOnPreferenceClickListener((pref) -> {
|
||||
DialogUtilsKt.reorderDialog(requireContext(), Settings.PREF_TOOLBAR_KEYS, ToolbarUtilsKt.getDefaultToolbarPref(),
|
||||
R.string.toolbar_keys, (name) -> ToolbarUtilsKt.getToolbarIconByName(name, requireContext()));
|
||||
return true;
|
||||
});
|
||||
findPreference(Settings.PREF_PINNED_TOOLBAR_KEYS).setOnPreferenceClickListener((pref) -> {
|
||||
DialogUtilsKt.reorderDialog(requireContext(), Settings.PREF_PINNED_TOOLBAR_KEYS, ToolbarUtilsKt.getDefaultPinnedToolbarPref(),
|
||||
R.string.pinned_toolbar_keys, (name) -> ToolbarUtilsKt.getToolbarIconByName(name, requireContext()));
|
||||
return true;
|
||||
});
|
||||
findPreference(Settings.PREF_CLIPBOARD_TOOLBAR_KEYS).setOnPreferenceClickListener((pref) -> {
|
||||
DialogUtilsKt.reorderDialog(requireContext(), Settings.PREF_CLIPBOARD_TOOLBAR_KEYS, ToolbarUtilsKt.getDefaultClipboardToolbarPref(),
|
||||
R.string.clipboard_toolbar_keys, (name) -> ToolbarUtilsKt.getToolbarIconByName(name, requireContext()));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,9 +77,7 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
|||
if (key == null) return;
|
||||
switch (key) {
|
||||
case Settings.PREF_POPUP_KEYS_ORDER, Settings.PREF_SHOW_POPUP_HINTS, Settings.PREF_SHOW_NUMBER_ROW,
|
||||
Settings.PREF_POPUP_KEYS_LABELS_ORDER, Settings.PREF_TOOLBAR_KEYS, Settings.PREF_CLIPBOARD_TOOLBAR_KEYS,
|
||||
Settings.PREF_PINNED_TOOLBAR_KEYS, Settings.PREF_QUICK_PIN_TOOLBAR_KEYS
|
||||
-> mReloadKeyboard = true;
|
||||
Settings.PREF_POPUP_KEYS_LABELS_ORDER -> mReloadKeyboard = true;
|
||||
case Settings.PREF_LOCALIZED_NUMBER_ROW -> KeyboardLayoutSet.onSystemLocaleChanged();
|
||||
case Settings.PREF_SHOW_HINTS
|
||||
-> findPreference(Settings.PREF_POPUP_KEYS_LABELS_ORDER).setVisible(prefs.getBoolean(Settings.PREF_SHOW_HINTS, false));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue