Fix recently introduced crash

This commit is contained in:
Jules Aguillon 2021-05-09 12:14:56 +02:00
parent dd5fce6cae
commit 092b8e1c15
2 changed files with 6 additions and 3 deletions

View File

@ -57,7 +57,7 @@ class Config
horizontalMargin = res.getDimension(R.dimen.horizontal_margin); horizontalMargin = res.getDimension(R.dimen.horizontal_margin);
preciseRepeat = true; preciseRepeat = true;
characterSize = 1.f; characterSize = 1.f;
accents = 0; accents = 1;
// from prefs // from prefs
refresh(); refresh();
// initialized later // initialized later
@ -83,7 +83,7 @@ class Config
horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin); horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin);
preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat); preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat);
characterSize = prefs.getFloat("character_size", characterSize); characterSize = prefs.getFloat("character_size", characterSize);
accents = Integer.valueOf(prefs.getString("accents", "")); accents = Integer.valueOf(prefs.getString("accents", "1"));
} }
private float getDipPref(SharedPreferences prefs, String pref_name, float def) private float getDipPref(SharedPreferences prefs, String pref_name, float def)

View File

@ -12,10 +12,13 @@ public class Emoji extends KeyValue
{ {
private final String _desc; private final String _desc;
private static HashMap<String, Emoji> emojis_by_name = new HashMap<String, Emoji>();
protected Emoji(String name, String bytecode, String desc) protected Emoji(String name, String bytecode, String desc)
{ {
super(name, bytecode, CHAR_NONE, EVENT_NONE, 0); super(name, bytecode, CHAR_NONE, EVENT_NONE, 0);
_desc = desc; _desc = desc;
emojis_by_name.put(name, this);
} }
public String getDescription() public String getDescription()
@ -29,7 +32,7 @@ public class Emoji extends KeyValue
public static Emoji getEmojiByName(String name) public static Emoji getEmojiByName(String name)
{ {
return ((Emoji)KeyValue.getKeyByName(name)); return emojis_by_name.get(name);
} }
public static Emoji[] getEmojisByGroup(int group_id) public static Emoji[] getEmojisByGroup(int group_id)