Remove unused supportsSwitchingToShortcutIme attribute
Change-Id: I51c5247ac925a158facb79057f704b763b903552
This commit is contained in:
parent
b7206b6bca
commit
3ca65c8fd5
11 changed files with 49 additions and 51 deletions
|
@ -437,7 +437,6 @@
|
|||
<attr name="navigatePrevious" format="boolean" />
|
||||
<attr name="passwordInput" format="boolean" />
|
||||
<attr name="clobberSettingsKey" format="boolean" />
|
||||
<attr name="supportsSwitchingToShortcutIme" format="boolean" />
|
||||
<attr name="hasShortcutKey" format="boolean" />
|
||||
<attr name="languageSwitchKeyEnabled" format="boolean" />
|
||||
<attr name="isMultiLine" format="boolean" />
|
||||
|
|
|
@ -70,7 +70,6 @@ public final class KeyboardId {
|
|||
public final int mElementId;
|
||||
public final EditorInfo mEditorInfo;
|
||||
public final boolean mClobberSettingsKey;
|
||||
public final boolean mSupportsSwitchingToShortcutIme;
|
||||
public final boolean mLanguageSwitchKeyEnabled;
|
||||
public final String mCustomActionLabel;
|
||||
public final boolean mHasShortcutKey;
|
||||
|
@ -86,11 +85,10 @@ public final class KeyboardId {
|
|||
mElementId = elementId;
|
||||
mEditorInfo = params.mEditorInfo;
|
||||
mClobberSettingsKey = params.mNoSettingsKey;
|
||||
mSupportsSwitchingToShortcutIme = params.mSupportsSwitchingToShortcutIme;
|
||||
mLanguageSwitchKeyEnabled = params.mLanguageSwitchKeyEnabled;
|
||||
mCustomActionLabel = (mEditorInfo.actionLabel != null)
|
||||
? mEditorInfo.actionLabel.toString() : null;
|
||||
mHasShortcutKey = mSupportsSwitchingToShortcutIme && params.mShowsVoiceInputKey;
|
||||
mHasShortcutKey = params.mVoiceInputKeyEnabled;
|
||||
|
||||
mHashCode = computeHashCode(this);
|
||||
}
|
||||
|
@ -103,7 +101,6 @@ public final class KeyboardId {
|
|||
id.mHeight,
|
||||
id.passwordInput(),
|
||||
id.mClobberSettingsKey,
|
||||
id.mSupportsSwitchingToShortcutIme,
|
||||
id.mHasShortcutKey,
|
||||
id.mLanguageSwitchKeyEnabled,
|
||||
id.isMultiLine(),
|
||||
|
@ -124,7 +121,6 @@ public final class KeyboardId {
|
|||
&& other.mHeight == mHeight
|
||||
&& other.passwordInput() == passwordInput()
|
||||
&& other.mClobberSettingsKey == mClobberSettingsKey
|
||||
&& other.mSupportsSwitchingToShortcutIme == mSupportsSwitchingToShortcutIme
|
||||
&& other.mHasShortcutKey == mHasShortcutKey
|
||||
&& other.mLanguageSwitchKeyEnabled == mLanguageSwitchKeyEnabled
|
||||
&& other.isMultiLine() == isMultiLine()
|
||||
|
@ -179,7 +175,7 @@ public final class KeyboardId {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(Locale.ROOT, "[%s %s:%s %dx%d %s %s%s%s%s%s%s%s%s%s]",
|
||||
return String.format(Locale.ROOT, "[%s %s:%s %dx%d %s %s%s%s%s%s%s%s%s]",
|
||||
elementIdToName(mElementId),
|
||||
mLocale, mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET),
|
||||
mWidth, mHeight,
|
||||
|
@ -189,7 +185,6 @@ public final class KeyboardId {
|
|||
(navigatePrevious() ? " navigatePrevious" : ""),
|
||||
(mClobberSettingsKey ? " clobberSettingsKey" : ""),
|
||||
(passwordInput() ? " passwordInput" : ""),
|
||||
(mSupportsSwitchingToShortcutIme ? " supportsSwitchingToShortcutIme" : ""),
|
||||
(mHasShortcutKey ? " hasShortcutKey" : ""),
|
||||
(mLanguageSwitchKeyEnabled ? " languageSwitchKeyEnabled" : ""),
|
||||
(isMultiLine() ? " isMultiLine" : "")
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
package com.android.inputmethod.keyboard;
|
||||
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.FORCE_ASCII;
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE;
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE_COMPAT;
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_SETTINGS_KEY;
|
||||
|
||||
import android.content.Context;
|
||||
|
@ -102,12 +100,11 @@ public final class KeyboardLayoutSet {
|
|||
public static final class Params {
|
||||
String mKeyboardLayoutSetName;
|
||||
int mMode;
|
||||
EditorInfo mEditorInfo;
|
||||
boolean mDisableTouchPositionCorrectionDataForTest;
|
||||
// TODO: Use {@link InputAttributes} instead of these variables.
|
||||
EditorInfo mEditorInfo;
|
||||
boolean mIsPasswordField;
|
||||
boolean mSupportsSwitchingToShortcutIme;
|
||||
boolean mShowsVoiceInputKey;
|
||||
boolean mNoMicrophoneKey;
|
||||
boolean mVoiceInputKeyEnabled;
|
||||
boolean mNoSettingsKey;
|
||||
boolean mLanguageSwitchKeyEnabled;
|
||||
InputMethodSubtype mSubtype;
|
||||
|
@ -228,14 +225,9 @@ public final class KeyboardLayoutSet {
|
|||
|
||||
final EditorInfo editorInfo = (ei != null) ? ei : EMPTY_EDITOR_INFO;
|
||||
params.mMode = getKeyboardMode(editorInfo);
|
||||
// TODO: Consolidate those with {@link InputAttributes}.
|
||||
params.mEditorInfo = editorInfo;
|
||||
params.mIsPasswordField = InputTypeUtils.isPasswordInputType(editorInfo.inputType);
|
||||
@SuppressWarnings("deprecation")
|
||||
final boolean deprecatedNoMicrophone = InputAttributes.inPrivateImeOptions(
|
||||
null, NO_MICROPHONE_COMPAT, editorInfo);
|
||||
params.mNoMicrophoneKey = InputAttributes.inPrivateImeOptions(
|
||||
mPackageName, NO_MICROPHONE, editorInfo)
|
||||
|| deprecatedNoMicrophone;
|
||||
params.mNoSettingsKey = InputAttributes.inPrivateImeOptions(
|
||||
mPackageName, NO_SETTINGS_KEY, editorInfo);
|
||||
}
|
||||
|
@ -248,6 +240,7 @@ public final class KeyboardLayoutSet {
|
|||
|
||||
public Builder setSubtype(final InputMethodSubtype subtype) {
|
||||
final boolean asciiCapable = InputMethodSubtypeCompatUtils.isAsciiCapable(subtype);
|
||||
// TODO: Consolidate with {@link InputAttributes}.
|
||||
@SuppressWarnings("deprecation")
|
||||
final boolean deprecatedForceAscii = InputAttributes.inPrivateImeOptions(
|
||||
mPackageName, FORCE_ASCII, mParams.mEditorInfo);
|
||||
|
@ -268,12 +261,13 @@ public final class KeyboardLayoutSet {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setOptions(final boolean isShortcutImeEnabled,
|
||||
final boolean showsVoiceInputKey, final boolean languageSwitchKeyEnabled) {
|
||||
mParams.mSupportsSwitchingToShortcutIme =
|
||||
isShortcutImeEnabled && !mParams.mNoMicrophoneKey && !mParams.mIsPasswordField;
|
||||
mParams.mShowsVoiceInputKey = showsVoiceInputKey;
|
||||
mParams.mLanguageSwitchKeyEnabled = languageSwitchKeyEnabled;
|
||||
public Builder setVoiceInputKeyEnabled(final boolean enabled) {
|
||||
mParams.mVoiceInputKeyEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setLanguageSwitchKeyEnabled(final boolean enabled) {
|
||||
mParams.mLanguageSwitchKeyEnabled = enabled;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,10 +115,10 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
|||
final int keyboardHeight = ResourceUtils.getDefaultKeyboardHeight(res);
|
||||
builder.setKeyboardGeometry(keyboardWidth, keyboardHeight);
|
||||
builder.setSubtype(mSubtypeSwitcher.getCurrentSubtype());
|
||||
builder.setOptions(
|
||||
mSubtypeSwitcher.isShortcutImeEnabled(),
|
||||
settingsValues.mShowsVoiceInputKey,
|
||||
mLatinIME.shouldShowLanguageSwitchKey());
|
||||
builder.setVoiceInputKeyEnabled(mSubtypeSwitcher.isShortcutImeEnabled()
|
||||
&& settingsValues.mShowsVoiceInputKey
|
||||
&& !settingsValues.mInputAttributes.hasNoMicrophoneKeyOption());
|
||||
builder.setLanguageSwitchKeyEnabled(mLatinIME.shouldShowLanguageSwitchKey());
|
||||
mKeyboardLayoutSet = builder.build();
|
||||
mCurrentSettingsValues = settingsValues;
|
||||
try {
|
||||
|
|
|
@ -115,8 +115,6 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
|||
builder.setSubtype(SubtypeSwitcher.getInstance().getEmojiSubtype());
|
||||
builder.setKeyboardGeometry(ResourceUtils.getDefaultKeyboardWidth(res),
|
||||
mEmojiLayoutParams.mEmojiKeyboardHeight);
|
||||
builder.setOptions(false /* shortcutImeEnabled */, false /* showsVoiceInputKey */,
|
||||
false /* languageSwitchKeyEnabled */);
|
||||
final KeyboardLayoutSet layoutSet = builder.build();
|
||||
final TypedArray emojiPalettesViewAttr = context.obtainStyledAttributes(attrs,
|
||||
R.styleable.EmojiPalettesView, defStyle, R.style.EmojiPalettesView);
|
||||
|
|
|
@ -652,9 +652,6 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
|||
R.styleable.Keyboard_Case_passwordInput, id.passwordInput());
|
||||
final boolean clobberSettingsKeyMatched = matchBoolean(caseAttr,
|
||||
R.styleable.Keyboard_Case_clobberSettingsKey, id.mClobberSettingsKey);
|
||||
final boolean supportsSwitchingToShortcutImeMatched = matchBoolean(caseAttr,
|
||||
R.styleable.Keyboard_Case_supportsSwitchingToShortcutIme,
|
||||
id.mSupportsSwitchingToShortcutIme);
|
||||
final boolean hasShortcutKeyMatched = matchBoolean(caseAttr,
|
||||
R.styleable.Keyboard_Case_hasShortcutKey, id.mHasShortcutKey);
|
||||
final boolean languageSwitchKeyEnabledMatched = matchBoolean(caseAttr,
|
||||
|
@ -674,14 +671,13 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
|||
R.styleable.Keyboard_Case_countryCode, id.mLocale.getCountry());
|
||||
final boolean selected = keyboardLayoutSetMatched && keyboardLayoutSetElementMatched
|
||||
&& modeMatched && navigateNextMatched && navigatePreviousMatched
|
||||
&& passwordInputMatched && clobberSettingsKeyMatched
|
||||
&& supportsSwitchingToShortcutImeMatched && hasShortcutKeyMatched
|
||||
&& passwordInputMatched && clobberSettingsKeyMatched && hasShortcutKeyMatched
|
||||
&& languageSwitchKeyEnabledMatched && isMultiLineMatched && imeActionMatched
|
||||
&& isIconDefinedMatched && localeCodeMatched && languageCodeMatched
|
||||
&& countryCodeMatched;
|
||||
|
||||
if (DEBUG) {
|
||||
startTag("<%s%s%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%s%s>%s", TAG_CASE,
|
||||
textAttr(caseAttr.getString(
|
||||
R.styleable.Keyboard_Case_keyboardLayoutSet), "keyboardLayoutSet"),
|
||||
textAttr(caseAttr.getString(
|
||||
|
@ -698,9 +694,6 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
|||
"clobberSettingsKey"),
|
||||
booleanAttr(caseAttr, R.styleable.Keyboard_Case_passwordInput,
|
||||
"passwordInput"),
|
||||
booleanAttr(
|
||||
caseAttr, R.styleable.Keyboard_Case_supportsSwitchingToShortcutIme,
|
||||
"supportsSwitchingToShortcutIme"),
|
||||
booleanAttr(caseAttr, R.styleable.Keyboard_Case_hasShortcutKey,
|
||||
"hasShortcutKey"),
|
||||
booleanAttr(caseAttr, R.styleable.Keyboard_Case_languageSwitchKeyEnabled,
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE;
|
||||
import static com.android.inputmethod.latin.Constants.ImeOption.NO_MICROPHONE_COMPAT;
|
||||
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
|
@ -39,8 +42,13 @@ public final class InputAttributes {
|
|||
final public boolean mApplicationSpecifiedCompletionOn;
|
||||
final public boolean mShouldInsertSpacesAutomatically;
|
||||
final private int mInputType;
|
||||
final private EditorInfo mEditorInfo;
|
||||
final private String mPackageNameForPrivateImeOptions;
|
||||
|
||||
public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode) {
|
||||
public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode,
|
||||
final String packageNameForPrivateImeOptions) {
|
||||
mEditorInfo = editorInfo;
|
||||
mPackageNameForPrivateImeOptions = packageNameForPrivateImeOptions;
|
||||
mTargetApplicationPackageName = null != editorInfo ? editorInfo.packageName : null;
|
||||
final int inputType = null != editorInfo ? editorInfo.inputType : 0;
|
||||
final int inputClass = inputType & InputType.TYPE_MASK_CLASS;
|
||||
|
@ -111,6 +119,15 @@ public final class InputAttributes {
|
|||
return editorInfo.inputType == mInputType;
|
||||
}
|
||||
|
||||
public boolean hasNoMicrophoneKeyOption() {
|
||||
@SuppressWarnings("deprecation")
|
||||
final boolean deprecatedNoMicrophone = InputAttributes.inPrivateImeOptions(
|
||||
null, NO_MICROPHONE_COMPAT, mEditorInfo);
|
||||
final boolean noMicrophone = InputAttributes.inPrivateImeOptions(
|
||||
mPackageNameForPrivateImeOptions, NO_MICROPHONE, mEditorInfo);
|
||||
return noMicrophone || deprecatedNoMicrophone;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void dumpFlags(final int inputType) {
|
||||
final int inputClass = inputType & InputType.TYPE_MASK_CLASS;
|
||||
|
|
|
@ -522,7 +522,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
void loadSettings() {
|
||||
final Locale locale = mSubtypeSwitcher.getCurrentSubtypeLocale();
|
||||
final EditorInfo editorInfo = getCurrentInputEditorInfo();
|
||||
final InputAttributes inputAttributes = new InputAttributes(editorInfo, isFullscreenMode());
|
||||
final InputAttributes inputAttributes = new InputAttributes(
|
||||
editorInfo, isFullscreenMode(), getPackageName());
|
||||
mSettings.loadSettings(this, locale, inputAttributes);
|
||||
final SettingsValues currentSettingsValues = mSettings.getCurrent();
|
||||
AudioAndHapticFeedbackManager.getInstance().onSettingsChanged(currentSettingsValues);
|
||||
|
|
|
@ -109,7 +109,8 @@ public final class SettingsValues {
|
|||
|
||||
// Store the input attributes
|
||||
if (null == inputAttributes) {
|
||||
mInputAttributes = new InputAttributes(null, false /* isFullscreenMode */);
|
||||
mInputAttributes = new InputAttributes(
|
||||
null, false /* isFullscreenMode */, context.getPackageName());
|
||||
} else {
|
||||
mInputAttributes = inputAttributes;
|
||||
}
|
||||
|
|
|
@ -114,13 +114,13 @@ public abstract class KeyboardLayoutSetTestsBase extends AndroidTestCase {
|
|||
|
||||
protected final KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
|
||||
final EditorInfo editorInfo) {
|
||||
return createKeyboardLayoutSet(subtype, editorInfo, false /* isShortcutImeEnabled */,
|
||||
false /* showsVoiceInputKey */, false /* isLanguageSwitchKeyEnabled */);
|
||||
return createKeyboardLayoutSet(subtype, editorInfo, false /* voiceInputKeyEnabled */,
|
||||
false /* languageSwitchKeyEnabled */);
|
||||
}
|
||||
|
||||
protected final KeyboardLayoutSet createKeyboardLayoutSet(final InputMethodSubtype subtype,
|
||||
final EditorInfo editorInfo, final boolean isShortcutImeEnabled,
|
||||
final boolean showsVoiceInputKey, final boolean isLanguageSwitchKeyEnabled) {
|
||||
final EditorInfo editorInfo, final boolean voiceInputKeyEnabled,
|
||||
final boolean languageSwitchKeyEnabled) {
|
||||
final Context context = mThemeContext;
|
||||
final Resources res = context.getResources();
|
||||
final int keyboardWidth = ResourceUtils.getDefaultKeyboardWidth(res);
|
||||
|
@ -128,7 +128,8 @@ public abstract class KeyboardLayoutSetTestsBase extends AndroidTestCase {
|
|||
final Builder builder = new Builder(context, editorInfo);
|
||||
builder.setKeyboardGeometry(keyboardWidth, keyboardHeight)
|
||||
.setSubtype(subtype)
|
||||
.setOptions(isShortcutImeEnabled, showsVoiceInputKey, isLanguageSwitchKeyEnabled);
|
||||
.setVoiceInputKeyEnabled(voiceInputKeyEnabled)
|
||||
.setLanguageSwitchKeyEnabled(languageSwitchKeyEnabled);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,7 @@ abstract class LayoutTestsBase extends KeyboardLayoutSetTestsBase {
|
|||
+ (isPhone() ? "phone" : "tablet");
|
||||
// TODO: Test with language switch key enabled and disabled.
|
||||
mKeyboardLayoutSet = createKeyboardLayoutSet(mSubtype, null /* editorInfo */,
|
||||
true /* isShortcutImeEnabled */, true /* showsVoiceInputKey */,
|
||||
true /* isLanguageSwitchKeyEnabled */);
|
||||
true /* voiceInputKeyEnabled */, true /* languageSwitchKeyEnabled */);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue