mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-21 14:49: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 ٕ|ٕ ٔ|ٔ ْ|ْ ٍ|ٍ ٌ|ٌ ً|ً ّ|ّ ٖ|ٖ ٰ|ٰ ٓ|ٓ ِ|ِ ُ|ُ َ|َ ـــ|ـ
|
punctuation !fixedColumnOrder!7 ٕ|ٕ ٔ|ٔ ْ|ْ ٍ|ٍ ٌ|ٌ ً|ً ّ|ّ ٖ|ٖ ٰ|ٰ ٓ|ٓ ِ|ِ ُ|ُ َ|َ ـــ|ـ
|
||||||
|
« „ “ ”
|
||||||
|
» ‚ ‘ ’ ‹ ›
|
||||||
|
|
||||||
[labels]
|
[labels]
|
||||||
alphabet: أبج
|
alphabet: أبج
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
ک ك
|
ک ك
|
||||||
و ؤ
|
و ؤ
|
||||||
punctuation !fixedColumnOrder!7 ٕ|ٕ ْ|ْ ّ|ّ ٌ|ٌ ٍ|ٍ ً|ً ٔ|ٔ ٖ|ٖ ٰ|ٰ ٓ|ٓ ُ|ُ ِ|ِ َ|َ ـــ|ـ
|
punctuation !fixedColumnOrder!7 ٕ|ٕ ْ|ْ ّ|ّ ٌ|ٌ ٍ|ٍ ً|ً ٔ|ٔ ٖ|ٖ ٰ|ٰ ٓ|ٓ ُ|ُ ِ|ِ َ|َ ـــ|ـ
|
||||||
|
« „ “ ”
|
||||||
|
» ‚ ‘ ’ ‹ ›
|
||||||
|
|
||||||
[labels]
|
[labels]
|
||||||
alphabet: ابپ
|
alphabet: ابپ
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
ط ظ
|
ط ظ
|
||||||
ن ں
|
ن ں
|
||||||
punctuation ؟ ، ! . -
|
punctuation ؟ ، ! . -
|
||||||
|
« „ “ ”
|
||||||
|
» ‚ ‘ ’ ‹ ›
|
||||||
|
|
||||||
[labels]
|
[labels]
|
||||||
alphabet: ابپ
|
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())
|
if (params.mId.isNumberLayout())
|
||||||
actionFlags = ACTION_FLAGS_NO_KEY_PREVIEW;
|
actionFlags = ACTION_FLAGS_NO_KEY_PREVIEW;
|
||||||
|
|
||||||
final String[] moreKeys = MoreKeysUtilsKt.createMoreKeysArray(popupSet, mKeyboardParams, keySpec);
|
// label
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0) {
|
if ((mLabelFlags & LABEL_FLAGS_FROM_CUSTOM_ACTION_LABEL) != 0) {
|
||||||
mLabel = params.mId.mCustomActionLabel;
|
mLabel = params.mId.mCustomActionLabel;
|
||||||
} else if (code >= Character.MIN_SUPPLEMENTARY_CODE_POINT) {
|
} else if (code >= Character.MIN_SUPPLEMENTARY_CODE_POINT) {
|
||||||
|
@ -1112,6 +1099,22 @@ public class Key implements Comparable<Key> {
|
||||||
? StringUtils.toTitleCaseOfKeyLabel(label, localeForUpcasing)
|
? StringUtils.toTitleCaseOfKeyLabel(label, localeForUpcasing)
|
||||||
: label;
|
: 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) {
|
if ((mLabelFlags & LABEL_FLAGS_DISABLE_HINT_LABEL) != 0) {
|
||||||
mHintLabel = null;
|
mHintLabel = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1122,6 +1125,7 @@ public class Key implements Comparable<Key> {
|
||||||
? StringUtils.toTitleCaseOfKeyLabel(hintLabel, localeForUpcasing)
|
? StringUtils.toTitleCaseOfKeyLabel(hintLabel, localeForUpcasing)
|
||||||
: hintLabel;
|
: hintLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
String outputText = KeySpecParser.getOutputText(keySpec);
|
String outputText = KeySpecParser.getOutputText(keySpec);
|
||||||
if (needsToUpcase) {
|
if (needsToUpcase) {
|
||||||
outputText = StringUtils.toTitleCaseOfKeyLabel(outputText, localeForUpcasing);
|
outputText = StringUtils.toTitleCaseOfKeyLabel(outputText, localeForUpcasing);
|
||||||
|
@ -1179,11 +1183,6 @@ public class Key implements Comparable<Key> {
|
||||||
KeyboardIconsSet.ICON_UNDEFINED, 0, 0);
|
KeyboardIconsSet.ICON_UNDEFINED, 0, 0);
|
||||||
// KeyVisualAttributes for a key essentially are what the theme has, but on a per-key base
|
// 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
|
// 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;
|
mKeyVisualAttributes = null;
|
||||||
mEnabled = true;
|
mEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ class LocaleKeyTexts(dataStream: InputStream?, locale: Locale) {
|
||||||
Array(split.size - 1) { split[it + 1] }
|
Array(split.size - 1) { split[it + 1] }
|
||||||
else mergeMoreKeys(existingMoreKeys, split.drop(1))
|
else mergeMoreKeys(existingMoreKeys, split.drop(1))
|
||||||
moreKeys[key] = when (key) {
|
moreKeys[key] = when (key) {
|
||||||
"'", "\"", "«", "»", ")", "(" -> addFixedColumnOrder(newMoreKeys)
|
"'", "\"", "«", "»" -> addFixedColumnOrder(newMoreKeys)
|
||||||
else -> newMoreKeys
|
else -> newMoreKeys
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,6 @@ class AdvancedSettingsFragment : SubScreenFragment() {
|
||||||
findPreference<Preference>("load_gesture_library")?.setOnPreferenceClickListener { onClickLoadLibrary() }
|
findPreference<Preference>("load_gesture_library")?.setOnPreferenceClickListener { onClickLoadLibrary() }
|
||||||
findPreference<Preference>("pref_backup_restore")?.setOnPreferenceClickListener { showBackupRestoreDialog() }
|
findPreference<Preference>("pref_backup_restore")?.setOnPreferenceClickListener { showBackupRestoreDialog() }
|
||||||
|
|
||||||
// todo: this shows !fixedColumnOrder!, which is not a good idea
|
|
||||||
findPreference<Preference>("custom_symbols_layout")?.setOnPreferenceClickListener {
|
findPreference<Preference>("custom_symbols_layout")?.setOnPreferenceClickListener {
|
||||||
val file = "${CUSTOM_LAYOUT_PREFIX}symbols.txt"
|
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()
|
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.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.content.res.Configuration
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
@ -46,10 +45,20 @@ fun createMoreKeysArray(popupSet: PopupSet<*>?, params: KeyboardParams, label: S
|
||||||
}
|
}
|
||||||
if (!moreKeysDelegate.isInitialized() || moreKeys.isEmpty())
|
if (!moreKeysDelegate.isInitialized() || moreKeys.isEmpty())
|
||||||
return null
|
return null
|
||||||
|
Log.i("test", "moreKeys for $label: $moreKeys")
|
||||||
val fco = moreKeys.firstOrNull { it.startsWith(Key.MORE_KEYS_FIXED_COLUMN_ORDER) }
|
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) {
|
if (fco != null && fco.substringAfter(Key.MORE_KEYS_FIXED_COLUMN_ORDER).toIntOrNull() != moreKeys.size - 1) {
|
||||||
|
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?
|
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
|
// autoColumnOrder should be fine
|
||||||
|
|
||||||
val array = moreKeys.toTypedArray()
|
val array = moreKeys.toTypedArray()
|
||||||
|
|
Loading…
Add table
Reference in a new issue