mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-22 07:09:10 +00:00
remove special labels from symbols layouts (except currency key)
This commit is contained in:
parent
14e54686b2
commit
f52c3e69e8
9 changed files with 42 additions and 29 deletions
|
@ -13,6 +13,8 @@
|
|||
ز ژ
|
||||
و ؤ
|
||||
punctuation !fixedColumnOrder!7 ٕ|ٕ ٔ|ٔ ْ|ْ ٍ|ٍ ٌ|ٌ ً|ً ّ|ّ ٖ|ٖ ٰ|ٰ ٓ|ٓ ِ|ِ ُ|ُ َ|َ ـــ|ـ
|
||||
« „ “ ”
|
||||
» ‚ ‘ ’ ‹ ›
|
||||
|
||||
[labels]
|
||||
alphabet: أبج
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
ک ك
|
||||
و ؤ
|
||||
punctuation !fixedColumnOrder!7 ٕ|ٕ ْ|ْ ّ|ّ ٌ|ٌ ٍ|ٍ ً|ً ٔ|ٔ ٖ|ٖ ٰ|ٰ ٓ|ٓ ُ|ُ ِ|ِ َ|َ ـــ|ـ
|
||||
« „ “ ”
|
||||
» ‚ ‘ ’ ‹ ›
|
||||
|
||||
[labels]
|
||||
alphabet: ابپ
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
ط ظ
|
||||
ن ں
|
||||
punctuation ؟ ، ! . -
|
||||
« „ “ ”
|
||||
» ‚ ‘ ’ ‹ ›
|
||||
|
||||
[labels]
|
||||
alphabet: ابپ
|
||||
|
|
|
@ -16,8 +16,8 @@ _ % ‰
|
|||
&
|
||||
- – — ·
|
||||
+ ±
|
||||
( !fixedColumnOrder!3 < { [
|
||||
) !fixedColumnOrder!3 > } ]
|
||||
( < { [
|
||||
) > } ]
|
||||
|
||||
* † ‡ ★
|
||||
"
|
||||
|
|
|
@ -16,12 +16,12 @@ _ ٪ % ‰
|
|||
&
|
||||
- – — ·
|
||||
+ ±
|
||||
( !fixedColumnOrder!4 ﴾ < { [
|
||||
) !fixedColumnOrder!4 ﴿ > } ]
|
||||
( ﴾ < { [
|
||||
) ﴿ > } ]
|
||||
|
||||
* ٭ ★ † ‡
|
||||
« !fixedColumnOrder!3 „ “ ”
|
||||
» !fixedColumnOrder!5 ‚ ‘ ’ ‹ ›
|
||||
«
|
||||
»
|
||||
:
|
||||
؛ ;
|
||||
!
|
||||
|
|
|
@ -1085,20 +1085,7 @@ public class Key implements Comparable<Key> {
|
|||
if (params.mId.isNumberLayout())
|
||||
actionFlags = ACTION_FLAGS_NO_KEY_PREVIEW;
|
||||
|
||||
final String[] moreKeys = MoreKeysUtilsKt.createMoreKeysArray(popupSet, mKeyboardParams, keySpec);
|
||||
mMoreKeysColumnAndFlags = getMoreKeysColumnAndFlagsAndSetNullInArray(params, moreKeys);
|
||||
final String[] finalMoreKeys = moreKeys == null ? null : MoreKeySpec.filterOutEmptyString(moreKeys);
|
||||
|
||||
if (finalMoreKeys != null) {
|
||||
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
|
||||
mMoreKeys = new MoreKeySpec[finalMoreKeys.length];
|
||||
for (int i = 0; i < finalMoreKeys.length; i++) {
|
||||
mMoreKeys[i] = new MoreKeySpec(finalMoreKeys[i], needsToUpcase, localeForUpcasing);
|
||||
}
|
||||
} else {
|
||||
mMoreKeys = null;
|
||||
}
|
||||
|
||||
// label
|
||||
if ((mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0) {
|
||||
mLabel = params.mId.mCustomActionLabel;
|
||||
} else if (code >= Character.MIN_SUPPLEMENTARY_CODE_POINT) {
|
||||
|
@ -1112,6 +1099,22 @@ public class Key implements Comparable<Key> {
|
|||
? StringUtils.toTitleCaseOfKeyLabel(label, localeForUpcasing)
|
||||
: label;
|
||||
}
|
||||
|
||||
// moreKeys
|
||||
final String[] moreKeys = MoreKeysUtilsKt.createMoreKeysArray(popupSet, mKeyboardParams, mLabel != null ? mLabel : keySpec);
|
||||
mMoreKeysColumnAndFlags = getMoreKeysColumnAndFlagsAndSetNullInArray(params, moreKeys);
|
||||
final String[] finalMoreKeys = moreKeys == null ? null : MoreKeySpec.filterOutEmptyString(moreKeys);
|
||||
if (finalMoreKeys != null) {
|
||||
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
|
||||
mMoreKeys = new MoreKeySpec[finalMoreKeys.length];
|
||||
for (int i = 0; i < finalMoreKeys.length; i++) {
|
||||
mMoreKeys[i] = new MoreKeySpec(finalMoreKeys[i], needsToUpcase, localeForUpcasing);
|
||||
}
|
||||
} else {
|
||||
mMoreKeys = null;
|
||||
}
|
||||
|
||||
// hint label
|
||||
if ((mLabelFlags & LABEL_FLAGS_DISABLE_HINT_LABEL) != 0) {
|
||||
mHintLabel = null;
|
||||
} else {
|
||||
|
@ -1122,6 +1125,7 @@ public class Key implements Comparable<Key> {
|
|||
? StringUtils.toTitleCaseOfKeyLabel(hintLabel, localeForUpcasing)
|
||||
: hintLabel;
|
||||
}
|
||||
|
||||
String outputText = KeySpecParser.getOutputText(keySpec);
|
||||
if (needsToUpcase) {
|
||||
outputText = StringUtils.toTitleCaseOfKeyLabel(outputText, localeForUpcasing);
|
||||
|
@ -1179,11 +1183,6 @@ public class Key implements Comparable<Key> {
|
|||
KeyboardIconsSet.ICON_UNDEFINED, 0, 0);
|
||||
// KeyVisualAttributes for a key essentially are what the theme has, but on a per-key base
|
||||
// could be used e.g. for having a color gradient on key color
|
||||
// where is it used / which attribute?
|
||||
// keyLetterSize in some keyboards
|
||||
// keyShiftedLetterHintRatio same
|
||||
// keyHintLabelVerticalAdjustment same
|
||||
// todo (later): make sure these keys look ok when migrating the non-latin layouts (+pc qwerty)
|
||||
mKeyVisualAttributes = null;
|
||||
mEnabled = true;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ class LocaleKeyTexts(dataStream: InputStream?, locale: Locale) {
|
|||
Array(split.size - 1) { split[it + 1] }
|
||||
else mergeMoreKeys(existingMoreKeys, split.drop(1))
|
||||
moreKeys[key] = when (key) {
|
||||
"'", "\"", "«", "»", ")", "(" -> addFixedColumnOrder(newMoreKeys)
|
||||
"'", "\"", "«", "»" -> addFixedColumnOrder(newMoreKeys)
|
||||
else -> newMoreKeys
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,6 @@ class AdvancedSettingsFragment : SubScreenFragment() {
|
|||
findPreference<Preference>("load_gesture_library")?.setOnPreferenceClickListener { onClickLoadLibrary() }
|
||||
findPreference<Preference>("pref_backup_restore")?.setOnPreferenceClickListener { showBackupRestoreDialog() }
|
||||
|
||||
// todo: this shows !fixedColumnOrder!, which is not a good idea
|
||||
findPreference<Preference>("custom_symbols_layout")?.setOnPreferenceClickListener {
|
||||
val file = "${CUSTOM_LAYOUT_PREFIX}symbols.txt"
|
||||
val oldLayout = if (File(file).exists()) null else context.assets.open("layouts${File.separator}symbols.txt").reader().readText()
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.dslul.openboard.inputmethod.latin.utils
|
|||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.content.res.Configuration
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
|
@ -46,9 +45,19 @@ fun createMoreKeysArray(popupSet: PopupSet<*>?, params: KeyboardParams, label: S
|
|||
}
|
||||
if (!moreKeysDelegate.isInitialized() || moreKeys.isEmpty())
|
||||
return null
|
||||
Log.i("test", "moreKeys for $label: $moreKeys")
|
||||
val fco = moreKeys.firstOrNull { it.startsWith(Key.MORE_KEYS_FIXED_COLUMN_ORDER) }
|
||||
if (fco != null && fco.substringAfter(Key.MORE_KEYS_FIXED_COLUMN_ORDER).toIntOrNull() != moreKeys.size - 1) {
|
||||
moreKeys.remove(fco) // maybe rather adjust the number instead of remove?
|
||||
val fcoExpected = moreKeys.size - moreKeys.count { it.startsWith("!") && it.endsWith("!") } - 1
|
||||
if (fco.substringAfter(Key.MORE_KEYS_FIXED_COLUMN_ORDER).toIntOrNull() != fcoExpected)
|
||||
moreKeys.remove(fco) // maybe rather adjust the number instead of remove?
|
||||
}
|
||||
if (moreKeys.size > 1 && (label == "(" || label == ")")) { // add fixed column order for that case (typically other variants of brackets / parentheses
|
||||
// not really fast, but no other way to add first in a LinkedHashSet
|
||||
val tmp = moreKeys.toList()
|
||||
moreKeys.clear()
|
||||
moreKeys.add("${Key.MORE_KEYS_FIXED_COLUMN_ORDER}${tmp.size}")
|
||||
moreKeys.addAll(tmp)
|
||||
}
|
||||
// autoColumnOrder should be fine
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue