diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index 971e22965..936609924 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -24,4 +24,12 @@ .,!?) !?,\u0022\u0027:()-/@_ + + + + 0 + + 1 + + 2 diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index bf8e987c9..56dceef2d 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -91,6 +91,27 @@ Spacebar and punctuation automatically insert highlighted word + + Show settings key + + + @string/settings_key_mode_auto + @string/settings_key_mode_always_show + @string/settings_key_mode_always_hide + + + Automatic + + Always show + + Always hide + + + @string/settings_key_mode_auto_name + @string/settings_key_mode_always_show_name + @string/settings_key_mode_always_hide_name + + Bigram Suggestions diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index 1794d4c86..d9d6a15ac 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -165,48 +165,184 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:codes="@integer/key_f1" + android:keyIcon="@drawable/sym_bkeyboard_mic" + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + android:popupKeyboard="@xml/popup_punctuation" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:codes="@integer/key_f1" + android:keyIcon="@drawable/sym_bkeyboard_mic" + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + android:popupKeyboard="@xml/popup_punctuation" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:codes="@integer/key_f1" + android:keyIcon="@drawable/sym_bkeyboard_mic" + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + android:popupKeyboard="@xml/popup_punctuation" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:isModifier="true" + android:keyEdgeFlags="left" /> + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:codes="@integer/key_f1" + android:keyIcon="@drawable/sym_bkeyboard_mic" + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + android:popupKeyboard="@xml/popup_punctuation" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:codes="@integer/key_f1" + android:keyIcon="@drawable/sym_bkeyboard_mic" + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + android:popupKeyboard="@xml/popup_punctuation" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:codes="@integer/key_f1" + android:keyIcon="@drawable/sym_bkeyboard_mic" + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + android:popupKeyboard="@xml/popup_punctuation" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:codes="@integer/key_f1" + android:keyIcon="@drawable/sym_bkeyboard_mic" + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + android:popupKeyboard="@xml/popup_punctuation" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:codes="@integer/key_f1" + android:keyIcon="@drawable/sym_bkeyboard_mic" + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + android:popupKeyboard="@xml/popup_punctuation" /> - @@ -191,42 +183,216 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> - + android:keyLabel="/" /> + android:popupKeyboard="@xml/popup_punctuation" /> + + + + + + + + + + + + + + + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + + + + + + + + + + + + + + + + + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:popupKeyboard="@xml/popup_punctuation" /> + android:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + android:iconPreview="@drawable/sym_keyboard_feedback_mic" /> + android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + android:popupKeyboard="@xml/popup_punctuation" /> - + + + + + + + + + - + android:isModifier="true"/> + + android:popupKeyboard="@xml/popup_punctuation" android:isModifier="true"/> diff --git a/java/res/xml/kbd_symbols_black.xml b/java/res/xml/kbd_symbols_black.xml index 7eae55481..3bf1397ae 100644 --- a/java/res/xml/kbd_symbols_black.xml +++ b/java/res/xml/kbd_symbols_black.xml @@ -121,22 +121,39 @@ android:isRepeatable="true"/> - + + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_settings"/> + + android:popupKeyboard="@xml/popup_punctuation"/> + android:iconPreview="@drawable/sym_keyboard_feedback_return"/> diff --git a/java/res/xml/kbd_symbols_shift.xml b/java/res/xml/kbd_symbols_shift.xml index b0693917e..b72ea50e5 100644 --- a/java/res/xml/kbd_symbols_shift.xml +++ b/java/res/xml/kbd_symbols_shift.xml @@ -88,18 +88,39 @@ android:isRepeatable="true" android:isModifier="true"/> - + + + + + + + + + - + android:isModifier="true"/> + - + - + + + + + + + + + - + android:iconPreview="@drawable/sym_keyboard_feedback_settings"/> + - + + android:iconPreview="@drawable/sym_keyboard_feedback_return" /> diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 762ada00c..2e6dffaf4 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -59,6 +59,15 @@ android:defaultValue="false" /> + + >(); mSymbolsId = makeSymbolsId(false); mSymbolsShiftedId = makeSymbolsShiftedId(false); - mInputMethodService = ims; } /** @@ -132,11 +163,15 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha } private KeyboardId makeSymbolsId(boolean hasVoice) { - return new KeyboardId(KBD_SYMBOLS[getCharColorId()], hasVoice); + return new KeyboardId(KBD_SYMBOLS[getCharColorId()], mHasSettingsKey ? + KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS, + false, hasVoice); } private KeyboardId makeSymbolsShiftedId(boolean hasVoice) { - return new KeyboardId(KBD_SYMBOLS_SHIFT[getCharColorId()], hasVoice); + return new KeyboardId(KBD_SYMBOLS_SHIFT[getCharColorId()], mHasSettingsKey ? + KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS, + false, hasVoice); } void makeKeyboards(boolean forceCreate) { @@ -243,20 +278,22 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha mInputView.setKeyboard(keyboard); keyboard.setShifted(false); keyboard.setShiftLocked(keyboard.isShiftLocked()); - keyboard.setImeOptions(mContext.getResources(), mMode, imeOptions); + keyboard.setImeOptions(mInputMethodService.getResources(), mMode, imeOptions); keyboard.setColorOfSymbolIcons(mIsAutoCompletionActive, isBlackSym()); + // Update the settings key state because number of enabled IMEs could have been changed + updateSettingsKeyState(PreferenceManager.getDefaultSharedPreferences(mInputMethodService)); } private LatinKeyboard getKeyboard(KeyboardId id) { SoftReference ref = mKeyboards.get(id); LatinKeyboard keyboard = (ref == null) ? null : ref.get(); if (keyboard == null) { - Resources orig = mContext.getResources(); + Resources orig = mInputMethodService.getResources(); Configuration conf = orig.getConfiguration(); Locale saveLocale = conf.locale; conf.locale = mInputLocale; orig.updateConfiguration(conf, null); - keyboard = new LatinKeyboard(mContext, id.mXml, id.mKeyboardMode); + keyboard = new LatinKeyboard(mInputMethodService, id.mXml, id.mKeyboardMode); keyboard.setVoiceMode(hasVoiceButton(id.mXml == R.xml.kbd_symbols || id.mXml == R.xml.kbd_symbols_black), mHasVoice); keyboard.setLanguageSwitcher(mLanguageSwitcher, mIsAutoCompletionActive, isBlackSym()); @@ -281,7 +318,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha if (mode == MODE_PHONE) { return new KeyboardId(KBD_PHONE_SYMBOLS[charColorId], hasVoice); } else { - return new KeyboardId(KBD_SYMBOLS[charColorId], hasVoice); + return new KeyboardId(KBD_SYMBOLS[charColorId], mHasSettingsKey ? + KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS, + false, hasVoice); } } switch (mode) { @@ -290,19 +329,27 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha "getKeyboardId:" + mode + "," + imeOptions + "," + isSymbols); /* fall through */ case MODE_TEXT: - return new KeyboardId(keyboardRowsResId, KEYBOARDMODE_NORMAL, true, hasVoice); + return new KeyboardId(keyboardRowsResId, mHasSettingsKey ? + KEYBOARDMODE_NORMAL_WITH_SETTINGS_KEY : KEYBOARDMODE_NORMAL, + true, hasVoice); case MODE_SYMBOLS: - return new KeyboardId(KBD_SYMBOLS[charColorId], hasVoice); + return new KeyboardId(KBD_SYMBOLS[charColorId], mHasSettingsKey ? + KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS, + false, hasVoice); case MODE_PHONE: return new KeyboardId(KBD_PHONE[charColorId], hasVoice); case MODE_URL: - return new KeyboardId(keyboardRowsResId, KEYBOARDMODE_URL, true, hasVoice); + return new KeyboardId(keyboardRowsResId, mHasSettingsKey ? + KEYBOARDMODE_URL_WITH_SETTINGS_KEY : KEYBOARDMODE_URL, true, hasVoice); case MODE_EMAIL: - return new KeyboardId(keyboardRowsResId, KEYBOARDMODE_EMAIL, true, hasVoice); + return new KeyboardId(keyboardRowsResId, mHasSettingsKey ? + KEYBOARDMODE_EMAIL_WITH_SETTINGS_KEY : KEYBOARDMODE_EMAIL, true, hasVoice); case MODE_IM: - return new KeyboardId(keyboardRowsResId, KEYBOARDMODE_IM, true, hasVoice); + return new KeyboardId(keyboardRowsResId, mHasSettingsKey ? + KEYBOARDMODE_IM_WITH_SETTINGS_KEY : KEYBOARDMODE_IM, true, hasVoice); case MODE_WEB: - return new KeyboardId(keyboardRowsResId, KEYBOARDMODE_WEB, true, hasVoice); + return new KeyboardId(keyboardRowsResId, mHasSettingsKey ? + KEYBOARDMODE_WEB_WITH_SETTINGS_KEY : KEYBOARDMODE_WEB, true, hasVoice); } return null; } @@ -351,7 +398,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha // called. symbolsShiftedKeyboard.enableShiftLock(); symbolsShiftedKeyboard.setShiftLocked(true); - symbolsShiftedKeyboard.setImeOptions(mContext.getResources(), mMode, mImeOptions); + symbolsShiftedKeyboard.setImeOptions(mInputMethodService.getResources(), + mMode, mImeOptions); } else if (mCurrentId.equals(mSymbolsShiftedId)) { LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId); mCurrentId = mSymbolsId; @@ -360,7 +408,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha // indicator, we need to call enableShiftLock() and setShiftLocked(false). symbolsKeyboard.enableShiftLock(); symbolsKeyboard.setShifted(false); - symbolsKeyboard.setImeOptions(mContext.getResources(), mMode, mImeOptions); + symbolsKeyboard.setImeOptions(mInputMethodService.getResources(), mMode, mImeOptions); } } @@ -445,11 +493,14 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha if (PREF_KEYBOARD_LAYOUT.equals(key)) { changeLatinKeyboardView( Integer.valueOf(sharedPreferences.getString(key, DEFAULT_LAYOUT_ID)), false); + } else if (LatinIMESettings.PREF_SETTINGS_KEY.equals(key)) { + updateSettingsKeyState(sharedPreferences); + recreateInputView(); } } public boolean isBlackSym () { - if (mInputView != null && mInputView.getSymbolColorSheme() == 1) { + if (mInputView != null && mInputView.getSymbolColorScheme() == 1) { return true; } return false; @@ -471,4 +522,19 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha .onAutoCompletionStateChanged(isAutoCompletion)); } } + + private void updateSettingsKeyState(SharedPreferences prefs) { + Resources resources = mInputMethodService.getResources(); + final String settingsKeyMode = prefs.getString(LatinIMESettings.PREF_SETTINGS_KEY, + resources.getString(DEFAULT_SETTINGS_KEY_MODE)); + // We show the settings key when 1) SETTINGS_KEY_MODE_ALWAYS_SHOW or + // 2) SETTINGS_KEY_MODE_AUTO and there are two or more enabled IMEs on the system + if (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW)) + || (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_AUTO)) + && LatinIMEUtil.hasMultipleEnabledIMEs(mInputMethodService))) { + mHasSettingsKey = true; + } else { + mHasSettingsKey = false; + } + } } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index f80ecc6d4..ecfd41651 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -356,7 +356,7 @@ public class LatinIME extends InputMethodService final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); mLanguageSwitcher = new LanguageSwitcher(this); mLanguageSwitcher.loadLocales(prefs); - mKeyboardSwitcher = new KeyboardSwitcher(this, this); + mKeyboardSwitcher = new KeyboardSwitcher(this); mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher); mSystemLocale = conf.locale.toString(); mLanguageSwitcher.setSystemLocale(conf.locale); @@ -984,7 +984,7 @@ public class LatinIME extends InputMethodService private void reloadKeyboards() { if (mKeyboardSwitcher == null) { - mKeyboardSwitcher = new KeyboardSwitcher(this, this); + mKeyboardSwitcher = new KeyboardSwitcher(this); } mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher); if (mKeyboardSwitcher.getInputView() != null @@ -1122,11 +1122,6 @@ public class LatinIME extends InputMethodService } } - private boolean hasMultipleEnabledIMEs() { - return ((InputMethodManager) getSystemService( - INPUT_METHOD_SERVICE)).getEnabledInputMethodList().size() > 1; - } - private void showInputMethodPicker() { ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)) .showInputMethodPicker(); @@ -1134,7 +1129,7 @@ public class LatinIME extends InputMethodService private void onOptionKeyPressed() { if (!isShowingOptionDialog()) { - if (hasMultipleEnabledIMEs()) { + if (LatinIMEUtil.hasMultipleEnabledIMEs(this)) { showOptionsMenu(); } else { launchSettings(); @@ -1144,7 +1139,7 @@ public class LatinIME extends InputMethodService private void onOptionKeyLongPressed() { if (!isShowingOptionDialog()) { - if (hasMultipleEnabledIMEs()) { + if (LatinIMEUtil.hasMultipleEnabledIMEs(this)) { showInputMethodPicker(); } else { launchSettings(); diff --git a/java/src/com/android/inputmethod/latin/LatinIMESettings.java b/java/src/com/android/inputmethod/latin/LatinIMESettings.java index 565c1e6e8..f9534d265 100644 --- a/java/src/com/android/inputmethod/latin/LatinIMESettings.java +++ b/java/src/com/android/inputmethod/latin/LatinIMESettings.java @@ -46,6 +46,7 @@ public class LatinIMESettings extends PreferenceActivity private static final String PREDICTION_SETTINGS_KEY = "prediction_settings"; private static final String VOICE_SETTINGS_KEY = "voice_mode"; private static final String DEBUG_MODE_KEY = "debug_mode"; + /* package */ static final String PREF_SETTINGS_KEY = "settings_key"; private static final String TAG = "LatinIMESettings"; @@ -55,6 +56,7 @@ public class LatinIMESettings extends PreferenceActivity private CheckBoxPreference mQuickFixes; private CheckBoxPreference mDebugMode; private ListPreference mVoicePreference; + private ListPreference mSettingsKeyPreference; private boolean mVoiceOn; private VoiceInputLogger mLogger; @@ -68,6 +70,7 @@ public class LatinIMESettings extends PreferenceActivity addPreferencesFromResource(R.xml.prefs); mQuickFixes = (CheckBoxPreference) findPreference(QUICK_FIXES_KEY); mVoicePreference = (ListPreference) findPreference(VOICE_SETTINGS_KEY); + mSettingsKeyPreference = (ListPreference) findPreference(PREF_SETTINGS_KEY); SharedPreferences prefs = getPreferenceManager().getSharedPreferences(); prefs.registerOnSharedPreferenceChangeListener(this); @@ -93,6 +96,7 @@ public class LatinIMESettings extends PreferenceActivity } else { updateVoiceModeSummary(); } + updateSettingsKeySummary(); } @Override @@ -106,7 +110,7 @@ public class LatinIMESettings extends PreferenceActivity (new BackupManager(this)).dataChanged(); // If turning on voice input, show dialog if (key.equals(VOICE_SETTINGS_KEY) && !mVoiceOn) { - if (! prefs.getString(VOICE_SETTINGS_KEY, mVoiceModeOff) + if (!prefs.getString(VOICE_SETTINGS_KEY, mVoiceModeOff) .equals(mVoiceModeOff)) { showVoiceConfirmation(); } @@ -118,6 +122,13 @@ public class LatinIMESettings extends PreferenceActivity } mVoiceOn = !(prefs.getString(VOICE_SETTINGS_KEY, mVoiceModeOff).equals(mVoiceModeOff)); updateVoiceModeSummary(); + updateSettingsKeySummary(); + } + + private void updateSettingsKeySummary() { + mSettingsKeyPreference.setSummary( + getResources().getStringArray(R.array.settings_key_modes) + [mSettingsKeyPreference.findIndexOfValue(mSettingsKeyPreference.getValue())]); } private void updateDebugMode() { diff --git a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java index 93ad4072d..34b52845e 100644 --- a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java +++ b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java @@ -16,6 +16,9 @@ package com.android.inputmethod.latin; +import android.view.inputmethod.InputMethodManager; + +import android.content.Context; import android.os.AsyncTask; import android.text.format.DateUtils; import android.util.Log; @@ -72,4 +75,9 @@ public class LatinIMEUtil { } } } + + public static boolean hasMultipleEnabledIMEs(Context context) { + return ((InputMethodManager) context.getSystemService( + Context.INPUT_METHOD_SERVICE)).getEnabledInputMethodList().size() > 1; + } } diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 3ae2e1c53..591235577 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -643,7 +643,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return mShowPreview; } - public int getSymbolColorSheme() { + public int getSymbolColorScheme() { return mSymbolColorScheme; }