clarify that changing layout is only possible if "use system languages" is disabled

This commit is contained in:
Helium314 2024-02-20 11:05:34 +01:00
parent 5e4361b119
commit 6c6799e97e
2 changed files with 13 additions and 8 deletions

View file

@ -23,7 +23,7 @@ Does not use internet permission, and thus is 100% offline.
* Customize keyboard themes (style, colors and background image) * Customize keyboard themes (style, colors and background image)
* can follow the system's day/night setting on Android 10+ (and on some versions of Android 9) * can follow the system's day/night setting on Android 10+ (and on some versions of Android 9)
* can follow dynamic colors for Android 12+ * can follow dynamic colors for Android 12+
* Customize keyboard [layouts](layouts.md) * Customize keyboard [layouts](layouts.md) (only when disabling _use system languages_)
* Multilingual typing * Multilingual typing
* Glide typing (_only with closed source library_) * Glide typing (_only with closed source library_)
* library not included in the app, as there is no compatible open source library available * library not included in the app, as there is no compatible open source library available
@ -39,6 +39,7 @@ Does not use internet permission, and thus is 100% offline.
## FAQ / Common Issues ## FAQ / Common Issues
* __Add a dictionary__: First download the dictionary file, e.g. from [here](https://codeberg.org/Helium314/aosp-dictionaries#dictionaries). Then go to language settings, click on the language, then on `+` next to _dictionary_ the _add_ and select the file. Alternatively you can open a `.dict` file in a file explorer with HeliBoard and then select the language. Note that the latter method does not work with all file explorers. * __Add a dictionary__: First download the dictionary file, e.g. from [here](https://codeberg.org/Helium314/aosp-dictionaries#dictionaries). Then go to language settings, click on the language, then on `+` next to _dictionary_ the _add_ and select the file. Alternatively you can open a `.dict` file in a file explorer with HeliBoard and then select the language. Note that the latter method does not work with all file explorers.
* __Emoji search__: You can get addon dictionaries for emoji suggestions in the [dictionaries repo](https://codeberg.org/Helium314/aosp-dictionaries). An actual search function does not exist yet. * __Emoji search__: You can get addon dictionaries for emoji suggestions in the [dictionaries repo](https://codeberg.org/Helium314/aosp-dictionaries). An actual search function does not exist yet.
* __Cannot switch choose layout__: This is only possible when _use system languages_ is disabled.
* __No suggestions for some language__: Check [dictionaries repo](https://codeberg.org/Helium314/aosp-dictionaries) whether a dictionary is available. If there is one, download it and add it in the language settings for this language. * __No suggestions for some language__: Check [dictionaries repo](https://codeberg.org/Helium314/aosp-dictionaries) whether a dictionary is available. If there is one, download it and add it in the language settings for this language.
* __No suggestions in some app / text field__: This app respects the [no suggestions flag](https://developer.android.com/reference/android/text/InputType#TYPE_TEXT_FLAG_NO_SUGGESTIONS) set by some input fields, i.e. the developer does not want you to see suggestions here. Best do in issue report for that app if you think this behavior is wrong. Alternatively you can enable the _always show suggestions_ setting that overrides the _no suggestions_ flag. * __No suggestions in some app / text field__: This app respects the [no suggestions flag](https://developer.android.com/reference/android/text/InputType#TYPE_TEXT_FLAG_NO_SUGGESTIONS) set by some input fields, i.e. the developer does not want you to see suggestions here. Best do in issue report for that app if you think this behavior is wrong. Alternatively you can enable the _always show suggestions_ setting that overrides the _no suggestions_ flag.
* __How to enable glide typing__: There is no glide typing built into this app, but you can load compatible libraries: Go to advanced settings -> _load gesture typing library_ and point to a file (setting not available in _nouserlib_ version). You can extract the file from GApps packages ("_swypelibs_"), or download one [here](https://github.com/erkserkserks/openboard/tree/master/app/src/main/jniLibs). Make sure to use the correct version (app will tell you in the dialog to load the library). * __How to enable glide typing__: There is no glide typing built into this app, but you can load compatible libraries: Go to advanced settings -> _load gesture typing library_ and point to a file (setting not available in _nouserlib_ version). You can extract the file from GApps packages ("_swypelibs_"), or download one [here](https://github.com/erkserkserks/openboard/tree/master/app/src/main/jniLibs). Make sure to use the correct version (app will tell you in the dialog to load the library).

View file

@ -39,7 +39,7 @@ class LanguageSettingsDialog(
private val onlySystemLocales: Boolean, private val onlySystemLocales: Boolean,
private val reloadSetting: () -> Unit private val reloadSetting: () -> Unit
) : AlertDialog(context), LanguageSettingsFragment.Listener { ) : AlertDialog(context), LanguageSettingsFragment.Listener {
private val prefs = DeviceProtectedUtils.getSharedPreferences(context)!! private val prefs = DeviceProtectedUtils.getSharedPreferences(context)
private val binding = LocaleSettingsDialogBinding.inflate(LayoutInflater.from(context)) private val binding = LocaleSettingsDialogBinding.inflate(LayoutInflater.from(context))
private val mainLocale = infos.first().subtype.locale() private val mainLocale = infos.first().subtype.locale()
private var hasInternalDictForLanguage = false private var hasInternalDictForLanguage = false
@ -53,6 +53,10 @@ class LanguageSettingsDialog(
} }
if (onlySystemLocales) if (onlySystemLocales)
// don't allow setting subtypes, because
// a. subtypes are set purely based on system locales (in SubtypeSettings)
// b. extra handling needed if user disables all subtypes for a locale
// todo (later): fix above and allow it
binding.subtypes.isGone = true binding.subtypes.isGone = true
else else
fillSubtypesView() fillSubtypesView()
@ -147,7 +151,7 @@ class LanguageSettingsDialog(
.setTitle(R.string.keyboard_layout_set) .setTitle(R.string.keyboard_layout_set)
.setItems(displayNames.toTypedArray()) { di, i -> .setItems(displayNames.toTypedArray()) { di, i ->
di.dismiss() di.dismiss()
val fileName = context.assets.list("layouts")!!.firstOrNull { it.startsWith(layouts[i]) } ?: return@setItems val fileName = context.assets.list("layouts")?.firstOrNull { it.startsWith(layouts[i]) } ?: return@setItems
loadCustomLayout(context.assets.open("layouts${File.separator}$fileName").reader().readText(), loadCustomLayout(context.assets.open("layouts${File.separator}$fileName").reader().readText(),
displayNames[i], mainLocale.toLanguageTag(), context) { addSubtype(it) } displayNames[i], mainLocale.toLanguageTag(), context) { addSubtype(it) }
} }
@ -161,11 +165,11 @@ class LanguageSettingsDialog(
private fun addSubtypeToView(subtype: SubtypeInfo) { private fun addSubtypeToView(subtype: SubtypeInfo) {
val row = LayoutInflater.from(context).inflate(R.layout.language_list_item, listView) val row = LayoutInflater.from(context).inflate(R.layout.language_list_item, listView)
val layoutSetName: String? = subtype.subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET) val layoutSetName = subtype.subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET) ?: "qwerty"
row.findViewById<TextView>(R.id.language_name).text = row.findViewById<TextView>(R.id.language_name).text =
SubtypeLocaleUtils.getKeyboardLayoutSetDisplayName(subtype.subtype) SubtypeLocaleUtils.getKeyboardLayoutSetDisplayName(subtype.subtype)
?: SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype.subtype) ?: SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype.subtype)
if (layoutSetName?.startsWith(CUSTOM_LAYOUT_PREFIX) == true) { if (layoutSetName.startsWith(CUSTOM_LAYOUT_PREFIX)) {
row.findViewById<TextView>(R.id.language_details).setText(R.string.edit_layout) row.findViewById<TextView>(R.id.language_details).setText(R.string.edit_layout)
row.findViewById<View>(R.id.language_text).setOnClickListener { editCustomLayout(layoutSetName, context) } row.findViewById<View>(R.id.language_text).setOnClickListener { editCustomLayout(layoutSetName, context) }
} else { } else {
@ -191,18 +195,18 @@ class LanguageSettingsDialog(
row.findViewById<ImageView>(R.id.delete_button).apply { row.findViewById<ImageView>(R.id.delete_button).apply {
isVisible = true isVisible = true
setOnClickListener { setOnClickListener {
val isCustom = layoutSetName?.startsWith(CUSTOM_LAYOUT_PREFIX) == true val isCustom = layoutSetName.startsWith(CUSTOM_LAYOUT_PREFIX)
fun delete() { fun delete() {
binding.subtypes.removeView(row) binding.subtypes.removeView(row)
infos.remove(subtype) infos.remove(subtype)
if (isCustom) if (isCustom)
removeCustomLayoutFile(layoutSetName!!, context) removeCustomLayoutFile(layoutSetName, context)
removeAdditionalSubtype(prefs, context.resources, subtype.subtype) removeAdditionalSubtype(prefs, context.resources, subtype.subtype)
removeEnabledSubtype(prefs, subtype.subtype) removeEnabledSubtype(prefs, subtype.subtype)
reloadSetting() reloadSetting()
} }
if (isCustom) { if (isCustom) {
confirmDialog(context, context.getString(R.string.delete_layout, getLayoutDisplayName(layoutSetName!!)), context.getString(R.string.delete)) { delete() } confirmDialog(context, context.getString(R.string.delete_layout, getLayoutDisplayName(layoutSetName)), context.getString(R.string.delete)) { delete() }
} else { } else {
delete() delete()
} }