aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java56
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/DictionarySettingsActivity.java4
-rw-r--r--java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java6
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java4
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java67
-rw-r--r--java/src/com/android/inputmethod/latin/Constants.java1
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java3
-rw-r--r--java/src/com/android/inputmethod/latin/about/AboutPreferences.java28
-rw-r--r--java/src/com/android/inputmethod/latin/settings/DebugSettingsActivity.java3
-rw-r--r--java/src/com/android/inputmethod/latin/settings/SettingsActivity.java4
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/SpellCheckerSettingsActivity.java4
-rw-r--r--java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java18
-rw-r--r--java/src/com/android/inputmethod/latin/utils/FragmentUtils.java52
13 files changed, 221 insertions, 29 deletions
diff --git a/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java b/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java
new file mode 100644
index 000000000..b119d6c82
--- /dev/null
+++ b/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package com.android.inputmethod.compat;
+
+import android.os.Build;
+import android.view.inputmethod.InputMethodSubtype;
+
+import java.lang.reflect.Constructor;
+
+public final class InputMethodSubtypeCompatUtils {
+ private static final String TAG = InputMethodSubtypeCompatUtils.class.getSimpleName();
+ // Note that InputMethodSubtype(int nameId, int iconId, String locale, String mode,
+ // String extraValue, boolean isAuxiliary, boolean overridesImplicitlyEnabledSubtype, int id)
+ // has been introduced in API level 17 (Build.VERSION_CODE.JELLY_BEAN_MR1).
+ private static final Constructor<?> CONSTRUCTOR_INPUT_METHOD_SUBTYPE =
+ CompatUtils.getConstructor(InputMethodSubtype.class,
+ Integer.TYPE, Integer.TYPE, String.class, String.class, String.class,
+ Boolean.TYPE, Boolean.TYPE, Integer.TYPE);
+ static {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null) {
+ android.util.Log.w(TAG, "Warning!!! Constructor is not defined.");
+ }
+ }
+ }
+ private InputMethodSubtypeCompatUtils() {
+ // This utility class is not publicly instantiable.
+ }
+
+ public static InputMethodSubtype newInputMethodSubtype(int nameId, int iconId, String locale,
+ String mode, String extraValue, boolean isAuxiliary,
+ boolean overridesImplicitlyEnabledSubtype, int id) {
+ if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null
+ || Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ return new InputMethodSubtype(nameId, iconId, locale, mode, extraValue, isAuxiliary,
+ overridesImplicitlyEnabledSubtype);
+ }
+ return (InputMethodSubtype) CompatUtils.newInstance(CONSTRUCTOR_INPUT_METHOD_SUBTYPE,
+ nameId, iconId, locale, mode, extraValue, isAuxiliary,
+ overridesImplicitlyEnabledSubtype, id);
+ }
+}
diff --git a/java/src/com/android/inputmethod/dictionarypack/DictionarySettingsActivity.java b/java/src/com/android/inputmethod/dictionarypack/DictionarySettingsActivity.java
index c28d72949..4366348d5 100644
--- a/java/src/com/android/inputmethod/dictionarypack/DictionarySettingsActivity.java
+++ b/java/src/com/android/inputmethod/dictionarypack/DictionarySettingsActivity.java
@@ -16,6 +16,8 @@
package com.android.inputmethod.dictionarypack;
+import com.android.inputmethod.latin.utils.FragmentUtils;
+
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceActivity;
@@ -45,6 +47,6 @@ public final class DictionarySettingsActivity extends PreferenceActivity {
// TODO: Uncomment the override annotation once we start using SDK version 19.
// @Override
public boolean isValidFragment(String fragmentName) {
- return fragmentName.equals(DEFAULT_FRAGMENT);
+ return FragmentUtils.isValidFragment(fragmentName);
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java b/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
index 4f5961175..9779c683c 100644
--- a/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
+++ b/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
@@ -84,6 +84,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
private TabHost mTabHost;
private ViewPager mEmojiPager;
+ private int mCurrentPagerPosition = 0;
private EmojiCategoryPageIndicatorView mEmojiCategoryPageIndicatorView;
private KeyboardActionListener mKeyboardActionListener = KeyboardActionListener.EMPTY_LISTENER;
@@ -507,6 +508,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
setCurrentCategoryId(newPos.first /* categoryId */, false /* force */);
mEmojiCategory.setCurrentCategoryPageId(newPos.second /* categoryPageId */);
updateEmojiCategoryPageIdView();
+ mCurrentPagerPosition = position;
}
@Override
@@ -569,15 +571,17 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
public void startEmojiPalettes() {
if (DEBUG_PAGER) {
- Log.d(TAG, "allocate emoji palettes memory");
+ Log.d(TAG, "allocate emoji palettes memory " + mCurrentPagerPosition);
}
mEmojiPager.setAdapter(mEmojiPalettesAdapter);
+ mEmojiPager.setCurrentItem(mCurrentPagerPosition);
}
public void stopEmojiPalettes() {
if (DEBUG_PAGER) {
Log.d(TAG, "deallocate emoji palettes memory");
}
+ mEmojiPalettesAdapter.flushPendingRecentKeys();
mEmojiPager.setAdapter(null);
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java b/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java
index 09766ac6c..3133e54be 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java
@@ -184,12 +184,12 @@ public class DynamicGridKeyboard extends Keyboard {
private int getKeyY0(final int index) {
final int row = index / mColumnsNum;
- return row * mVerticalStep;
+ return row * mVerticalStep + mVerticalGap / 2;
}
private int getKeyY1(final int index) {
final int row = index / mColumnsNum + 1;
- return row * mVerticalStep;
+ return row * mVerticalStep + mVerticalGap / 2;
}
@Override
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
index d219e8195..e769e3cdd 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
@@ -278,7 +278,7 @@ public final class KeyboardTextsSet {
/* 50 */ "\u00A2,\u00A3,\u20AC,\u00A5,\u20B1",
/* 51 */ "$",
/* 52 */ "$,\u00A2,\u20AC,\u00A3,\u00A5,\u20B1",
- /* 53 */ "!fixedColumnOrder!3,!,\\,,?,:,;,@",
+ /* 53 */ "!fixedColumnOrder!4,#,!,\\,,?,-,:,',@",
// U+2020: "†" DAGGER
// U+2021: "‡" DOUBLE DAGGER
// U+2605: "★" BLACK STAR
@@ -2895,33 +2895,69 @@ public final class KeyboardTextsSet {
/* Language sv: Swedish */
private static final String[] LANGUAGE_sv = {
- /* 0 */ null,
+ // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
+ // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+ // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
+ // U+0105: "ą" LATIN SMALL LETTER A WITH OGONEK
+ // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
+ /* 0 */ "\u00E1,\u00E0,\u00E2,\u0105,\u00E3",
// U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
// U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
// U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
// U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
// U+0119: "ę" LATIN SMALL LETTER E WITH OGONEK
/* 1 */ "\u00E9,\u00E8,\u00EA,\u00EB,\u0119",
- /* 2 */ null,
- // U+0153: "œ" LATIN SMALL LIGATURE OE
- // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
- // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+ // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+ // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
+ // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+ // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
+ /* 2 */ "\u00ED,\u00EC,\u00EE,\u00EF",
// U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+ // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+ // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
// U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
// U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
- /* 3 */ "\u0153,\u00F4,\u00F2,\u00F3,\u00F5,\u014D",
+ /* 3 */ "\u00F3,\u00F2,\u00F4,\u00F5,\u014D",
// U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
- // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
- // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
// U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+ // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
+ // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
// U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
- /* 4 */ "\u00FC,\u00FB,\u00F9,\u00FA,\u016B",
- // U+00DF: "ß" LATIN SMALL LETTER SHARP S
+ /* 4 */ "\u00FC,\u00FA,\u00F9,\u00FB,\u016B",
// U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE
// U+0161: "š" LATIN SMALL LETTER S WITH CARON
- /* 5 */ "\u00DF,\u015B,\u0161",
- /* 6~ */
- null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+ // U+015F: "ş" LATIN SMALL LETTER S WITH CEDILLA
+ // U+00DF: "ß" LATIN SMALL LETTER SHARP S
+ /* 5 */ "\u015B,\u0161,\u015F,\u00DF",
+ // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE
+ // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
+ // U+0148: "ň" LATIN SMALL LETTER N WITH CARON
+ /* 6 */ "\u0144,\u00F1,\u0148",
+ // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
+ // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE
+ // U+010D: "č" LATIN SMALL LETTER C WITH CARON
+ /* 7 */ "\u00E7,\u0107,\u010D",
+ // U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE
+ // U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS
+ // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+ /* 8 */ "\u00FD,\u00FF,\u00FC",
+ // U+00F0: "ð" LATIN SMALL LETTER ETH
+ // U+010F: "ď" LATIN SMALL LETTER D WITH CARON
+ /* 9 */ "\u00F0,\u010F",
+ // U+0159: "ř" LATIN SMALL LETTER R WITH CARON
+ /* 10 */ "\u0159",
+ // U+0165: "ť" LATIN SMALL LETTER T WITH CARON
+ // U+00FE: "þ" LATIN SMALL LETTER THORN
+ /* 11 */ "\u0165,\u00FE",
+ // U+017A: "ź" LATIN SMALL LETTER Z WITH ACUTE
+ // U+017E: "ž" LATIN SMALL LETTER Z WITH CARON
+ // U+017C: "ż" LATIN SMALL LETTER Z WITH DOT ABOVE
+ /* 12 */ "\u017A,\u017E,\u017C",
+ /* 13 */ null,
+ // U+0142: "ł" LATIN SMALL LETTER L WITH STROKE
+ /* 14 */ "\u0142",
+ /* 15~ */
+ null, null, null, null, null,
/* ~19 */
// U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
/* 20 */ "\u00E5",
@@ -2930,7 +2966,8 @@ public final class KeyboardTextsSet {
// U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
/* 22 */ "\u00E4",
// U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
- /* 23 */ "\u00F8",
+ // U+0153: "œ" LATIN SMALL LIGATURE OE
+ /* 23 */ "\u00F8,\u0153",
// U+00E6: "æ" LATIN SMALL LETTER AE
/* 24 */ "\u00E6",
/* 25~ */
diff --git a/java/src/com/android/inputmethod/latin/Constants.java b/java/src/com/android/inputmethod/latin/Constants.java
index c4f96016c..9a9653094 100644
--- a/java/src/com/android/inputmethod/latin/Constants.java
+++ b/java/src/com/android/inputmethod/latin/Constants.java
@@ -174,6 +174,7 @@ public final class Constants {
public static final int CODE_SLASH = '/';
public static final int CODE_COMMERCIAL_AT = '@';
public static final int CODE_PLUS = '+';
+ public static final int CODE_PERCENT = '%';
public static final int CODE_CLOSING_PARENTHESIS = ')';
public static final int CODE_CLOSING_SQUARE_BRACKET = ']';
public static final int CODE_CLOSING_CURLY_BRACKET = '}';
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index ccdbd0d4d..46b75121a 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1503,6 +1503,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|| codePoint == Constants.CODE_CLOSING_CURLY_BRACKET
|| codePoint == Constants.CODE_CLOSING_ANGLE_BRACKET
|| codePoint == Constants.CODE_PLUS
+ || codePoint == Constants.CODE_PERCENT
|| Character.getType(codePoint) == Character.OTHER_SYMBOL;
}
@@ -2305,9 +2306,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (!mRecapitalizeStatus.isSetAt(mLastSelectionStart, mLastSelectionEnd)) {
mLastSelectionStart = mRecapitalizeStatus.getNewCursorStart();
mLastSelectionEnd = mRecapitalizeStatus.getNewCursorEnd();
- mConnection.setSelection(mLastSelectionStart, mLastSelectionEnd);
}
}
+ mConnection.finishComposingText();
mRecapitalizeStatus.rotate();
final int numCharsDeleted = mLastSelectionEnd - mLastSelectionStart;
mConnection.setSelection(mLastSelectionEnd, mLastSelectionEnd);
diff --git a/java/src/com/android/inputmethod/latin/about/AboutPreferences.java b/java/src/com/android/inputmethod/latin/about/AboutPreferences.java
new file mode 100644
index 000000000..f60b189f1
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/about/AboutPreferences.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package com.android.inputmethod.latin.about;
+
+import android.app.Fragment;
+
+/**
+ * Dummy class of AboutPreferences. Never use this.
+ */
+public final class AboutPreferences extends Fragment {
+ private AboutPreferences() {
+ // Prevents this from being instantiated
+ }
+}
diff --git a/java/src/com/android/inputmethod/latin/settings/DebugSettingsActivity.java b/java/src/com/android/inputmethod/latin/settings/DebugSettingsActivity.java
index ef6ab2a38..a23e37795 100644
--- a/java/src/com/android/inputmethod/latin/settings/DebugSettingsActivity.java
+++ b/java/src/com/android/inputmethod/latin/settings/DebugSettingsActivity.java
@@ -21,6 +21,7 @@ import android.os.Bundle;
import android.preference.PreferenceActivity;
import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.utils.FragmentUtils;
public final class DebugSettingsActivity extends PreferenceActivity {
private static final String DEFAULT_FRAGMENT = DebugSettings.class.getName();
@@ -42,6 +43,6 @@ public final class DebugSettingsActivity extends PreferenceActivity {
// TODO: Uncomment the override annotation once we start using SDK version 19.
// @Override
public boolean isValidFragment(String fragmentName) {
- return fragmentName.equals(DEFAULT_FRAGMENT);
+ return FragmentUtils.isValidFragment(fragmentName);
}
}
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsActivity.java b/java/src/com/android/inputmethod/latin/settings/SettingsActivity.java
index ad68f8c37..c899507e3 100644
--- a/java/src/com/android/inputmethod/latin/settings/SettingsActivity.java
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsActivity.java
@@ -16,6 +16,8 @@
package com.android.inputmethod.latin.settings;
+import com.android.inputmethod.latin.utils.FragmentUtils;
+
import android.content.Intent;
import android.preference.PreferenceActivity;
@@ -36,6 +38,6 @@ public final class SettingsActivity extends PreferenceActivity {
// TODO: Uncomment the override annotation once we start using SDK version 19.
// @Override
public boolean isValidFragment(String fragmentName) {
- return fragmentName.equals(DEFAULT_FRAGMENT);
+ return FragmentUtils.isValidFragment(fragmentName);
}
}
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/SpellCheckerSettingsActivity.java b/java/src/com/android/inputmethod/latin/spellcheck/SpellCheckerSettingsActivity.java
index aba563746..df9a76119 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/SpellCheckerSettingsActivity.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/SpellCheckerSettingsActivity.java
@@ -16,6 +16,8 @@
package com.android.inputmethod.latin.spellcheck;
+import com.android.inputmethod.latin.utils.FragmentUtils;
+
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceActivity;
@@ -42,6 +44,6 @@ public final class SpellCheckerSettingsActivity extends PreferenceActivity {
// TODO: Uncomment the override annotation once we start using SDK version 19.
// @Override
public boolean isValidFragment(String fragmentName) {
- return fragmentName.equals(DEFAULT_FRAGMENT);
+ return FragmentUtils.isValidFragment(fragmentName);
}
}
diff --git a/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java b/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java
index ff332cdee..d87f6f3c4 100644
--- a/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java
@@ -25,6 +25,7 @@ import android.os.Build;
import android.text.TextUtils;
import android.view.inputmethod.InputMethodSubtype;
+import com.android.inputmethod.compat.InputMethodSubtypeCompatUtils;
import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.R;
@@ -143,12 +144,17 @@ public final class AdditionalSubtypeUtils {
// from the current users. So, you should be really careful to change it.
final int subtypeId = getInputMethodSubtypeId(nameId, localeString, layoutExtraValue,
additionalSubtypeExtraValue);
- // TODO: Use InputMethodSubtypeBuilder once we use SDK version 19.
- return new InputMethodSubtype(nameId, R.drawable.ic_ime_switcher_dark,
- localeString, KEYBOARD_MODE, layoutExtraValue + "," + additionalSubtypeExtraValue
- + "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE
- + "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE, false, false,
- subtypeId);
+ final String extraValue;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ extraValue = layoutExtraValue + "," + additionalSubtypeExtraValue
+ + "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE
+ + "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
+ } else {
+ extraValue = layoutExtraValue + "," + additionalSubtypeExtraValue;
+ }
+ return InputMethodSubtypeCompatUtils.newInputMethodSubtype(nameId,
+ R.drawable.ic_ime_switcher_dark, localeString, KEYBOARD_MODE, extraValue,
+ false, false, subtypeId);
}
private static int getInputMethodSubtypeId(int nameId, String localeString,
diff --git a/java/src/com/android/inputmethod/latin/utils/FragmentUtils.java b/java/src/com/android/inputmethod/latin/utils/FragmentUtils.java
new file mode 100644
index 000000000..ee2b97b2a
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/utils/FragmentUtils.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package com.android.inputmethod.latin.utils;
+
+import com.android.inputmethod.dictionarypack.DictionarySettingsFragment;
+import com.android.inputmethod.latin.about.AboutPreferences;
+import com.android.inputmethod.latin.settings.AdditionalSubtypeSettings;
+import com.android.inputmethod.latin.settings.DebugSettings;
+import com.android.inputmethod.latin.settings.SettingsFragment;
+import com.android.inputmethod.latin.spellcheck.SpellCheckerSettingsFragment;
+import com.android.inputmethod.latin.userdictionary.UserDictionaryAddWordFragment;
+import com.android.inputmethod.latin.userdictionary.UserDictionaryList;
+import com.android.inputmethod.latin.userdictionary.UserDictionaryLocalePicker;
+import com.android.inputmethod.latin.userdictionary.UserDictionarySettings;
+import com.android.inputmethod.research.FeedbackFragment;
+
+import java.util.HashSet;
+
+public class FragmentUtils {
+ private static final HashSet<String> sLatinImeFragments = new HashSet<String>();
+ static {
+ sLatinImeFragments.add(DictionarySettingsFragment.class.getName());
+ sLatinImeFragments.add(AboutPreferences.class.getName());
+ sLatinImeFragments.add(AdditionalSubtypeSettings.class.getName());
+ sLatinImeFragments.add(DebugSettings.class.getName());
+ sLatinImeFragments.add(SettingsFragment.class.getName());
+ sLatinImeFragments.add(SpellCheckerSettingsFragment.class.getName());
+ sLatinImeFragments.add(UserDictionaryAddWordFragment.class.getName());
+ sLatinImeFragments.add(UserDictionaryList.class.getName());
+ sLatinImeFragments.add(UserDictionaryLocalePicker.class.getName());
+ sLatinImeFragments.add(UserDictionarySettings.class.getName());
+ sLatinImeFragments.add(FeedbackFragment.class.getName());
+ }
+
+ public static boolean isValidFragment(String fragmentName) {
+ return sLatinImeFragments.contains(fragmentName);
+ }
+}