aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat
diff options
context:
space:
mode:
authorsatok <satok@google.com>2010-12-27 20:41:52 +0900
committersatok <satok@google.com>2010-12-28 18:46:23 +0900
commit4aad61bd3677b744f641dcb408e753eec3494cc6 (patch)
treecb6721eff952c05c362afbc4994780140eda0721 /java/src/com/android/inputmethod/compat
parentd12def6dc8ba3a2f47b90e6d5d442f315152c6d4 (diff)
downloadlatinime-4aad61bd3677b744f641dcb408e753eec3494cc6.tar.gz
latinime-4aad61bd3677b744f641dcb408e753eec3494cc6.tar.xz
latinime-4aad61bd3677b744f641dcb408e753eec3494cc6.zip
Fix build breakage by removing HC APIs calls
Change-Id: I0cd4a52da00680f8d51a1417898fa283974726c4
Diffstat (limited to 'java/src/com/android/inputmethod/compat')
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodSubtype.java157
1 files changed, 157 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/compat/InputMethodSubtype.java b/java/src/com/android/inputmethod/compat/InputMethodSubtype.java
new file mode 100644
index 000000000..6630dbe75
--- /dev/null
+++ b/java/src/com/android/inputmethod/compat/InputMethodSubtype.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Note: This class has been copied from Honeycomb framework.
+// Original class in Honeycomb framework is {@link android.view.inputmethod.InputMethodSubtype}.
+
+package com.android.inputmethod.compat;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.Arrays;
+
+/**
+ * Information given to an {@link InputMethod} about a client connecting
+ * to it.
+ */
+/**
+ * InputMethodSubtype is a subtype contained in the input method. Subtype can describe
+ * locales (e.g. en_US, fr_FR...) and modes (e.g. voice, keyboard...), and is used for
+ * IME switch. The subtype allows the system to call the specified subtype of IME directly.
+ */
+public final class InputMethodSubtype implements Parcelable {
+ private final int mSubtypeNameResId;
+ private final int mSubtypeIconResId;
+ private final String mSubtypeLocale;
+ private final String mSubtypeMode;
+ private final String mSubtypeExtraValue;
+ private final int mSubtypeHashCode;
+
+ /**
+ * Constructor
+ * @param nameId The name of the subtype
+ * @param iconId The icon of the subtype
+ * @param locale The locale supported by the subtype
+ * @param modeId The mode supported by the subtype
+ * @param extraValue The extra value of the subtype
+ */
+ InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue) {
+ mSubtypeNameResId = nameId;
+ mSubtypeIconResId = iconId;
+ mSubtypeLocale = locale != null ? locale : "";
+ mSubtypeMode = mode != null ? mode : "";
+ mSubtypeExtraValue = extraValue != null ? extraValue : "";
+ mSubtypeHashCode = hashCodeInternal(mSubtypeNameResId, mSubtypeIconResId, mSubtypeLocale,
+ mSubtypeMode, mSubtypeExtraValue);
+ }
+
+ InputMethodSubtype(Parcel source) {
+ String s;
+ mSubtypeNameResId = source.readInt();
+ mSubtypeIconResId = source.readInt();
+ s = source.readString();
+ mSubtypeLocale = s != null ? s : "";
+ s = source.readString();
+ mSubtypeMode = s != null ? s : "";
+ s = source.readString();
+ mSubtypeExtraValue = s != null ? s : "";
+ mSubtypeHashCode = hashCodeInternal(mSubtypeNameResId, mSubtypeIconResId, mSubtypeLocale,
+ mSubtypeMode, mSubtypeExtraValue);
+ }
+
+ /**
+ * @return the name of the subtype
+ */
+ public int getNameResId() {
+ return mSubtypeNameResId;
+ }
+
+ /**
+ * @return the icon of the subtype
+ */
+ public int getIconResId() {
+ return mSubtypeIconResId;
+ }
+
+ /**
+ * @return the locale of the subtype
+ */
+ public String getLocale() {
+ return mSubtypeLocale;
+ }
+
+ /**
+ * @return the mode of the subtype
+ */
+ public String getMode() {
+ return mSubtypeMode;
+ }
+
+ /**
+ * @return the extra value of the subtype
+ */
+ public String getExtraValue() {
+ return mSubtypeExtraValue;
+ }
+
+ @Override
+ public int hashCode() {
+ return mSubtypeHashCode;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof InputMethodSubtype) {
+ InputMethodSubtype subtype = (InputMethodSubtype) o;
+ return (subtype.hashCode() == hashCode())
+ && (subtype.getNameResId() == getNameResId())
+ && (subtype.getMode().equals(getMode()))
+ && (subtype.getIconResId() == getIconResId())
+ && (subtype.getLocale().equals(getLocale()))
+ && (subtype.getExtraValue().equals(getExtraValue()));
+ }
+ return false;
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel dest, int parcelableFlags) {
+ dest.writeInt(mSubtypeNameResId);
+ dest.writeInt(mSubtypeIconResId);
+ dest.writeString(mSubtypeLocale);
+ dest.writeString(mSubtypeMode);
+ dest.writeString(mSubtypeExtraValue);
+ }
+
+ public static final Parcelable.Creator<InputMethodSubtype> CREATOR
+ = new Parcelable.Creator<InputMethodSubtype>() {
+ public InputMethodSubtype createFromParcel(Parcel source) {
+ return new InputMethodSubtype(source);
+ }
+
+ public InputMethodSubtype[] newArray(int size) {
+ return new InputMethodSubtype[size];
+ }
+ };
+
+ private static int hashCodeInternal(int nameResId, int iconResId, String locale,
+ String mode, String extraValue) {
+ return Arrays.hashCode(new Object[] {nameResId, iconResId, locale, mode, extraValue});
+ }
+}