diff options
| author | satok <satok@google.com> | 2011-09-02 04:44:41 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-02 04:44:41 -0700 |
| commit | bffb83e96c2f3d01bf42490737201ab4de79c91b (patch) | |
| tree | 4ea30ddba89c37b7a369773fc6532e4e0ac93bb3 /core/java/android | |
| parent | 1d477c53bf2f389813d04d5163d210fccf00ceb9 (diff) | |
| parent | a86f5e448cd6d29340ca6cbe509bc6384bc0d711 (diff) | |
| download | frameworks_base-bffb83e96c2f3d01bf42490737201ab4de79c91b.zip frameworks_base-bffb83e96c2f3d01bf42490737201ab4de79c91b.tar.gz frameworks_base-bffb83e96c2f3d01bf42490737201ab4de79c91b.tar.bz2 | |
Merge "Add an option for the implicitly selected subtype"
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/inputmethod/InputMethodInfo.java | 4 | ||||
| -rw-r--r-- | core/java/android/view/inputmethod/InputMethodSubtype.java | 34 |
2 files changed, 28 insertions, 10 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodInfo.java b/core/java/android/view/inputmethod/InputMethodInfo.java index 4ec4ff9..0119d03 100644 --- a/core/java/android/view/inputmethod/InputMethodInfo.java +++ b/core/java/android/view/inputmethod/InputMethodInfo.java @@ -164,7 +164,9 @@ public final class InputMethodInfo implements Parcelable { a.getString(com.android.internal.R.styleable .InputMethod_Subtype_imeSubtypeExtraValue), a.getBoolean(com.android.internal.R.styleable - .InputMethod_Subtype_isAuxiliary, false)); + .InputMethod_Subtype_isAuxiliary, false), + a.getBoolean(com.android.internal.R.styleable + .InputMethod_Subtype_overridesImplicitlyEnabledSubtype, false)); mSubtypes.add(subtype); } } diff --git a/core/java/android/view/inputmethod/InputMethodSubtype.java b/core/java/android/view/inputmethod/InputMethodSubtype.java index 8c51680..5670432 100644 --- a/core/java/android/view/inputmethod/InputMethodSubtype.java +++ b/core/java/android/view/inputmethod/InputMethodSubtype.java @@ -42,6 +42,7 @@ public final class InputMethodSubtype implements Parcelable { private static final String EXTRA_VALUE_KEY_VALUE_SEPARATOR = "="; private final boolean mIsAuxiliary; + private final boolean mOverridesImplicitlyEnabledSubtype; private final int mSubtypeHashCode; private final int mSubtypeIconResId; private final int mSubtypeNameResId; @@ -57,11 +58,12 @@ public final class InputMethodSubtype implements Parcelable { * @param locale The locale supported by the subtype * @param mode The mode supported by the subtype * @param extraValue The extra value of the subtype + * @param isAuxiliary true when this subtype is one shot subtype. * @hide */ - public InputMethodSubtype( - int nameId, int iconId, String locale, String mode, String extraValue) { - this(nameId, iconId, locale, mode, extraValue, false); + public InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue, + boolean isAuxiliary) { + this(nameId, iconId, locale, mode, extraValue, false, false); } /** @@ -72,18 +74,21 @@ public final class InputMethodSubtype implements Parcelable { * @param mode The mode supported by the subtype * @param extraValue The extra value of the subtype * @param isAuxiliary true when this subtype is one shot subtype. - * @hide + * @param overridesImplicitlyEnabledSubtype true when this subtype should be selected by default + * if no other subtypes are selected explicitly. Note that a subtype with this parameter being + * true will not be shown in the subtypes list. */ public InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue, - boolean isAuxiliary) { + boolean isAuxiliary, boolean overridesImplicitlyEnabledSubtype) { mSubtypeNameResId = nameId; mSubtypeIconResId = iconId; mSubtypeLocale = locale != null ? locale : ""; mSubtypeMode = mode != null ? mode : ""; mSubtypeExtraValue = extraValue != null ? extraValue : ""; mIsAuxiliary = isAuxiliary; + mOverridesImplicitlyEnabledSubtype = overridesImplicitlyEnabledSubtype; mSubtypeHashCode = hashCodeInternal(mSubtypeLocale, mSubtypeMode, mSubtypeExtraValue, - mIsAuxiliary); + mIsAuxiliary, mOverridesImplicitlyEnabledSubtype); } InputMethodSubtype(Parcel source) { @@ -97,8 +102,9 @@ public final class InputMethodSubtype implements Parcelable { s = source.readString(); mSubtypeExtraValue = s != null ? s : ""; mIsAuxiliary = (source.readInt() == 1); + mOverridesImplicitlyEnabledSubtype = (source.readInt() == 1); mSubtypeHashCode = hashCodeInternal(mSubtypeLocale, mSubtypeMode, mSubtypeExtraValue, - mIsAuxiliary); + mIsAuxiliary, mOverridesImplicitlyEnabledSubtype); } /** @@ -146,6 +152,14 @@ public final class InputMethodSubtype implements Parcelable { } /** + * @return true when this subtype is selected by default if no other subtypes are selected + * explicitly. Note that a subtype that returns true will not be shown in the subtypes list. + */ + public boolean overridesImplicitlyEnabledSubtype() { + return mOverridesImplicitlyEnabledSubtype; + } + + /** * @param context Context will be used for getting Locale and PackageManager. * @param packageName The package name of the IME * @param appInfo The application info of the IME @@ -244,6 +258,7 @@ public final class InputMethodSubtype implements Parcelable { dest.writeString(mSubtypeMode); dest.writeString(mSubtypeExtraValue); dest.writeInt(mIsAuxiliary ? 1 : 0); + dest.writeInt(mOverridesImplicitlyEnabledSubtype ? 1 : 0); } public static final Parcelable.Creator<InputMethodSubtype> CREATOR @@ -276,8 +291,9 @@ public final class InputMethodSubtype implements Parcelable { } private static int hashCodeInternal(String locale, String mode, String extraValue, - boolean isAuxiliary) { - return Arrays.hashCode(new Object[] {locale, mode, extraValue, isAuxiliary}); + boolean isAuxiliary, boolean overridesImplicitlyEnabledSubtype) { + return Arrays.hashCode(new Object[] {locale, mode, extraValue, isAuxiliary, + overridesImplicitlyEnabledSubtype}); } /** |
