mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2025-06-20 17:57:52 +02:00
Fix crash when opening the numpad
This commit is contained in:
parent
d73b9d638e
commit
83c6e5d2ad
@ -345,9 +345,12 @@ public final class Config
|
|||||||
char c = prev_c;
|
char c = prev_c;
|
||||||
if (inverse_numpad)
|
if (inverse_numpad)
|
||||||
c = inverse_numpad_char(c);
|
c = inverse_numpad_char(c);
|
||||||
|
if (map_digit != -1)
|
||||||
|
{
|
||||||
KeyValue modified = ComposeKey.apply(map_digit, c);
|
KeyValue modified = ComposeKey.apply(map_digit, c);
|
||||||
if (modified != null) // Was modified by script
|
if (modified != null) // Was modified by script
|
||||||
return modified;
|
return modified;
|
||||||
|
}
|
||||||
if (prev_c != c) // Was inverted
|
if (prev_c != c) // Was inverted
|
||||||
return key.withChar(c);
|
return key.withChar(c);
|
||||||
break;
|
break;
|
||||||
@ -360,6 +363,8 @@ public final class Config
|
|||||||
static KeyboardData.MapKeyValues numpad_script_map(String numpad_script)
|
static KeyboardData.MapKeyValues numpad_script_map(String numpad_script)
|
||||||
{
|
{
|
||||||
final int map_digit = KeyModifier.modify_numpad_script(numpad_script);
|
final int map_digit = KeyModifier.modify_numpad_script(numpad_script);
|
||||||
|
if (map_digit == -1)
|
||||||
|
return null;
|
||||||
return new KeyboardData.MapKeyValues() {
|
return new KeyboardData.MapKeyValues() {
|
||||||
public KeyValue apply(KeyValue key, boolean localized)
|
public KeyValue apply(KeyValue key, boolean localized)
|
||||||
{
|
{
|
||||||
@ -380,14 +385,16 @@ public final class Config
|
|||||||
same script. */
|
same script. */
|
||||||
public KeyboardData modify_pinentry(KeyboardData kw, KeyboardData main_kw)
|
public KeyboardData modify_pinentry(KeyboardData kw, KeyboardData main_kw)
|
||||||
{
|
{
|
||||||
return kw.mapKeys(numpad_script_map(main_kw.numpad_script));
|
KeyboardData.MapKeyValues m = numpad_script_map(main_kw.numpad_script);
|
||||||
|
return m == null ? kw : kw.mapKeys(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Modify the number row according to [main_kw]'s script. */
|
/** Modify the number row according to [main_kw]'s script. */
|
||||||
public KeyboardData.Row modify_number_row(KeyboardData.Row row,
|
public KeyboardData.Row modify_number_row(KeyboardData.Row row,
|
||||||
KeyboardData main_kw)
|
KeyboardData main_kw)
|
||||||
{
|
{
|
||||||
return row.mapKeys(numpad_script_map(main_kw.numpad_script));
|
KeyboardData.MapKeyValues m = numpad_script_map(main_kw.numpad_script);
|
||||||
|
return m == null ? row : row.mapKeys(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float get_dip_pref(DisplayMetrics dm, String pref_name, float def)
|
private float get_dip_pref(DisplayMetrics dm, String pref_name, float def)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user