add another option to the "more letters with diacritics" settings

with letters that used to be default in many languages
now this setting is default
This commit is contained in:
Helium314 2024-07-12 20:55:38 +02:00
parent d7d47670a7
commit 5378d8d0a3
9 changed files with 14 additions and 15 deletions

View file

@ -1,9 +0,0 @@
[popup_keys]
a à á â ä æ ã å ā
e é è ê ë ē
i í î ï ī ì
o ó ô ö ò œ ø ō õ
u ú û ü ù ū
s ß
n ñ
c ç

View file

@ -239,9 +239,11 @@ fun addLocaleKeyTextsToParams(context: Context, params: KeyboardParams, popupKey
private fun createLocaleKeyTexts(context: Context, params: KeyboardParams, popupKeysSetting: Int): LocaleKeyboardInfos { private fun createLocaleKeyTexts(context: Context, params: KeyboardParams, popupKeysSetting: Int): LocaleKeyboardInfos {
val lkt = LocaleKeyboardInfos(getStreamForLocale(params.mId.locale, context), params.mId.locale) val lkt = LocaleKeyboardInfos(getStreamForLocale(params.mId.locale, context), params.mId.locale)
if (popupKeysSetting == POPUP_KEYS_MORE) if (popupKeysSetting == POPUP_KEYS_MORE)
lkt.addFile(context.assets.open("$LOCALE_TEXTS_FOLDER/all_popup_keys.txt")) lkt.addFile(context.assets.open("$LOCALE_TEXTS_FOLDER/more_popups_more.txt"))
else if (popupKeysSetting == POPUP_KEYS_ALL) else if (popupKeysSetting == POPUP_KEYS_ALL)
lkt.addFile(context.assets.open("$LOCALE_TEXTS_FOLDER/more_popup_keys.txt")) lkt.addFile(context.assets.open("$LOCALE_TEXTS_FOLDER/more_popups_all.txt"))
else if (popupKeysSetting == POPUP_KEYS_MAIN)
lkt.addFile(context.assets.open("$LOCALE_TEXTS_FOLDER/more_popups_main.txt"))
params.mSecondaryLocales.forEach { locale -> params.mSecondaryLocales.forEach { locale ->
if (locale == params.mId.locale) return@forEach if (locale == params.mId.locale) return@forEach
lkt.addFile(getStreamForLocale(locale, context)) lkt.addFile(getStreamForLocale(locale, context))
@ -339,6 +341,7 @@ private val euroLocales = "bg|ca|cs|da|de|el|en|es|et|eu|fi|fr|ga|gl|hr|hu|it|lb
const val POPUP_KEYS_ALL = 2 const val POPUP_KEYS_ALL = 2
const val POPUP_KEYS_MORE = 1 const val POPUP_KEYS_MORE = 1
const val POPUP_KEYS_MAIN = 3
const val POPUP_KEYS_NORMAL = 0 const val POPUP_KEYS_NORMAL = 0
private const val LOCALE_TEXTS_FOLDER = "locale_key_texts" private const val LOCALE_TEXTS_FOLDER = "locale_key_texts"

View file

@ -507,10 +507,11 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
} }
public static int readMorePopupKeysPref(final SharedPreferences prefs) { public static int readMorePopupKeysPref(final SharedPreferences prefs) {
return switch (prefs.getString(Settings.PREF_MORE_POPUP_KEYS, "normal")) { return switch (prefs.getString(Settings.PREF_MORE_POPUP_KEYS, "main")) {
case "all" -> LocaleKeyboardInfosKt.POPUP_KEYS_ALL; case "all" -> LocaleKeyboardInfosKt.POPUP_KEYS_ALL;
case "more" -> LocaleKeyboardInfosKt.POPUP_KEYS_MORE; case "more" -> LocaleKeyboardInfosKt.POPUP_KEYS_MORE;
default -> LocaleKeyboardInfosKt.POPUP_KEYS_NORMAL; case "normal" -> LocaleKeyboardInfosKt.POPUP_KEYS_NORMAL;
default -> LocaleKeyboardInfosKt.POPUP_KEYS_MAIN;
}; };
} }

View file

@ -99,11 +99,13 @@
</string-array> </string-array>
<string-array name="show_popup_keys_values"> <string-array name="show_popup_keys_values">
<item>normal</item> <item>normal</item>
<item>main</item>
<item>more</item> <item>more</item>
<item>all</item> <item>all</item>
</string-array> </string-array>
<string-array name="show_popup_keys_entries"> <string-array name="show_popup_keys_entries">
<item>@string/show_popup_keys_normal</item> <item>@string/show_popup_keys_normal</item>
<item>@string/show_popup_keys_main</item>
<item>@string/show_popup_keys_more</item> <item>@string/show_popup_keys_more</item>
<item>@string/show_popup_keys_all</item> <item>@string/show_popup_keys_all</item>
</string-array> </string-array>

View file

@ -200,7 +200,9 @@
<!-- Preferences item for showing popup keys in long-press popup --> <!-- Preferences item for showing popup keys in long-press popup -->
<string name="show_popup_keys_title">Show more letters with diacritics in popup</string> <string name="show_popup_keys_title">Show more letters with diacritics in popup</string>
<!-- Option for showing only letters defined in the current language file in long-press popup --> <!-- Option for showing only letters defined in the current language file in long-press popup -->
<string name="show_popup_keys_normal">Show variants defined in keyboard languages (default)</string> <string name="show_popup_keys_normal">Show variants defined in keyboard languages</string>
<!-- Option for showing letters common in foreign word (previous default in many language files) -->
<string name="show_popup_keys_main">Add very common variants (default)</string>
<!-- Option for showing letters defined in at least two locales --> <!-- Option for showing letters defined in at least two locales -->
<string name="show_popup_keys_more">Add common variants</string> <string name="show_popup_keys_more">Add common variants</string>
<!-- Option for showing letters defined in any locale --> <!-- Option for showing letters defined in any locale -->

View file

@ -91,7 +91,7 @@
android:title="@string/show_popup_keys_title" android:title="@string/show_popup_keys_title"
android:entries="@array/show_popup_keys_entries" android:entries="@array/show_popup_keys_entries"
android:entryValues="@array/show_popup_keys_values" android:entryValues="@array/show_popup_keys_values"
android:defaultValue="normal" android:defaultValue="main"
android:summary="%s" android:summary="%s"
android:persistent="true" android:persistent="true"
latin:singleLineTitle="false" /> latin:singleLineTitle="false" />