Skip to content
Open
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 app/src/main/java/helium314/keyboard/keyboard/Key.java
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ public KeyParams(
final String[] popupKeys = PopupKeysUtilsKt.createPopupKeysArray(popupSet, mKeyboardParams, label != null ? label : keySpec);
mPopupKeysColumnAndFlags = getPopupKeysColumnAndFlagsAndSetNullInArray(params, popupKeys);
final String[] finalPopupKeys = popupKeys == null ? null : PopupKeySpec.filterOutEmptyString(popupKeys);
if (finalPopupKeys != null) {
if (finalPopupKeys != null && finalPopupKeys.length > 0) {
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
mPopupKeys = new PopupKeySpec[finalPopupKeys.length];
for (int i = 0; i < finalPopupKeys.length; i++) {
Expand Down
21 changes: 21 additions & 0 deletions app/src/test/java/helium314/keyboard/KeyboardParserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,27 @@ f""", // no newline at the end
}
}

@Test fun placeholderAsOnlyPopup() { // https://github.com/HeliBorg/HeliBoard/issues/1324
val keyParams = LayoutParser.parseJsonString("""[[{ "label": "ক", "popup": { "relevant": [
{ "type": "placeholder" }
]
} }]]""").flatMap { row -> row.mapNotNull { it.compute(params)?.toKeyParams(params) } }.single()
assertEquals(null, keyParams.mPopupKeys)
keyParams.mAbsoluteWidth = 1f
keyParams.mAbsoluteHeight = 1f
val key = keyParams.createKey()
assertEquals(false, key.isLongPressEnabled)
}

@Test fun placeholderNextToOtherPopup() {
val key = LayoutParser.parseJsonString("""[[{ "label": "ক", "popup": { "relevant": [
{ "type": "placeholder" }, { "label": "k" }
]
} }]]""").flatMap { row -> row.mapNotNull { it.compute(params) } }.single()
assertEquals(1, key.toKeyParams(params).mPopupKeys?.size)
assertEquals("k", key.toKeyParams(params).mPopupKeys?.first()?.mLabel)
}

@Test fun popupSymbolAlpha() {
val key = LayoutParser.parseJsonString("""[[{ "label": "c", "popup": {
"main": { "code": -10001, "label": "x" }
Expand Down