diff options
| author | Jules Aguillon | 2023-06-08 21:59:24 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2023-06-10 18:07:23 +0200 |
| commit | a26a535729aa9937af0aab338273c645e33192d1 (patch) | |
| tree | d3bc99f462d142a9e06bed8215d29e3d4c079937 /srcs/juloo.keyboard2/Config.java | |
| parent | b4177b52676321cd4a5fe7a336a4f09e50274f86 (diff) | |
| download | unexpected-keyboard-a26a535729aa9937af0aab338273c645e33192d1.tar.gz unexpected-keyboard-a26a535729aa9937af0aab338273c645e33192d1.zip | |
Fix `_localeTextLayout` null on API < 12
On API level < 12 or on some rare cases, `refreshSubtypeLayout` was not
called, making `_localeTextLayout` uninitialized.
This might also happen if `getExtraValueOf` returns an invalid layout name.
eg. `method.xml` contains an invalid layout name.
Diffstat (limited to 'srcs/juloo.keyboard2/Config.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Config.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index f754e52..8406be2 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -335,13 +335,13 @@ final class Config } } + /** Might return [null] if the selected layout is "system", "custom" or if + the name is not recognized. */ public KeyboardData layout_of_string(Resources res, String name) { - int id = R.xml.qwerty; // The config might store an invalid layout, don't crash + int id; switch (name) { - case "system": case "none": return null; - case "custom": if (custom_layout != null) return custom_layout; break; case "azerty": id = R.xml.azerty; break; case "bangla": id = R.xml.bangla; break; case "bgph1": id = R.xml.local_bgph1; break; @@ -376,6 +376,8 @@ final class Config case "ar_alt": id = R.xml.ar_alt; break; case "persian": id = R.xml.persian; break; case "kurdish": id = R.xml.kurdish; break; + case "custom": return custom_layout; + case "system": case "none": default: return null; } return KeyboardData.load(res, id); } |
