Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test-auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew testRunTestsUnitTest
run: ./gradlew compileOfflineRunTestsKotlin

- name: Archive reports for failed job
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/layouts/main/bengali_baishakhi.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ঁ", "labelFlags": 1073741824, "popup": { "relevant": [
{ "label": "!autoColumnOrder!6" },
{ "label": "!autoOrder!6" },
{ "label": "়" },
{ "label": "ৄ" },
{ "label": "ঽ" },
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/layouts/main/bengali_inscript.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ঁ", "labelFlags": 1073741824, "popup": { "relevant": [
{"label": "!autoColumnOrder!6" },
{"label": "!autoOrder!6" },
{ "label": "়" },
{ "label": "ৄ" },
{ "label": "ঽ" },
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/layouts/main/bengali_probhat.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ঁ", "popup": { "relevant": [
{ "label": "!autoColumnOrder!6"},
{ "label": "!autoOrder!6"},
{ "label": "়" },
{ "label": "ৄ"},
{ "label": "ঽ"},
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/layouts/main/bengali_unijoy.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ঁ", "labelFlags": 1073741824, "popup": { "relevant": [
{ "label": "!autoColumnOrder!6" },
{ "label": "!autoOrder!6" },
{ "label": "়" },
{ "label": "ৄ" },
{ "label": "ঽ" },
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/assets/layouts/more_symbols/symbols_shifted.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ $$$4
[
]

< !fixedColumnOrder!3 ‹ ≤ «
> !fixedColumnOrder!3 › ≥ »
< !fixedOrder!3 ‹ ≤ «
> !fixedOrder!3 › ≥ »
4 changes: 2 additions & 2 deletions app/src/main/assets/layouts/number/number.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"popup": {
"relevant": [
{
"label": "!fixedColumnOrder!2"
"label": "!fixedOrder!2"
},
{
"label": "!hasLabels!"
Expand All @@ -115,7 +115,7 @@
"popup": {
"relevant": [
{
"label": "!fixedColumnOrder!2"
"label": "!fixedOrder!2"
},
{
"label": "!hasLabels!"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/assets/locale_key_texts/ar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
ي ئ ى
ب پ
ل ﻻ|لا ﻷ|لأ ﻹ|لإ ﻵ|لآ
ا !fixedColumnOrder!5 آ ء أ إ ٱ
ا !fixedOrder!5 آ ء أ إ ٱ
ك گ ک
ى ئ
ز ژ
و ؤ
punctuation !fixedColumnOrder!7 ٕ|ٕ ٔ|ٔ ْ|ْ ٍ|ٍ ٌ|ٌ ً|ً ّ|ّ ٖ|ٖ ٰ|ٰ ٓ|ٓ ِ|ِ ُ|ُ َ|َ ـــ|ـ
punctuation !fixedOrder!7 ٕ|ٕ ٔ|ٔ ْ|ْ ٍ|ٍ ٌ|ٌ ً|ً ّ|ّ ٖ|ٖ ٰ|ٰ ٓ|ٓ ِ|ِ ُ|ُ َ|َ ـــ|ـ
« „ “ ”
» ‚ ‘ ’ ‹ ›

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/assets/locale_key_texts/bn-BD.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ী ঈ
া আ অ
্ ঁ
ঁ !autoColumnOrder!6 ় ৄ ঽ ৢ ৱ ৣ ৗ ৠ ৺ ঌ ৰ ৡ
ঁ !autoOrder!6 ় ৄ ঽ ৢ ৱ ৣ ৗ ৠ ৺ ঌ ৰ ৡ
ব ভ
ক খ
ত থ ৎ
Expand All @@ -30,7 +30,7 @@
ন ণ
স ষ
ম শ
punctuation !autoColumnOrder!8 \, ॥ ? ! !icon/zwnj_key|‌ !icon/zwj_key|‍ # @ ( ) / ; : - + \%
punctuation !autoOrder!8 \, ॥ ? ! !icon/zwnj_key|‌ !icon/zwj_key|‍ # @ ( ) / ; : - + \%

[labels]
alphabet: কখগ
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/assets/locale_key_texts/bn-IN.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
ট ঠ
ৃ ঋ
ং ঁ ঃ
ঁ !autoColumnOrder!6 ় ৄ ঽ ৢ ৱ ৣ ৗ ৠ ৺ ঌ ৰ ৡ
ঁ !autoOrder!6 ় ৄ ঽ ৢ ৱ ৣ ৗ ৠ ৺ ঌ ৰ ৡ
ম ণ
ন ঞ
ব ঢ়
ল ষ
স শ
য় য
punctuation !autoColumnOrder!8 \, ॥ ? ! !icon/zwnj_key|‌ !icon/zwj_key|‍ # @ ( ) / ; : - + \%
punctuation !autoOrder!8 \, ॥ ? ! !icon/zwnj_key|‌ !icon/zwj_key|‍ # @ ( ) / ; : - + \%

[labels]
alphabet: কখগ
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/locale_key_texts/ca.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ o ò ó
u ú ü
c ç
l l·l
punctuation !autoColumnOrder!9 \, ? ! · # ) ( / ; ' @ : - " + \% &
punctuation !autoOrder!9 \, ? ! · # ) ( / ; ' @ : - " + \% &

[extra_keys]
2: ç
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/locale_key_texts/ckb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
ز ظ
ع ؏
ب ى
punctuation !autoColumnOrder!8 \؟ ! ، ٫ ؍ : ؛ ; : | - @ _ # * ٪ & ^
punctuation !autoOrder!8 \؟ ! ، ٫ ؍ : ؛ ; : | - @ _ # * ٪ & ^
« „ “ ”
» ‚ ‘ ’ ‹ ›

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/locale_key_texts/es.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ o ó º
u ú ü
n ñ
y ý
punctuation !autoColumnOrder!9 \, ? ! # ) ( / ; ¡ ' @ : - " + \% & ¿
punctuation !autoOrder!9 \, ? ! # ) ( / ; ¡ ' @ : - " + \% & ¿

[extra_keys]
2: ñ
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/assets/locale_key_texts/fa.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[popup_keys]
ه ﻫ|ه‍ هٔ ة
ی ئ ي ﯨ|ى
ا !fixedColumnOrder!5 ٱ ء آ أ إ
ا !fixedOrder!5 ٱ ء آ أ إ
ت ة
ک ك
و ؤ
punctuation !fixedColumnOrder!7 ٕ|ٕ ْ|ْ ّ|ّ ٌ|ٌ ٍ|ٍ ً|ً ٔ|ٔ ٖ|ٖ ٰ|ٰ ٓ|ٓ ُ|ُ ِ|ِ َ|َ ـــ|ـ
punctuation !fixedOrder!7 ٕ|ٕ ْ|ْ ّ|ّ ٌ|ٌ ٍ|ٍ ً|ً ٔ|ٔ ٖ|ٖ ٰ|ٰ ٓ|ٓ ُ|ُ ِ|ِ َ|َ ـــ|ـ
« „ “ ”
» ‚ ‘ ’ ‹ ›

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/locale_key_texts/hi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
ल ऌ ॡ
य य़
़ ॽ ॰ ऽ
punctuation !autoColumnOrder!9 \, . ॥ ? ! !icon/zwnj_key|‌ !icon/zwj_key|‍ # @ ( ) / ; : - + \%
punctuation !autoOrder!9 \, . ॥ ? ! !icon/zwnj_key|‌ !icon/zwj_key|‍ # @ ( ) / ; : - + \%
औ ौ
ऐ ै
आ ा
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/locale_key_texts/hy.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[popup_keys]
punctuation !autoColumnOrder!8 \, ՞ ՜ ․ … ' = / ՝ ՛ ֊ » « ― ) (
punctuation !autoOrder!8 \, ՞ ՜ ․ … ' = / ՝ ՛ ֊ » « ― ) (
? ՞ ¿
! ՜ ¡

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/locale_key_texts/more_popups_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ g ğ ģ ġ g\' ĝ
c ç ć č ċ ĉ
z ž ź ż
l ł ĺ ļ ľ ŀ l·l
punctuation !autoColumnOrder!10 \, ? ! # ) ( / ; ' @ : - " + \% & · ¡ ¿
punctuation !autoOrder!10 \, ? ! # ) ( / ; ' @ : - " + \% & · ¡ ¿
d ď đ ð
r ř ŕ ŗ
t ť ţ þ ț ŧ
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/locale_key_texts/more_popups_more.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ g ğ ģ ġ
c ç ć č ċ
z ž ź ż
l ł ĺ ļ ľ ŀ
punctuation !autoColumnOrder!9 \, ? ! # ) ( / ; ' @ : - " + \% & ¡ ¿
punctuation !autoOrder!9 \, ? ! # ) ( / ; ' @ : - " + \% & ¡ ¿
d ď đ ð
r ř ŕ ŗ
t ť ţ þ ț ŧ
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/locale_key_texts/my.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[popup_keys]
punctuation !autoColumnOrder!9 ၊ . ? ! # ) ( / ; ... ' @ : - " + \% &
punctuation !autoOrder!9 ၊ . ? ! # ) ( / ; ... ' @ : - " + \% &

[labels]
alphabet: ကခဂ
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/locale_key_texts/ne.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[popup_keys]
ट ़
् ऽ
punctuation !autoColumnOrder!9 . \, ? ! # ) ( / ; ' @ : - " + \% &
punctuation !autoOrder!9 . \, ? ! # ) ( / ; ' @ : - " + \% &
त्त ञ ज्ञ ॥
ड्ढ ई
ऐ घ
Expand Down
9 changes: 4 additions & 5 deletions app/src/main/java/helium314/keyboard/keyboard/Key.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,8 @@ public class Key implements Comparable<Key> {
private static final int POPUP_KEYS_FLAGS_HAS_LABELS = 0x40000000;
private static final int POPUP_KEYS_FLAGS_NEEDS_DIVIDERS = 0x20000000;
private static final int POPUP_KEYS_FLAGS_NO_PANEL_AUTO_POPUP_KEY = 0x10000000;
// TODO: Rename these specifiers to !autoOrder! and !fixedOrder! respectively.
public static final String POPUP_KEYS_AUTO_COLUMN_ORDER = "!autoColumnOrder!";
public static final String POPUP_KEYS_FIXED_COLUMN_ORDER = "!fixedColumnOrder!";
public static final String POPUP_KEYS_AUTO_ORDER = "!autoOrder!";
public static final String POPUP_KEYS_FIXED_ORDER = "!fixedOrder!";
public static final String POPUP_KEYS_HAS_LABELS = "!hasLabels!";
private static final String POPUP_KEYS_NEEDS_DIVIDERS = "!needsDividers!";
private static final String POPUP_KEYS_NO_PANEL_AUTO_POPUP_KEY = "!noPanelAutoPopupKey!";
Expand Down Expand Up @@ -1111,12 +1110,12 @@ private static int getPopupKeysColumnAndFlagsAndSetNullInArray(final KeyboardPar
int popupKeysColumnAndFlags = POPUP_KEYS_MODE_MAX_COLUMN_WITH_AUTO_ORDER
| params.mMaxPopupKeysKeyboardColumn;
int value;
if ((value = PopupKeySpec.getIntValue(popupKeys, POPUP_KEYS_AUTO_COLUMN_ORDER, -1)) > 0) {
if ((value = PopupKeySpec.getIntValue(popupKeys, POPUP_KEYS_AUTO_ORDER, -1)) > 0) {
// Override with fixed column order number and set a relevant mode value.
popupKeysColumnAndFlags = POPUP_KEYS_MODE_FIXED_COLUMN_WITH_AUTO_ORDER
| (value & POPUP_KEYS_COLUMN_NUMBER_MASK);
}
if ((value = PopupKeySpec.getIntValue(popupKeys, POPUP_KEYS_FIXED_COLUMN_ORDER, -1)) > 0) {
if ((value = PopupKeySpec.getIntValue(popupKeys, POPUP_KEYS_FIXED_ORDER, -1)) > 0) {
// Override with fixed column order number and set a relevant mode value.
popupKeysColumnAndFlags = POPUP_KEYS_MODE_FIXED_COLUMN_WITH_FIXED_ORDER
| (value & POPUP_KEYS_COLUMN_NUMBER_MASK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ class LocaleKeyboardInfos(dataStream: InputStream?, locale: Locale) {
// should this also be done with punctuation popupKeys?
// todo: those defaults should not be in here
if ("\'" !in popupKeys)
popupKeys["\'"] = mutableListOf("!fixedColumnOrder!5", "‚", "‘", "’", "‹", "›")
popupKeys["\'"] = mutableListOf("!fixedOrder!5", "‚", "‘", "’", "‹", "›")
if ("\"" !in popupKeys)
popupKeys["\""] = mutableListOf("!fixedColumnOrder!5", "„", "“", "”", "«", "»")
popupKeys["\""] = mutableListOf("!fixedOrder!5", "„", "“", "”", "«", "»")
if ("!" !in popupKeys)
popupKeys["!"] = mutableListOf("¡")
if (labelQuestion !in popupKeys)
popupKeys[labelQuestion] = if (labelQuestion == "?") mutableListOf("¿") else mutableListOf("?", "¿")
if ("punctuation" !in popupKeys)
popupKeys["punctuation"] = mutableListOf("${Key.POPUP_KEYS_AUTO_COLUMN_ORDER}8", "\\,", "?", "!", "#", ")", "(", "/", ";", "'", "@", ":", "-", "\"", "+", "\\%", "&")
popupKeys["punctuation"] = mutableListOf("${Key.POPUP_KEYS_AUTO_ORDER}8", "\\,", "?", "!", "#", ")", "(", "/", ";", "'", "@", ":", "-", "\"", "+", "\\%", "&")
}

private fun readStream(stream: InputStream?, onlyPopupKeys: Boolean, priority: Boolean) {
Expand Down Expand Up @@ -170,21 +170,21 @@ class LocaleKeyboardInfos(dataStream: InputStream?, locale: Locale) {

private fun addFixedColumnOrder(popupKeys: MutableCollection<String>) {
// use intermediate list, because we can't add first in a LinkedHashSet (i.e. MutableSet)
popupKeys.removeAll { it.startsWith(Key.POPUP_KEYS_FIXED_COLUMN_ORDER) }
popupKeys.removeAll { it.startsWith(Key.POPUP_KEYS_FIXED_ORDER) }
val temp = popupKeys.toList()
popupKeys.clear()
popupKeys.add("${Key.POPUP_KEYS_FIXED_COLUMN_ORDER}${temp.size}")
popupKeys.add("${Key.POPUP_KEYS_FIXED_ORDER}${temp.size}")
popupKeys.addAll(temp)
}

private fun adjustAutoColumnOrder(popupKeys: MutableCollection<String>) {
// same style as above
// currently, POPUP_KEYS_AUTO_COLUMN_ORDER is only used for 2 lines of punctuation popups, so assume 2 lines
if (!popupKeys.removeAll { it.startsWith(Key.POPUP_KEYS_AUTO_COLUMN_ORDER) })
// currently, POPUP_KEYS_AUTO_ORDER is only used for 2 lines of punctuation popups, so assume 2 lines
if (!popupKeys.removeAll { it.startsWith(Key.POPUP_KEYS_AUTO_ORDER) })
return
val temp = popupKeys.toList()
popupKeys.clear()
popupKeys.add("${Key.POPUP_KEYS_AUTO_COLUMN_ORDER}${((temp.size + 1) / 2).coerceAtMost(9)}")
popupKeys.add("${Key.POPUP_KEYS_AUTO_ORDER}${((temp.size + 1) / 2).coerceAtMost(9)}")
popupKeys.addAll(temp)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ sealed interface KeyData : AbstractKeyData {
popupKeys[i] = popupKeys[i].rtlLabel(params) // for parentheses
}
if (params.setTabletExtraKeys && popupKeys.contains("!") && popupKeys.contains("?")) {
// remove ! and ? keys and reduce number in autoColumnOrder
// remove ! and ? keys and reduce number in autoOrder
// this makes use of removal of empty popupKeys in PopupKeySpec.insertAdditionalPopupKeys
popupKeys[popupKeys.indexOf("!")] = ""
popupKeys[popupKeys.indexOf("?")] = ""
val columns = popupKeys[0].substringAfter(Key.POPUP_KEYS_AUTO_COLUMN_ORDER).toIntOrNull()
val columns = popupKeys[0].substringAfter(Key.POPUP_KEYS_AUTO_ORDER).toIntOrNull()
if (columns != null)
popupKeys[0] = "${Key.POPUP_KEYS_AUTO_COLUMN_ORDER}${columns - 1}"
popupKeys[0] = "${Key.POPUP_KEYS_AUTO_ORDER}${columns - 1}"
}
return popupKeys
}
Expand Down Expand Up @@ -208,9 +208,9 @@ sealed interface KeyData : AbstractKeyData {
// (probably not necessary, but whatever) and in emoji mode
if ((Settings.getInstance().isTablet || params.mId.mElementId == KeyboardId.ELEMENT_EMOJI_BOTTOM_ROW)
&& popupKeys.remove("!icon/emoji_action_key|!code/key_emoji")) {
val i = popupKeys.indexOfFirst { it.startsWith(Key.POPUP_KEYS_FIXED_COLUMN_ORDER) }
val i = popupKeys.indexOfFirst { it.startsWith(Key.POPUP_KEYS_FIXED_ORDER) }
if (i > -1) {
val n = popupKeys[i].substringAfter(Key.POPUP_KEYS_FIXED_COLUMN_ORDER).toIntOrNull()
val n = popupKeys[i].substringAfter(Key.POPUP_KEYS_FIXED_ORDER).toIntOrNull()
if (n != null)
popupKeys[i] = popupKeys[i].replace(n.toString(), (n - 1).toString())
}
Expand Down Expand Up @@ -245,11 +245,11 @@ sealed interface KeyData : AbstractKeyData {
// could make arrays right away, but they need to be copied anyway as popupKeys arrays are modified when creating KeyParams
private const val POPUP_KEYS_NAVIGATE_PREVIOUS = "!icon/previous_key|!code/key_action_previous,!icon/clipboard_action_key|!code/key_clipboard"
private const val POPUP_KEYS_NAVIGATE_NEXT = "!icon/clipboard_action_key|!code/key_clipboard,!icon/next_key|!code/key_action_next"
private const val POPUP_KEYS_NAVIGATE_PREVIOUS_NEXT = "!fixedColumnOrder!3,!needsDividers!,!icon/previous_key|!code/key_action_previous,!icon/clipboard_action_key|!code/key_clipboard,!icon/next_key|!code/key_action_next"
private const val POPUP_KEYS_NAVIGATE_EMOJI_PREVIOUS = "!fixedColumnOrder!3,!needsDividers!,!icon/previous_key|!code/key_action_previous,!icon/clipboard_action_key|!code/key_clipboard,!icon/emoji_action_key|!code/key_emoji"
private const val POPUP_KEYS_NAVIGATE_PREVIOUS_NEXT = "!fixedOrder!3,!needsDividers!,!icon/previous_key|!code/key_action_previous,!icon/clipboard_action_key|!code/key_clipboard,!icon/next_key|!code/key_action_next"
private const val POPUP_KEYS_NAVIGATE_EMOJI_PREVIOUS = "!fixedOrder!3,!needsDividers!,!icon/previous_key|!code/key_action_previous,!icon/clipboard_action_key|!code/key_clipboard,!icon/emoji_action_key|!code/key_emoji"
private const val POPUP_KEYS_NAVIGATE_EMOJI = "!icon/clipboard_action_key|!code/key_clipboard,!icon/emoji_action_key|!code/key_emoji"
private const val POPUP_KEYS_NAVIGATE_EMOJI_NEXT = "!fixedColumnOrder!3,!needsDividers!,!icon/clipboard_action_key|!code/key_clipboard,!icon/emoji_action_key|!code/key_emoji,!icon/next_key|!code/key_action_next"
private const val POPUP_KEYS_NAVIGATE_EMOJI_PREVIOUS_NEXT = "!fixedColumnOrder!4,!needsDividers!,!icon/previous_key|!code/key_action_previous,!icon/clipboard_action_key|!code/key_clipboard,!icon/emoji_action_key|!code/key_emoji,!icon/next_key|!code/key_action_next"
private const val POPUP_KEYS_NAVIGATE_EMOJI_NEXT = "!fixedOrder!3,!needsDividers!,!icon/clipboard_action_key|!code/key_clipboard,!icon/emoji_action_key|!code/key_emoji,!icon/next_key|!code/key_action_next"
private const val POPUP_KEYS_NAVIGATE_EMOJI_PREVIOUS_NEXT = "!fixedOrder!4,!needsDividers!,!icon/previous_key|!code/key_action_previous,!icon/clipboard_action_key|!code/key_clipboard,!icon/emoji_action_key|!code/key_emoji,!icon/next_key|!code/key_action_next"
}

/** get the label, but also considers code, which can't be set separately for popup keys and thus goes into the label */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ fun createPopupKeysArray(popupSet: PopupSet<*>?, params: KeyboardParams, label:
}
if (!popupKeysDelegate.isInitialized() || popupKeys.isEmpty())
return null
val fco = popupKeys.firstOrNull { it.startsWith(Key.POPUP_KEYS_FIXED_COLUMN_ORDER) }
if (fco != null && fco.substringAfter(Key.POPUP_KEYS_FIXED_COLUMN_ORDER).toIntOrNull() != popupKeys.size - 1) {
val fco = popupKeys.firstOrNull { it.startsWith(Key.POPUP_KEYS_FIXED_ORDER) }
if (fco != null && fco.substringAfter(Key.POPUP_KEYS_FIXED_ORDER).toIntOrNull() != popupKeys.size - 1) {
val fcoExpected = popupKeys.size - popupKeys.count { it.startsWith("!") && it.endsWith("!") } - 1
if (fco.substringAfter(Key.POPUP_KEYS_FIXED_COLUMN_ORDER).toIntOrNull() != fcoExpected)
if (fco.substringAfter(Key.POPUP_KEYS_FIXED_ORDER).toIntOrNull() != fcoExpected)
popupKeys.remove(fco) // maybe rather adjust the number instead of remove?
}
if (popupKeys.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 = popupKeys.toList()
popupKeys.clear()
popupKeys.add("${Key.POPUP_KEYS_FIXED_COLUMN_ORDER}${tmp.size}")
popupKeys.add("${Key.POPUP_KEYS_FIXED_ORDER}${tmp.size}")
popupKeys.addAll(tmp)
}
// autoColumnOrder should be fine
Expand Down Expand Up @@ -76,7 +76,7 @@ fun getHintLabel(popupSet: PopupSet<*>?, params: KeyboardParams, label: String):
return null // better show nothing instead of the toolbar key label

return KeySpecParser.getLabel(transformLabel(hintLabel, params))
// avoid e.g. !autoColumnOrder! as label
// avoid e.g. !autoOrder! as label
// this will avoid having labels on comma and period keys
?.takeIf { label -> !label.startsWith("!") || label.count { it == '!' } != 2 } // excluding the special labels
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/test/java/helium314/keyboard/latin/InputLogicTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class InputLogicTest {
private lateinit var latinIME: LatinIME
private val settingsValues get() = Settings.getValues()
private val inputLogic get() = latinIME.mInputLogic
private val connection: RichInputConnection get() = inputLogic.mConnection
private val connection: RichInputConnection get() = inputLogic.connection
private val composerReader = InputLogic::class.java.getDeclaredField("mWordComposer").apply { isAccessible = true }
private val composer get() = composerReader.get(inputLogic) as WordComposer
private val spaceStateReader = InputLogic::class.java.getDeclaredField("mSpaceState").apply { isAccessible = true }
Expand Down Expand Up @@ -755,7 +755,7 @@ class InputLogicTest {

if (currentScript != ScriptUtils.SCRIPT_HANGUL // check fails if hangul combiner merges symbols
&& !(codePoint == Constants.CODE_SPACE && oldBefore.lastOrNull() == ' ') // check fails when 2 spaces are converted into a period
&& !latinIME.mInputLogic.mSuggestedWords.mWillAutoCorrect // autocorrect obviously creates inconsistencies
&& !latinIME.mInputLogic.suggestedWords.mWillAutoCorrect // autocorrect obviously creates inconsistencies
) {
if (phantomSpaceToInsert.isEmpty())
assertEquals(oldBefore + insert, textBeforeCursor)
Expand Down
2 changes: 1 addition & 1 deletion app/src/test/java/helium314/keyboard/latin/SuggestTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import kotlin.test.assertEquals
])
class SuggestTest {
private lateinit var latinIME: LatinIME
private val suggest get() = latinIME.mInputLogic.mSuggest
private val suggest get() = latinIME.mInputLogic.suggest

// values taken from the string array auto_correction_threshold_mode_indexes
private val thresholdModest = 0.185f
Expand Down
Loading
Loading