allow overriding popup hint settings in locale settings

This commit is contained in:
Helium314 2023-12-27 17:38:19 +01:00
parent 7097fd8fae
commit c5c42bc5d7
4 changed files with 41 additions and 4 deletions

View file

@ -55,6 +55,7 @@ class LanguageSettingsDialog(
fillSubtypesView()
fillSecondaryLocaleView()
fillDictionariesView()
setupPopupSettings()
}
override fun onStart() {
@ -286,6 +287,19 @@ class LanguageSettingsDialog(
binding.dictionaries.addView(rowBinding.root)
}
private fun setupPopupSettings() {
binding.popupOrder.setOnClickListener {
val moreKeyTypesDefault = prefs.getString(Settings.PREF_MORE_KEYS_ORDER, MORE_KEYS_ORDER_DEFAULT)!!
reorderMoreKeysDialog(context, Settings.PREF_MORE_KEYS_ORDER + "_" + mainLocaleString, moreKeyTypesDefault, R.string.popup_order)
KeyboardLayoutSet.onKeyboardThemeChanged()
}
binding.popupLabelPriority.setOnClickListener {
val moreKeyTypesDefault = prefs.getString(Settings.PREF_MORE_KEYS_LABELS_ORDER, MORE_KEYS_LABEL_DEFAULT)!!
reorderMoreKeysDialog(context, Settings.PREF_MORE_KEYS_LABELS_ORDER + "_" + mainLocaleString, moreKeyTypesDefault, R.string.hint_source)
KeyboardLayoutSet.onKeyboardThemeChanged()
}
}
private fun reloadDictionaries() = fragment?.activity?.sendBroadcast(Intent(DictionaryPackConstants.NEW_DICTIONARY_INTENT_ACTION))
}

View file

@ -232,11 +232,14 @@ public class SettingsValues {
mShowMoreMoreKeys = selectedSubtype.isAsciiCapable()
? Settings.readMoreMoreKeysPref(prefs)
: LocaleKeyTextsKt.MORE_KEYS_NORMAL;
mMoreKeyTypes = MoreKeysUtilsKt.getEnabledMoreKeys(prefs, Settings.PREF_MORE_KEYS_ORDER, MoreKeysUtilsKt.MORE_KEYS_ORDER_DEFAULT);
// todo: if the type is disabled, the label should not occur too?
mMoreKeyLabelSources = MoreKeysUtilsKt.getEnabledMoreKeys(prefs, Settings.PREF_MORE_KEYS_LABELS_ORDER, MoreKeysUtilsKt.MORE_KEYS_LABEL_DEFAULT);
mColors = Settings.getColorsForCurrentTheme(context, prefs);
// read locale-specific popup key settings, fall back to global settings
final String moreKeyTypesDefault = prefs.getString(Settings.PREF_MORE_KEYS_ORDER, MoreKeysUtilsKt.MORE_KEYS_ORDER_DEFAULT);
mMoreKeyTypes = MoreKeysUtilsKt.getEnabledMoreKeys(prefs, Settings.PREF_MORE_KEYS_ORDER + "_" + selectedSubtype.getLocale(), moreKeyTypesDefault);
final String moreKeyLabelDefault = prefs.getString(Settings.PREF_MORE_KEYS_LABELS_ORDER, MoreKeysUtilsKt.MORE_KEYS_LABEL_DEFAULT);
mMoreKeyLabelSources = MoreKeysUtilsKt.getEnabledMoreKeys(prefs, Settings.PREF_MORE_KEYS_LABELS_ORDER + "_" + selectedSubtype.getLocale(), moreKeyLabelDefault);
mAddToPersonalDictionary = prefs.getBoolean(Settings.PREF_ADD_TO_PERSONAL_DICTIONARY, false);
mUseContactsDictionary = prefs.getBoolean(AndroidSpellCheckerService.PREF_USE_CONTACTS_KEY, false);
mCustomNavBarColor = prefs.getBoolean(Settings.PREF_NAVBAR_COLOR, false);

View file

@ -90,5 +90,25 @@
android:src="@drawable/ic_plus" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/popup_order"
style="@style/PreferenceCategoryTitleText"
android:text="@string/popup_order"
android:paddingVertical="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/popup_label_priority"
android:text="@string/hint_source"
android:paddingVertical="10dp"
style="@style/PreferenceCategoryTitleText"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>

View file

@ -238,7 +238,7 @@
<string name="hint_source">Select hint source</string>
<!-- Title of the settings to set popup key order -->
<string name="popup_order">Select popup key order</string>
<string name="more_keys_number">Number</string>
<string name="more_keys_number">Number row</string>
<string name="more_keys_language">Language</string>
<string name="more_keys_language_priority">Language (priority)</string>
<string name="more_keys_layout">Layout</string>