Merge remote-tracking branch 'goog/master' into merge
commit
bf6ab28ae3
|
@ -28,7 +28,7 @@
|
||||||
latin:verticalGap="@dimen/key_bottom_gap"
|
latin:verticalGap="@dimen/key_bottom_gap"
|
||||||
latin:popupKeyboardTemplate="@xml/kbd_popup_template"
|
latin:popupKeyboardTemplate="@xml/kbd_popup_template"
|
||||||
latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
|
latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
|
||||||
latin:keyboardLocale="de"
|
latin:keyboardLocale="de_DE"
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/kbd_qwertz_rows" />
|
latin:keyboardLayout="@xml/kbd_qwertz_rows" />
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
latin:verticalGap="@dimen/key_bottom_gap"
|
latin:verticalGap="@dimen/key_bottom_gap"
|
||||||
latin:popupKeyboardTemplate="@xml/kbd_popup_template"
|
latin:popupKeyboardTemplate="@xml/kbd_popup_template"
|
||||||
latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
|
latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
|
||||||
latin:keyboardLocale="fr"
|
latin:keyboardLocale="fr_FR"
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/kbd_azerty_rows" />
|
latin:keyboardLayout="@xml/kbd_azerty_rows" />
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
latin:verticalGap="@dimen/key_bottom_gap"
|
latin:verticalGap="@dimen/key_bottom_gap"
|
||||||
latin:popupKeyboardTemplate="@xml/kbd_popup_template"
|
latin:popupKeyboardTemplate="@xml/kbd_popup_template"
|
||||||
latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
|
latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
|
||||||
latin:keyboardLocale="ru"
|
latin:keyboardLocale="ru_RU"
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/kbd_ru_rows" />
|
latin:keyboardLayout="@xml/kbd_ru_rows" />
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
latin:verticalGap="@dimen/key_bottom_gap"
|
latin:verticalGap="@dimen/key_bottom_gap"
|
||||||
latin:popupKeyboardTemplate="@xml/kbd_popup_template"
|
latin:popupKeyboardTemplate="@xml/kbd_popup_template"
|
||||||
latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
|
latin:maxPopupKeyboardColumn="@integer/config_max_popup_keyboard_column"
|
||||||
latin:keyboardLocale="en"
|
latin:keyboardLocale="en_GB,en_US"
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
latin:keyboardLayout="@xml/kbd_qwerty_rows" />
|
latin:keyboardLayout="@xml/kbd_qwerty_rows" />
|
||||||
|
|
|
@ -64,13 +64,6 @@
|
||||||
android:key="subtype_settings"
|
android:key="subtype_settings"
|
||||||
android:title="@string/language_selection_title"
|
android:title="@string/language_selection_title"
|
||||||
android:summary="@string/language_selection_summary" />
|
android:summary="@string/language_selection_summary" />
|
||||||
<PreferenceScreen
|
|
||||||
android:key="language_selection"
|
|
||||||
android:title="@string/language_selection_title"
|
|
||||||
android:summary="@string/language_selection_summary">
|
|
||||||
<intent
|
|
||||||
android:action="com.android.inputmethod.latin.INPUT_LANGUAGE_SELECTION"/>
|
|
||||||
</PreferenceScreen>
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/prediction_category"
|
android:title="@string/prediction_category"
|
||||||
|
|
|
@ -40,8 +40,9 @@ public class CompatUtils {
|
||||||
int flagsForSubtypeSettings) {
|
int flagsForSubtypeSettings) {
|
||||||
final String action;
|
final String action;
|
||||||
Intent intent;
|
Intent intent;
|
||||||
if (android.os.Build.VERSION.SDK_INT
|
if (InputMethodServiceCompatWrapper.CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED
|
||||||
>= /* android.os.Build.VERSION_CODES.HONEYCOMB */ 11) {
|
/* android.os.Build.VERSION_CODES.HONEYCOMB */
|
||||||
|
&& android.os.Build.VERSION.SDK_INT >= 11) {
|
||||||
// Refer to android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS
|
// Refer to android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS
|
||||||
action = INPUT_METHOD_SUBTYPE_SETTINGS;
|
action = INPUT_METHOD_SUBTYPE_SETTINGS;
|
||||||
intent = new Intent(action);
|
intent = new Intent(action);
|
||||||
|
|
|
@ -43,13 +43,15 @@ import java.io.IOException;
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class InputLanguageSelection extends PreferenceActivity {
|
public class InputLanguageSelection extends PreferenceActivity {
|
||||||
|
|
||||||
private SharedPreferences mPrefs;
|
private SharedPreferences mPrefs;
|
||||||
private String mSelectedLanguages;
|
private String mSelectedLanguages;
|
||||||
private ArrayList<Loc> mAvailableLanguages = new ArrayList<Loc>();
|
private HashMap<CheckBoxPreference, Locale> mLocaleMap =
|
||||||
|
new HashMap<CheckBoxPreference, Locale>();
|
||||||
|
|
||||||
private static class Loc implements Comparable<Object> {
|
private static class Loc implements Comparable<Object> {
|
||||||
private static Collator sCollator = Collator.getInstance();
|
private static Collator sCollator = Collator.getInstance();
|
||||||
|
@ -85,14 +87,17 @@ public class InputLanguageSelection extends PreferenceActivity {
|
||||||
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
mSelectedLanguages = mPrefs.getString(Settings.PREF_SELECTED_LANGUAGES, "");
|
mSelectedLanguages = mPrefs.getString(Settings.PREF_SELECTED_LANGUAGES, "");
|
||||||
String[] languageList = mSelectedLanguages.split(",");
|
String[] languageList = mSelectedLanguages.split(",");
|
||||||
mAvailableLanguages = getUniqueLocales();
|
ArrayList<Loc> availableLanguages = getUniqueLocales();
|
||||||
PreferenceGroup parent = getPreferenceScreen();
|
PreferenceGroup parent = getPreferenceScreen();
|
||||||
for (int i = 0; i < mAvailableLanguages.size(); i++) {
|
for (int i = 0; i < availableLanguages.size(); i++) {
|
||||||
Locale locale = mAvailableLanguages.get(i).mLocale;
|
Locale locale = availableLanguages.get(i).mLocale;
|
||||||
final Pair<Boolean, Boolean> hasDictionaryOrLayout = hasDictionaryOrLayout(locale);
|
final Pair<Boolean, Boolean> hasDictionaryOrLayout = hasDictionaryOrLayout(locale);
|
||||||
final boolean hasDictionary = hasDictionaryOrLayout.first;
|
final boolean hasDictionary = hasDictionaryOrLayout.first;
|
||||||
final boolean hasLayout = hasDictionaryOrLayout.second;
|
final boolean hasLayout = hasDictionaryOrLayout.second;
|
||||||
if (!hasDictionary && !hasLayout) {
|
// Add this locale to the supported list if:
|
||||||
|
// 1) this locale has a layout/ 2) this locale has a dictionary and the length
|
||||||
|
// of the locale is equal to or larger than 5.
|
||||||
|
if (!hasLayout && !(hasDictionary && locale.toString().length() >= 5)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CheckBoxPreference pref = new CheckBoxPreference(this);
|
CheckBoxPreference pref = new CheckBoxPreference(this);
|
||||||
|
@ -102,6 +107,7 @@ public class InputLanguageSelection extends PreferenceActivity {
|
||||||
if (hasDictionary) {
|
if (hasDictionary) {
|
||||||
pref.setSummary(R.string.has_dictionary);
|
pref.setSummary(R.string.has_dictionary);
|
||||||
}
|
}
|
||||||
|
mLocaleMap.put(pref, locale);
|
||||||
parent.addPreference(pref);
|
parent.addPreference(pref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,11 +141,16 @@ public class InputLanguageSelection extends PreferenceActivity {
|
||||||
}
|
}
|
||||||
bd.close();
|
bd.close();
|
||||||
|
|
||||||
final String countryCode = locale.getLanguage();
|
final String localeStr = locale.toString();
|
||||||
final String layoutCountryCode = KeyboardParser.parseKeyboardLocale(
|
final String[] layoutCountryCodes = KeyboardParser.parseKeyboardLocale(
|
||||||
this, R.xml.kbd_qwerty);
|
this, R.xml.kbd_qwerty).split(",", -1);
|
||||||
if (!TextUtils.isEmpty(countryCode) && !TextUtils.isEmpty(layoutCountryCode)) {
|
if (!TextUtils.isEmpty(localeStr) && layoutCountryCodes.length > 0) {
|
||||||
hasLayout = countryCode.subSequence(0, 2).equals(layoutCountryCode.substring(0, 2));
|
for (String s : layoutCountryCodes) {
|
||||||
|
if (s.equals(localeStr)) {
|
||||||
|
hasLayout = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -170,8 +181,7 @@ public class InputLanguageSelection extends PreferenceActivity {
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
CheckBoxPreference pref = (CheckBoxPreference) parent.getPreference(i);
|
CheckBoxPreference pref = (CheckBoxPreference) parent.getPreference(i);
|
||||||
if (pref.isChecked()) {
|
if (pref.isChecked()) {
|
||||||
Locale locale = mAvailableLanguages.get(i).mLocale;
|
checkedLanguages += get5Code(mLocaleMap.get(pref)) + ",";
|
||||||
checkedLanguages += get5Code(locale) + ",";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (checkedLanguages.length() < 1) checkedLanguages = null; // Save null
|
if (checkedLanguages.length() < 1) checkedLanguages = null; // Save null
|
||||||
|
|
|
@ -68,7 +68,6 @@ public class Settings extends PreferenceActivity
|
||||||
public static final String PREF_AUTO_CORRECTION_THRESHOLD = "auto_correction_threshold";
|
public static final String PREF_AUTO_CORRECTION_THRESHOLD = "auto_correction_threshold";
|
||||||
public static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion";
|
public static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion";
|
||||||
public static final String PREF_DEBUG_SETTINGS = "debug_settings";
|
public static final String PREF_DEBUG_SETTINGS = "debug_settings";
|
||||||
public static final String PREF_LANGUAGE_SELECTION = "language_selection";
|
|
||||||
|
|
||||||
public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode";
|
public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode";
|
||||||
|
|
||||||
|
@ -152,7 +151,8 @@ public class Settings extends PreferenceActivity
|
||||||
|
|
||||||
final boolean showSubtypeSettings = getResources().getBoolean(
|
final boolean showSubtypeSettings = getResources().getBoolean(
|
||||||
R.bool.config_enable_show_subtype_settings);
|
R.bool.config_enable_show_subtype_settings);
|
||||||
if (!showSubtypeSettings) {
|
if (InputMethodServiceCompatWrapper.CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED
|
||||||
|
&& !showSubtypeSettings) {
|
||||||
generalSettings.removePreference(findPreference(PREF_SUBTYPES));
|
generalSettings.removePreference(findPreference(PREF_SUBTYPES));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,10 +185,6 @@ public class Settings extends PreferenceActivity
|
||||||
if (!showUsabilityModeStudyOption) {
|
if (!showUsabilityModeStudyOption) {
|
||||||
getPreferenceScreen().removePreference(findPreference(PREF_USABILITY_STUDY_MODE));
|
getPreferenceScreen().removePreference(findPreference(PREF_USABILITY_STUDY_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputMethodServiceCompatWrapper.CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) {
|
|
||||||
generalSettings.removePreference(findPreference(PREF_LANGUAGE_SELECTION));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue