mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-25 11:22:20 +00:00
fix missing preview popups for keys with icon and negative code
This commit is contained in:
parent
d11237ba23
commit
a297b6037c
3 changed files with 10 additions and 4 deletions
|
@ -921,6 +921,8 @@ public class Key implements Comparable<Key> {
|
|||
public final boolean isAccentColored() {
|
||||
if (hasActionKeyBackground()) return true;
|
||||
final String iconName = getIconName();
|
||||
// todo: other way of identifying the color?
|
||||
// if yes, NAME_CLIPBOARD_ACTION_KEY and NAME_CLIPBOARD_NORMAL_KEY could be merged
|
||||
return iconName.equals(KeyboardIconsSet.NAME_NEXT_KEY)
|
||||
|| iconName.equals(KeyboardIconsSet.NAME_PREVIOUS_KEY)
|
||||
|| iconName.equals(KeyboardIconsSet.NAME_CLIPBOARD_ACTION_KEY)
|
||||
|
@ -1149,12 +1151,15 @@ public class Key implements Comparable<Key> {
|
|||
|| (mCode == KeyCode.SYMBOL_ALPHA && !params.mId.isAlphabetKeyboard())
|
||||
)
|
||||
actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
|
||||
if (mCode <= Constants.CODE_SPACE && mCode != KeyCode.MULTIPLE_CODE_POINTS)
|
||||
if (mCode <= Constants.CODE_SPACE && mCode != KeyCode.MULTIPLE_CODE_POINTS && mIconName.equals(KeyboardIconsSet.NAME_UNDEFINED))
|
||||
actionFlags |= ACTION_FLAGS_NO_KEY_PREVIEW;
|
||||
switch (mCode) {
|
||||
case KeyCode.DELETE, KeyCode.SHIFT, Constants.CODE_ENTER, KeyCode.SHIFT_ENTER, KeyCode.ALPHA, Constants.CODE_SPACE,
|
||||
KeyCode.SYMBOL, KeyCode.SYMBOL_ALPHA -> actionFlags |= ACTION_FLAGS_NO_KEY_PREVIEW; // no preview even if icon!
|
||||
case KeyCode.SETTINGS, KeyCode.LANGUAGE_SWITCH -> actionFlags |= ACTION_FLAGS_ALT_CODE_WHILE_TYPING;
|
||||
}
|
||||
if (mCode == KeyCode.DELETE)
|
||||
actionFlags |= ACTION_FLAGS_IS_REPEATABLE;
|
||||
if (mCode == KeyCode.SETTINGS || mCode == KeyCode.LANGUAGE_SWITCH)
|
||||
actionFlags |= ACTION_FLAGS_ALT_CODE_WHILE_TYPING;
|
||||
mActionFlags = actionFlags;
|
||||
|
||||
final int altCodeInAttr; // settings and language switch keys have alt code space, all others nothing
|
||||
|
|
|
@ -221,7 +221,7 @@ public final class KeySpecParser {
|
|||
return defaultCode;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@NonNull // todo: why not null instead of NAME_UNDEFINED?
|
||||
public static String getIconName(@Nullable final String keySpec) {
|
||||
if (keySpec == null) {
|
||||
// TODO: Throw {@link KeySpecParserError} once Key.keyLabel attribute becomes mandatory.
|
||||
|
|
|
@ -113,6 +113,7 @@ sealed interface KeyData : AbstractKeyData {
|
|||
else "!icon/space_key_for_number_layout|!code/key_space"
|
||||
|
||||
// todo: emoji and language switch popups should actually disappear depending on current layout (including functional keys)
|
||||
// keys could be replaced with toolbar keys, but parsing needs to be adjusted (should happen anyway...)
|
||||
private fun getCommaPopupKeys(params: KeyboardParams): List<String> {
|
||||
val keys = mutableListOf<String>()
|
||||
if (!params.mId.mDeviceLocked)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue