abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/xml/method.xml2
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java23
2 files changed, 17 insertions, 8 deletions
diff --git a/res/xml/method.xml b/res/xml/method.xml
index 49d5063..88fb097 100644
--- a/res/xml/method.xml
+++ b/res/xml/method.xml
@@ -12,7 +12,7 @@
<subtype android:label="%s" android:languageTag="el" android:imeSubtypeLocale="el" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="script=latin,default_layout=grek_qwerty,extra_keys=£@l|€"/>
<subtype android:label="%s" android:languageTag="en-CA" android:imeSubtypeLocale="en_CA" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="script=latin,default_layout=latn_qwerty_us"/>
<subtype android:label="%s" android:languageTag="en-GB" android:imeSubtypeLocale="en_GB" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="script=latin,default_layout=latn_qwerty_gb,extra_keys=£@l"/>
- <subtype android:label="%s" android:languageTag="en-US" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="script=latin,default_layout=latn_qwerty_us"/>
+ <subtype android:label="%s" android:languageTag="en-US" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="script=latin,default_layout=latn_qwerty_us" android:overridesImplicitlyEnabledSubtype="true"/>
<subtype android:label="%s" android:languageTag="es" android:imeSubtypeLocale="es_ES" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="script=latin,default_layout=latn_qwerty_es,extra_keys=accent_aigu:á:é:í:ó:ú@d|accent_tilde:ñ@n|accent_grave@f|accent_trema@u|€"/>
<subtype android:label="%s" android:languageTag="fa" android:imeSubtypeLocale="fa_IR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=arab_pc_ir"/>
<subtype android:label="%s" android:languageTag="fr-CA" android:imeSubtypeLocale="fr_CA" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="script=latin,default_layout=latn_azerty_fr,extra_keys=accent_grave:à:è:ù@f|accent_aigu:é@d|accent_circonflexe:â:ê:ô@f|accent_cedille:ç@c|accent_trema:ë:ï:ü:ÿ@u"/>
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index 0c82aaf..f08f177 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -136,13 +136,9 @@ public class Keyboard2 extends InputMethodService
return ExtraKeys.EMPTY;
}
- @TargetApi(12)
- private void refreshAccentsOption(InputMethodManager imm, InputMethodSubtype subtype)
+ private void refreshAccentsOption(InputMethodManager imm, List<InputMethodSubtype> enabled_subtypes)
{
- List<InputMethodSubtype> enabled_subtypes = getEnabledSubtypes(imm);
List<ExtraKeys> extra_keys = new ArrayList<ExtraKeys>();
- // Gather extra keys from all enabled subtypes
- extra_keys.add(extra_keys_of_subtype(subtype));
for (InputMethodSubtype s : enabled_subtypes)
extra_keys.add(extra_keys_of_subtype(s));
_config.extra_keys_subtype = ExtraKeys.merge(extra_keys);
@@ -153,6 +149,18 @@ public class Keyboard2 extends InputMethodService
return (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
}
+ @TargetApi(12)
+ private String defaultLayoutForSubtypes(InputMethodManager imm, List<InputMethodSubtype> enabled_subtypes)
+ {
+ // Android might return a random subtype, for example, the first in the
+ // list alphabetically.
+ InputMethodSubtype current_subtype = imm.getCurrentInputMethodSubtype();
+ for (InputMethodSubtype s : enabled_subtypes)
+ if (s.getLanguageTag().equals(current_subtype.getLanguageTag()))
+ return s.getExtraValueOf("default_layout");
+ return null;
+ }
+
private void refreshSubtypeImm()
{
InputMethodManager imm = get_imm();
@@ -161,13 +169,14 @@ public class Keyboard2 extends InputMethodService
_config.extra_keys_subtype = null;
if (VERSION.SDK_INT >= 12)
{
+ List<InputMethodSubtype> enabled_subtypes = getEnabledSubtypes(imm);
InputMethodSubtype subtype = imm.getCurrentInputMethodSubtype();
if (subtype != null)
{
- String s = subtype.getExtraValueOf("default_layout");
+ String s = defaultLayoutForSubtypes(imm, enabled_subtypes);
if (s != null)
default_layout = LayoutsPreference.layout_of_string(getResources(), s);
- refreshAccentsOption(imm, subtype);
+ refreshAccentsOption(imm, enabled_subtypes);
}
}
if (default_layout == null)