fix issues with some hint labels

This commit is contained in:
Helium314 2023-11-30 11:25:45 +01:00
parent 99cf72684d
commit 006ba16f60
3 changed files with 9 additions and 10 deletions

View file

@ -1232,11 +1232,10 @@ public class Key implements Comparable<Key> {
if (hintLabelAlwaysFromFirstLongPressKey) {
hintLabel = mMoreKeys == null ? null : mMoreKeys[0].mLabel;
} else {
hintLabel = layoutMoreKeys == null ? null : layoutMoreKeys[0]; // note that some entries may have been changed to other string or null
hintLabel = layoutMoreKeys == null ? null : KeySpecParser.getLabel(layoutMoreKeys[0]); // note that some entries may have been changed to other string or null
// todo: this should be adjusted when re-working moreKey stuff... also KeySpecParser.getLabel may throw, which is bad when users do uncommon things
if (hintLabel != null && hintLabel.length() > 1 && hintLabel.startsWith("!")) // this is not great, but other than removing com key label this is definitely ok
hintLabel = null;
if (hintLabel != null && hintLabel.length() == 2 && hintLabel.startsWith("\\"))
hintLabel = hintLabel.replace("\\", "");
}
mHintLabel = needsToUpcase
? StringUtils.toTitleCaseOfKeyLabel(hintLabel, localeForUpcasing)

View file

@ -64,19 +64,20 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
// todo: further plan
// migrate other languages/layouts to this style
// integrated number rows should be removed / ignored when migrating
// integrated number rows should be removed / ignored when migrating, row will be added differently
// test the zwnj key
// test whether the layouts really are the same (screenshots for everything added, compare old and new parser)
// check all the keyboard_layout_set and kbd_files for things like touchPositionCorrectionData
// some keyboard_layout_set have supportedScript that is enum synced with script id in ScriptUtils
// that's one more reason for using language tags...
// some keyboard_layout_set have supportedScript that is enum synced with script id in ScriptUtils
// that's one more reason for using language tags...
// but currently it's still read from xml outside the keyboard parser, so that's fine for now
// issues:
// armenian bottom row: functional keys should be narrower
// rtl parentheses hint label (urdu and more)
// urdu and others: no labels because the moreKeys are languageMoreKeys -> need the moreKeys setting soon (at least setting to show first language moreKey if no symbol)
// setting: symbol morekeys(s): layout default, take from symbols, layout default but fill from symbols if empty
// setting: symbol morekey(s): layout default, take from symbols, layout default but fill from symbols if empty
// setting: hint label: from symbol morekey only, symbol but language if none, first choice on long press
// (later): setting which moreKeys to prefer (default: symbol or important language, always symbol, always language)
// (later): setting whether to show duplicate moreKeys (describe properly what it actually does)
// and have some setting to enable configuring this per locale (in language settings -> potentially should not be a dialog any more but a fragment?)
// migrate pcqwerty to this style
// this will be more complicated...

View file

@ -605,7 +605,6 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
params.mId.mElementId == KeyboardId.ELEMENT_ALPHABET
else -> true
}
// this is weird...
val allowRedundantMoreKeys = name != "nordic" && name != "serbian_qwertz"
// essentially this is default for 4 row and non-alphabet layouts, maybe this could be determined automatically instead of using a list
// todo: check the difference between default (i.e. none) and holo (test behavior on keyboard)
@ -630,7 +629,7 @@ data class LayoutInfos(
// disabled by default, but enabled for all alphabet layouts
// currently set in keyboardLayoutSet
val enableProximityCharsCorrection: Boolean = false,
val allowRedundantMoreKeys: Boolean = true, // only false for nordic and serbian_qwertz, could add a setting when doing the moreKeys customizing
val allowRedundantMoreKeys: Boolean = true, // only false for nordic and serbian_qwertz
// there is holo, default and null
// null only for moreKeys keyboard
// currently read as part of readAttributes, and thus wrong with the new parser