aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-02-16 16:24:03 -0800
committerTadashi G. Takaoka <takaoka@google.com>2012-02-17 01:04:11 -0800
commit97bde43740d8ba7f8aedde35d20621823140966c (patch)
treea0b514b9ce7f91c445245159088ec4ecd660e04b /java/src/com
parentfed72d6038927203eb5f5395b81dfe3495b486a6 (diff)
downloadlatinime-97bde43740d8ba7f8aedde35d20621823140966c.tar.gz
latinime-97bde43740d8ba7f8aedde35d20621823140966c.tar.xz
latinime-97bde43740d8ba7f8aedde35d20621823140966c.zip
Settings key always exists in more keys of shortcut/f1 key
This change also * Fix comman/f1 key for Arabic keyboard. * Removes "show settings key option" and related stuff. * Renames and simplifies F2 key to shortcut key on 7 inch tablet. Change-Id: Ib1cf99ad00d9780a2f0d170260e756771e161521
Diffstat (limited to 'java/src/com')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java20
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardId.java46
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSet.java9
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java4
-rw-r--r--java/src/com/android/inputmethod/latin/Settings.java7
-rw-r--r--java/src/com/android/inputmethod/latin/SettingsValues.java19
6 files changed, 11 insertions, 94 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 28f71f443..60e506914 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -1073,10 +1073,6 @@ public class Keyboard {
R.styleable.Keyboard_Case_navigateAction, id.navigateAction());
final boolean passwordInputMatched = matchBoolean(a,
R.styleable.Keyboard_Case_passwordInput, id.passwordInput());
- final boolean hasSettingsKeyMatched = matchBoolean(a,
- R.styleable.Keyboard_Case_hasSettingsKey, id.hasSettingsKey());
- final boolean f2KeyModeMatched = matchInteger(a,
- R.styleable.Keyboard_Case_f2KeyMode, id.f2KeyMode());
final boolean clobberSettingsKeyMatched = matchBoolean(a,
R.styleable.Keyboard_Case_clobberSettingsKey, id.mClobberSettingsKey);
final boolean shortcutKeyEnabledMatched = matchBoolean(a,
@@ -1094,14 +1090,13 @@ public class Keyboard {
final boolean countryCodeMatched = matchString(a,
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
final boolean selected = keyboardSetElementMatched && modeMatched
- && navigateActionMatched && passwordInputMatched && hasSettingsKeyMatched
- && f2KeyModeMatched && clobberSettingsKeyMatched
- && shortcutKeyEnabledMatched && hasShortcutKeyMatched && isMultiLineMatched
- && imeActionMatched && localeCodeMatched && languageCodeMatched
- && countryCodeMatched;
+ && navigateActionMatched && passwordInputMatched
+ && clobberSettingsKeyMatched && shortcutKeyEnabledMatched
+ && hasShortcutKeyMatched && isMultiLineMatched && imeActionMatched
+ && localeCodeMatched && languageCodeMatched && countryCodeMatched;
if (DEBUG) {
- startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE,
+ startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE,
textAttr(a.getString(R.styleable.Keyboard_Case_keyboardSetElement),
"keyboardSetElement"),
textAttr(a.getString(R.styleable.Keyboard_Case_mode), "mode"),
@@ -1109,11 +1104,6 @@ public class Keyboard {
"navigateAction"),
booleanAttr(a, R.styleable.Keyboard_Case_passwordInput,
"passwordInput"),
- booleanAttr(a, R.styleable.Keyboard_Case_hasSettingsKey,
- "hasSettingsKey"),
- textAttr(KeyboardId.f2KeyModeName(
- a.getInt(R.styleable.Keyboard_Case_f2KeyMode, -1)),
- "f2KeyMode"),
booleanAttr(a, R.styleable.Keyboard_Case_clobberSettingsKey,
"clobberSettingsKey"),
booleanAttr(a, R.styleable.Keyboard_Case_shortcutKeyEnabled,
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
index 3ab24933c..a75caf262 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
@@ -48,11 +48,6 @@ public class KeyboardId {
public static final int ELEMENT_PHONE_SYMBOLS = 8;
public static final int ELEMENT_NUMBER = 9;
- private static final int F2KEY_MODE_NONE = 0;
- private static final int F2KEY_MODE_SETTINGS = 1;
- private static final int F2KEY_MODE_SHORTCUT_IME = 2;
- private static final int F2KEY_MODE_SHORTCUT_IME_OR_SETTINGS = 3;
-
private static final int IME_ACTION_CUSTOM_LABEL = EditorInfo.IME_MASK_ACTION + 1;
public final Locale mLocale;
@@ -61,7 +56,6 @@ public class KeyboardId {
public final int mMode;
public final int mElementId;
private final EditorInfo mEditorInfo;
- private final boolean mSettingsKeyEnabled;
public final boolean mClobberSettingsKey;
public final boolean mShortcutKeyEnabled;
public final boolean mHasShortcutKey;
@@ -70,15 +64,14 @@ public class KeyboardId {
private final int mHashCode;
public KeyboardId(int elementId, Locale locale, int orientation, int width, int mode,
- EditorInfo editorInfo, boolean settingsKeyEnabled, boolean clobberSettingsKey,
- boolean shortcutKeyEnabled, boolean hasShortcutKey) {
+ EditorInfo editorInfo, boolean clobberSettingsKey, boolean shortcutKeyEnabled,
+ boolean hasShortcutKey) {
this.mLocale = locale;
this.mOrientation = orientation;
this.mWidth = width;
this.mMode = mode;
this.mElementId = elementId;
this.mEditorInfo = editorInfo;
- this.mSettingsKeyEnabled = settingsKeyEnabled;
this.mClobberSettingsKey = clobberSettingsKey;
this.mShortcutKeyEnabled = shortcutKeyEnabled;
this.mHasShortcutKey = hasShortcutKey;
@@ -96,7 +89,6 @@ public class KeyboardId {
id.mWidth,
id.navigateAction(),
id.passwordInput(),
- id.mSettingsKeyEnabled,
id.mClobberSettingsKey,
id.mShortcutKeyEnabled,
id.mHasShortcutKey,
@@ -116,7 +108,6 @@ public class KeyboardId {
&& other.mWidth == this.mWidth
&& other.navigateAction() == this.navigateAction()
&& other.passwordInput() == this.passwordInput()
- && other.mSettingsKeyEnabled == this.mSettingsKeyEnabled
&& other.mClobberSettingsKey == this.mClobberSettingsKey
&& other.mShortcutKeyEnabled == this.mShortcutKeyEnabled
&& other.mHasShortcutKey == this.mHasShortcutKey
@@ -183,25 +174,6 @@ public class KeyboardId {
}
}
- public boolean hasSettingsKey() {
- return mSettingsKeyEnabled && !mClobberSettingsKey;
- }
-
- public int f2KeyMode() {
- if (mClobberSettingsKey) {
- // Never shows the Settings key
- return KeyboardId.F2KEY_MODE_SHORTCUT_IME;
- }
-
- if (mSettingsKeyEnabled) {
- return KeyboardId.F2KEY_MODE_SETTINGS;
- } else {
- // It should be alright to fall back to the Settings key on 7-inch layouts
- // even when the Settings key is not explicitly enabled.
- return KeyboardId.F2KEY_MODE_SHORTCUT_IME_OR_SETTINGS;
- }
- }
-
@Override
public boolean equals(Object other) {
return other instanceof KeyboardId && equals((KeyboardId) other);
@@ -214,17 +186,15 @@ public class KeyboardId {
@Override
public String toString() {
- return String.format("[%s %s %s%d %s %s %s%s%s%s%s%s%s]",
+ return String.format("[%s %s %s%d %s %s %s%s%s%s%s]",
elementIdToName(mElementId),
mLocale,
(mOrientation == 1 ? "port" : "land"), mWidth,
modeName(mMode),
imeAction(),
- f2KeyModeName(f2KeyMode()),
(mClobberSettingsKey ? " clobberSettingsKey" : ""),
(navigateAction() ? " navigateAction" : ""),
(passwordInput() ? " passwordInput" : ""),
- (hasSettingsKey() ? " hasSettingsKey" : ""),
(mShortcutKeyEnabled ? " shortcutKeyEnabled" : ""),
(mHasShortcutKey ? " hasShortcutKey" : "")
);
@@ -270,14 +240,4 @@ public class KeyboardId {
return (actionId == IME_ACTION_CUSTOM_LABEL) ? "actionCustomLabel"
: EditorInfoCompatUtils.imeActionName(actionId);
}
-
- public static String f2KeyModeName(int f2KeyMode) {
- switch (f2KeyMode) {
- case F2KEY_MODE_NONE: return "none";
- case F2KEY_MODE_SETTINGS: return "settings";
- case F2KEY_MODE_SHORTCUT_IME: return "shortcutIme";
- case F2KEY_MODE_SHORTCUT_IME_OR_SETTINGS: return "shortcutImeOrSettings";
- default: return null;
- }
- }
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java
index f27170a89..6e62f743b 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java
@@ -98,7 +98,6 @@ public class KeyboardSet {
int mMode;
EditorInfo mEditorInfo;
boolean mTouchPositionCorrectionEnabled;
- boolean mSettingsKeyEnabled;
boolean mVoiceKeyEnabled;
boolean mVoiceKeyOnMain;
boolean mNoSettingsKey;
@@ -193,8 +192,8 @@ public class KeyboardSet {
final boolean hasShortcutKey = params.mVoiceKeyEnabled
&& (isSymbols != params.mVoiceKeyOnMain);
return new KeyboardId(keyboardSetElementId, params.mLocale, params.mOrientation,
- params.mWidth, params.mMode, params.mEditorInfo, params.mSettingsKeyEnabled,
- params.mNoSettingsKey, params.mVoiceKeyEnabled, hasShortcutKey);
+ params.mWidth, params.mMode, params.mEditorInfo, params.mNoSettingsKey,
+ params.mVoiceKeyEnabled, hasShortcutKey);
}
public static class Builder {
@@ -237,9 +236,7 @@ public class KeyboardSet {
return this;
}
- public Builder setOptions(boolean settingsKeyEnabled, boolean voiceKeyEnabled,
- boolean voiceKeyOnMain) {
- mParams.mSettingsKeyEnabled = settingsKeyEnabled;
+ public Builder setOptions(boolean voiceKeyEnabled, boolean voiceKeyOnMain) {
@SuppressWarnings("deprecation")
final boolean deprecatedNoMicrophone = Utils.inPrivateImeOptions(
null, LatinIME.IME_OPTION_NO_MICROPHONE_COMPAT, mEditorInfo);
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index d5e5a4e53..622e5831f 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -35,7 +35,6 @@ import com.android.inputmethod.latin.InputView;
import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.Settings;
import com.android.inputmethod.latin.SettingsValues;
import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.Utils;
@@ -133,7 +132,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
mSubtypeSwitcher.currentSubtypeContainsExtraValueKey(
LatinIME.SUBTYPE_EXTRA_VALUE_SUPPORT_TOUCH_POSITION_CORRECTION));
builder.setOptions(
- settingsValues.isSettingsKeyEnabled(),
settingsValues.isVoiceKeyEnabled(editorInfo),
settingsValues.isVoiceKeyOnMain());
mKeyboardSet = builder.build();
@@ -404,8 +402,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
if (PREF_KEYBOARD_LAYOUT.equals(key)) {
final int themeIndex = getKeyboardThemeIndex(mInputMethodService, sharedPreferences);
postSetInputView(createInputView(themeIndex, false));
- } else if (Settings.PREF_SHOW_SETTINGS_KEY.equals(key)) {
- postSetInputView(createInputView(mThemeIndex, true));
}
}
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index d32310096..dfcb6450e 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -65,7 +65,6 @@ public class Settings extends InputMethodSettingsActivity
public static final String PREF_VIBRATE_ON = "vibrate_on";
public static final String PREF_SOUND_ON = "sound_on";
public static final String PREF_POPUP_ON = "popup_on";
- public static final String PREF_SHOW_SETTINGS_KEY = "show_settings_key";
public static final String PREF_VOICE_MODE = "voice_mode";
public static final String PREF_CORRECTION_SETTINGS = "correction_settings";
public static final String PREF_CONFIGURE_DICTIONARIES_KEY = "configure_dictionaries_key";
@@ -96,7 +95,6 @@ public class Settings extends InputMethodSettingsActivity
private PreferenceScreen mKeypressVibrationDurationSettingsPref;
private PreferenceScreen mKeypressSoundVolumeSettingsPref;
private ListPreference mVoicePreference;
- private CheckBoxPreference mShowSettingsKeyPreference;
private ListPreference mShowCorrectionSuggestionsPreference;
private ListPreference mAutoCorrectionThresholdPreference;
private ListPreference mKeyPreviewPopupDismissDelay;
@@ -147,7 +145,6 @@ public class Settings extends InputMethodSettingsActivity
mInputLanguageSelection = (PreferenceScreen) findPreference(PREF_SUBTYPES_SETTINGS);
mInputLanguageSelection.setOnPreferenceClickListener(this);
mVoicePreference = (ListPreference) findPreference(PREF_VOICE_MODE);
- mShowSettingsKeyPreference = (CheckBoxPreference) findPreference(PREF_SHOW_SETTINGS_KEY);
mShowCorrectionSuggestionsPreference =
(ListPreference) findPreference(PREF_SHOW_SUGGESTIONS_SETTING);
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
@@ -178,10 +175,6 @@ public class Settings extends InputMethodSettingsActivity
final PreferenceGroup miscSettings =
(PreferenceGroup) findPreference(PREF_MISC_SETTINGS);
- if (!SettingsValues.isShowSettingsKeyOptionEnabled(res)) {
- generalSettings.removePreference(mShowSettingsKeyPreference);
- }
-
final boolean showVoiceKeyOption = res.getBoolean(
R.bool.config_enable_show_voice_key_option);
if (!showVoiceKeyOption) {
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index 6b652313c..7a43cb827 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -49,7 +49,6 @@ public class SettingsValues {
public final boolean mVibrateOn;
public final boolean mSoundOn;
public final boolean mKeyPreviewPopupOn;
- private final boolean mShowSettingsKey;
private final String mVoiceMode;
private final String mAutoCorrectionThresholdRawValue;
public final String mShowSuggestionsSetting;
@@ -118,7 +117,6 @@ public class SettingsValues {
mSoundOn = prefs.getBoolean(Settings.PREF_SOUND_ON,
res.getBoolean(R.bool.config_default_sound_enabled));
mKeyPreviewPopupOn = isKeyPreviewPopupEnabled(prefs, res);
- mShowSettingsKey = isSettingsKeyShown(prefs, res);
final String voiceModeMain = res.getString(R.string.voice_mode_main);
final String voiceModeOff = res.getString(R.string.voice_mode_off);
mVoiceMode = prefs.getString(Settings.PREF_VOICE_MODE, voiceModeMain);
@@ -202,19 +200,6 @@ public class SettingsValues {
return wordSeparators;
}
- private static boolean isSettingsKeyShown(final SharedPreferences prefs, final Resources res) {
- final boolean defaultShowSettingsKey = res.getBoolean(
- R.bool.config_default_show_settings_key);
- return isShowSettingsKeyOptionEnabled(res)
- ? prefs.getBoolean(Settings.PREF_SHOW_SETTINGS_KEY, defaultShowSettingsKey)
- : defaultShowSettingsKey;
- }
-
- public static boolean isShowSettingsKeyOptionEnabled(final Resources resources) {
- // TODO: Read this once and for all into a public final member
- return resources.getBoolean(R.bool.config_enable_show_settings_key_option);
- }
-
private static boolean isVibrateOn(final Context context, final SharedPreferences prefs,
final Resources res) {
final boolean hasVibrator = VibratorCompatWrapper.getInstance(context).hasVibrator();
@@ -306,10 +291,6 @@ public class SettingsValues {
return autoCorrectionThreshold;
}
- public boolean isSettingsKeyEnabled() {
- return mShowSettingsKey;
- }
-
public boolean isVoiceKeyEnabled(final EditorInfo editorInfo) {
final boolean shortcutImeEnabled = SubtypeSwitcher.getInstance().isShortcutImeEnabled();
final int inputType = (editorInfo != null) ? editorInfo.inputType : 0;