From 77e0fa1d6708fa53549d80fcd2035da5a30e4140 Mon Sep 17 00:00:00 2001 From: Dan Zivkovic Date: Thu, 29 Jan 2015 14:45:24 -0800 Subject: [PATCH] LatinIME portion of multi-lang option removal. Bug 19188067. Change-Id: Ic9a3637f59dda30c699141222b9dcac3cd624b99 --- .../latin/common/NativeSuggestOptions.java | 13 +----- java/res/xml/prefs.xml | 4 -- java/res/xml/prefs_screen_multilingual.xml | 34 --------------- .../inputmethod/latin/BinaryDictionary.java | 2 - .../inputmethod/latin/DicTraverseSession.java | 4 +- .../latin/RichInputMethodManager.java | 18 -------- .../latin/inputlogic/InputLogic.java | 3 +- .../settings/AdvancedSettingsFragment.java | 2 - .../MultiLingualSettingsFragment.java | 41 ------------------- .../inputmethod/latin/settings/Settings.java | 20 --------- .../latin/settings/SettingsFragment.java | 5 --- .../latin/settings/SettingsValues.java | 8 ---- .../settings/SettingsValuesForSuggestion.java | 4 +- .../AndroidSpellCheckerService.java | 3 +- ...terCheckingExactMatchesAndSuggestions.java | 3 +- .../latin/utils/FragmentUtils.java | 2 - 16 files changed, 7 insertions(+), 159 deletions(-) delete mode 100644 java/res/xml/prefs_screen_multilingual.xml delete mode 100644 java/src/com/android/inputmethod/latin/settings/MultiLingualSettingsFragment.java diff --git a/common/src/com/android/inputmethod/latin/common/NativeSuggestOptions.java b/common/src/com/android/inputmethod/latin/common/NativeSuggestOptions.java index 7ef741cc2..db21f11ef 100644 --- a/common/src/com/android/inputmethod/latin/common/NativeSuggestOptions.java +++ b/common/src/com/android/inputmethod/latin/common/NativeSuggestOptions.java @@ -27,8 +27,8 @@ public class NativeSuggestOptions { private final int[] mOptions; - public NativeSuggestOptions(final int additionalFeaturesSettingsSize) { - mOptions = new int[OPTIONS_SIZE + additionalFeaturesSettingsSize]; + public NativeSuggestOptions() { + mOptions = new int[OPTIONS_SIZE]; } public void setIsGesture(final boolean value) { @@ -53,15 +53,6 @@ public class NativeSuggestOptions { setIntegerOption(WEIGHT_FOR_LOCALE_IN_THOUSANDS, (int) (value * 1000)); } - public void setAdditionalFeaturesOptions(final int[] additionalOptions) { - if (additionalOptions == null) { - return; - } - for (int i = 0; i < additionalOptions.length; i++) { - setIntegerOption(OPTIONS_SIZE + i, additionalOptions[i]); - } - } - public int[] getOptions() { return mOptions; } diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 2a5134df6..f01909f37 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -30,10 +30,6 @@ android:fragment="com.android.inputmethod.latin.settings.AppearanceSettingsFragment" android:title="@string/settings_screen_appearance" android:key="screen_appearance" /> - - - - - - - diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 46cd3b8b2..b0eae0832 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -293,8 +293,6 @@ public final class BinaryDictionary extends Dictionary { settingsValuesForSuggestion.mBlockPotentiallyOffensive); session.mNativeSuggestOptions.setSpaceAwareGestureEnabled( settingsValuesForSuggestion.mSpaceAwareGestureEnabled); - session.mNativeSuggestOptions.setAdditionalFeaturesOptions( - settingsValuesForSuggestion.mAdditionalFeaturesSettingValues); session.mNativeSuggestOptions.setWeightForLocale(weightForLocale); if (inOutWeightOfLangModelVsSpatialModel != null) { session.mInputOutputWeightOfLangModelVsSpatialModel[0] = diff --git a/java/src/com/android/inputmethod/latin/DicTraverseSession.java b/java/src/com/android/inputmethod/latin/DicTraverseSession.java index aefefd305..e7fd99ee8 100644 --- a/java/src/com/android/inputmethod/latin/DicTraverseSession.java +++ b/java/src/com/android/inputmethod/latin/DicTraverseSession.java @@ -18,7 +18,6 @@ package com.android.inputmethod.latin; import com.android.inputmethod.latin.common.Constants; import com.android.inputmethod.latin.common.NativeSuggestOptions; -import com.android.inputmethod.latin.settings.AdditionalFeaturesSettingUtils; import com.android.inputmethod.latin.utils.JniUtils; import java.util.Locale; @@ -44,8 +43,7 @@ public final class DicTraverseSession { public final int[] mOutputAutoCommitFirstWordConfidence = new int[1]; public final float[] mInputOutputWeightOfLangModelVsSpatialModel = new float[1]; - public final NativeSuggestOptions mNativeSuggestOptions = new NativeSuggestOptions( - AdditionalFeaturesSettingUtils.ADDITIONAL_FEATURES_SETTINGS_SIZE); + public final NativeSuggestOptions mNativeSuggestOptions = new NativeSuggestOptions(); private static native long setDicTraverseSessionNative(String locale, long dictSize); private static native void initDicTraverseSessionNative(long nativeDicTraverseSession, diff --git a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java index 811af4bd7..64a7cf347 100644 --- a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java +++ b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java @@ -33,7 +33,6 @@ import android.view.inputmethod.InputMethodSubtype; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.compat.InputMethodManagerCompatWrapper; -import com.android.inputmethod.latin.settings.AdditionalFeaturesSettingUtils; import com.android.inputmethod.latin.settings.Settings; import com.android.inputmethod.latin.utils.AdditionalSubtypeUtils; import com.android.inputmethod.latin.utils.LanguageOnSpacebarUtils; @@ -324,22 +323,6 @@ public class RichInputMethodManager { return INDEX_NOT_FOUND; } - public boolean checkIfSubtypeBelongsToThisIme(final InputMethodSubtype subtype) { - return getSubtypeIndexInIme(subtype, getInputMethodInfoOfThisIme()) != INDEX_NOT_FOUND; - } - - private static int getSubtypeIndexInIme(final InputMethodSubtype subtype, - final InputMethodInfo imi) { - final int count = imi.getSubtypeCount(); - for (int index = 0; index < count; index++) { - final InputMethodSubtype ims = imi.getSubtypeAt(index); - if (ims.equals(subtype)) { - return index; - } - } - return INDEX_NOT_FOUND; - } - public void onSubtypeChanged(@Nonnull final InputMethodSubtype newSubtype) { updateCurrentSubtype(newSubtype); updateShortcutIme(); @@ -416,7 +399,6 @@ public class RichInputMethodManager { // subtypes should be counted as well. if (nonAuxCount > 0 || (shouldIncludeAuxiliarySubtypes && auxCount > 1)) { ++filteredImisCount; - continue; } } diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 0185a04ef..4842438c8 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -2204,8 +2204,7 @@ public final class InputLogic { mWordComposer.isComposingWord() ? 2 : 1), proximityInfo, new SettingsValuesForSuggestion(settingsValues.mBlockPotentiallyOffensive, - settingsValues.mPhraseGestureEnabled, - settingsValues.mAdditionalFeaturesSettingValues), + settingsValues.mPhraseGestureEnabled), settingsValues.mAutoCorrectionEnabledPerUserSettings, inputStyle, sequenceNumber, callback); } diff --git a/java/src/com/android/inputmethod/latin/settings/AdvancedSettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/AdvancedSettingsFragment.java index 3dfc743f8..9366726e2 100644 --- a/java/src/com/android/inputmethod/latin/settings/AdvancedSettingsFragment.java +++ b/java/src/com/android/inputmethod/latin/settings/AdvancedSettingsFragment.java @@ -103,8 +103,6 @@ public final class AdvancedSettingsFragment extends SubScreenFragment { removePreference(Settings.PREF_ENABLE_METRICS_LOGGING); } - AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this); - setupKeypressVibrationDurationSettings(); setupKeypressSoundVolumeSettings(); setupKeyLongpressTimeoutSettings(); diff --git a/java/src/com/android/inputmethod/latin/settings/MultiLingualSettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/MultiLingualSettingsFragment.java deleted file mode 100644 index c5930db1e..000000000 --- a/java/src/com/android/inputmethod/latin/settings/MultiLingualSettingsFragment.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2014 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.settings; - -import android.os.Bundle; - -import com.android.inputmethod.latin.R; - -/** - * "Multilingual options" settings sub screen. - * - * This settings sub screen handles the following input preferences. - * - Language switch key - * - Switch to other input methods - */ -public final class MultiLingualSettingsFragment extends SubScreenFragment { - @Override - public void onCreate(final Bundle icicle) { - super.onCreate(icicle); - addPreferencesFromResource(R.xml.prefs_screen_multilingual); - if (!Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS) { - removePreference(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY); - removePreference(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST); - } - AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(getActivity(), this); - } -} diff --git a/java/src/com/android/inputmethod/latin/settings/Settings.java b/java/src/com/android/inputmethod/latin/settings/Settings.java index 77996405b..0ac19f76b 100644 --- a/java/src/com/android/inputmethod/latin/settings/Settings.java +++ b/java/src/com/android/inputmethod/latin/settings/Settings.java @@ -44,14 +44,8 @@ import javax.annotation.Nonnull; public final class Settings implements SharedPreferences.OnSharedPreferenceChangeListener { private static final String TAG = Settings.class.getSimpleName(); // Settings screens - public static final String SCREEN_PREFERENCES = "screen_preferences"; public static final String SCREEN_ACCOUNTS = "screen_accounts"; - public static final String SCREEN_APPEARANCE = "screen_appearance"; public static final String SCREEN_THEME = "screen_theme"; - public static final String SCREEN_MULTILINGUAL = "screen_multilingual"; - public static final String SCREEN_GESTURE = "screen_gesture"; - public static final String SCREEN_CORRECTION = "screen_correction"; - public static final String SCREEN_ADVANCED = "screen_advanced"; public static final String SCREEN_DEBUG = "screen_debug"; // In the same order as xml/prefs.xml public static final String PREF_AUTO_CAP = "auto_cap"; @@ -73,9 +67,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang "pref_key_use_double_space_period"; public static final String PREF_BLOCK_POTENTIALLY_OFFENSIVE = "pref_key_block_potentially_offensive"; - // No multilingual options in Android L and above for now. - public static final boolean SHOW_MULTILINGUAL_SETTINGS = - BuildCompatUtils.EFFECTIVE_SDK_INT <= Build.VERSION_CODES.KITKAT; public static final boolean ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS = BuildCompatUtils.EFFECTIVE_SDK_INT <= Build.VERSION_CODES.KITKAT; public static final boolean SHOULD_SHOW_LXX_SUGGESTION_UI = @@ -84,7 +75,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang "pref_show_language_switch_key"; public static final String PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST = "pref_include_other_imes_in_language_switch_list"; - public static final String PREF_KEYBOARD_THEME = "pref_keyboard_theme"; public static final String PREF_CUSTOM_INPUT_STYLES = "custom_input_styles"; public static final String PREF_ENABLE_SPLIT_KEYBOARD = "pref_split_keyboard"; // TODO: consolidate key preview dismiss delay with the key preview animation parameters. @@ -103,8 +93,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang "pref_gesture_floating_preview_text"; public static final String PREF_PHRASE_GESTURE_ENABLED = "pref_gesture_space_aware"; - public static final String PREF_INPUT_LANGUAGE = "input_language"; - public static final String PREF_SELECTED_LANGUAGES = "selected_languages"; public static final String PREF_KEY_IS_INTERNAL = "pref_key_is_internal"; public static final String PREF_ENABLE_METRICS_LOGGING = "pref_enable_metrics_logging"; @@ -203,14 +191,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang return mSettingsValues.mIsInternal; } - public boolean isWordSeparator(final int code) { - return mSettingsValues.isWordSeparator(code); - } - - public boolean getBlockPotentiallyOffensive() { - return mSettingsValues.mBlockPotentiallyOffensive; - } - public static int readScreenMetrics(final Resources res) { return res.getInteger(R.integer.config_screen_metrics); } diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java index 6c21accf6..b98c53af4 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java @@ -48,15 +48,10 @@ public final class SettingsFragment extends InputMethodSettingsFragment { final PreferenceScreen preferenceScreen = getPreferenceScreen(); preferenceScreen.setTitle( ApplicationUtils.getActivityTitleResId(getActivity(), SettingsActivity.class)); - if (!Settings.SHOW_MULTILINGUAL_SETTINGS) { - final Preference multilingualOptions = findPreference(Settings.SCREEN_MULTILINGUAL); - preferenceScreen.removePreference(multilingualOptions); - } if (!ProductionFlags.ENABLE_ACCOUNT_SIGN_IN) { final Preference accountsPreference = findPreference(Settings.SCREEN_ACCOUNTS); preferenceScreen.removePreference(accountsPreference); } - AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(getActivity(), this); } @Override diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java index 0669026d8..a080515dd 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java @@ -102,10 +102,6 @@ public class SettingsValues { private final boolean mSuggestionsEnabledPerUserSettings; private final AsyncResultHolder mAppWorkarounds; - // Setting values for additional features - public final int[] mAdditionalFeaturesSettingValues = - new int[AdditionalFeaturesSettingUtils.ADDITIONAL_FEATURES_SETTINGS_SIZE]; - // TextDecorator public final int mTextHighlightColorForAddToDictionaryIndicator; @@ -187,8 +183,6 @@ public class SettingsValues { mAutoCorrectionEnabledPerUserSettings = mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect; mSuggestionsEnabledPerUserSettings = readSuggestionsEnabled(prefs); - AdditionalFeaturesSettingUtils.readAdditionalFeaturesPreferencesIntoArray(context, - prefs, mAdditionalFeaturesSettingValues); mTextHighlightColorForAddToDictionaryIndicator = res.getColor( R.color.text_decorator_add_to_dictionary_indicator_text_highlight_color); mIsInternal = Settings.isInternal(prefs); @@ -437,8 +431,6 @@ public class SettingsValues { sb.append("\n mAppWorkarounds = "); final AppWorkaroundsUtils awu = mAppWorkarounds.get(null, 0); sb.append("" + (null == awu ? "null" : awu.toString())); - sb.append("\n mAdditionalFeaturesSettingValues = "); - sb.append("" + Arrays.toString(mAdditionalFeaturesSettingValues)); sb.append("\n mTextHighlightColorForAddToDictionaryIndicator = "); sb.append("" + mTextHighlightColorForAddToDictionaryIndicator); sb.append("\n mIsInternal = "); diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValuesForSuggestion.java b/java/src/com/android/inputmethod/latin/settings/SettingsValuesForSuggestion.java index d80af4ba7..56e6fac71 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsValuesForSuggestion.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsValuesForSuggestion.java @@ -19,12 +19,10 @@ package com.android.inputmethod.latin.settings; public class SettingsValuesForSuggestion { public final boolean mBlockPotentiallyOffensive; public final boolean mSpaceAwareGestureEnabled; - public final int[] mAdditionalFeaturesSettingValues; public SettingsValuesForSuggestion(final boolean blockPotentiallyOffensive, - final boolean spaceAwareGestureEnabled, final int[] additionalFeaturesSettingValues) { + final boolean spaceAwareGestureEnabled) { mBlockPotentiallyOffensive = blockPotentiallyOffensive; mSpaceAwareGestureEnabled = spaceAwareGestureEnabled; - mAdditionalFeaturesSettingValues = additionalFeaturesSettingValues; } } diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java index bcf7bbfdc..8744020b1 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java @@ -76,8 +76,7 @@ public final class AndroidSpellCheckerService extends SpellCheckerService // TODO: make a spell checker option to block offensive words or not private final SettingsValuesForSuggestion mSettingsValuesForSuggestion = new SettingsValuesForSuggestion(true /* blockPotentiallyOffensive */, - true /* spaceAwareGestureEnabled */, - null /* additionalFeaturesSettingValues */); + true /* spaceAwareGestureEnabled */); public static final String SINGLE_QUOTE = "\u0027"; public static final String APOSTROPHE = "\u2019"; diff --git a/java/src/com/android/inputmethod/latin/utils/DistracterFilterCheckingExactMatchesAndSuggestions.java b/java/src/com/android/inputmethod/latin/utils/DistracterFilterCheckingExactMatchesAndSuggestions.java index 9c6a94810..56a04a856 100644 --- a/java/src/com/android/inputmethod/latin/utils/DistracterFilterCheckingExactMatchesAndSuggestions.java +++ b/java/src/com/android/inputmethod/latin/utils/DistracterFilterCheckingExactMatchesAndSuggestions.java @@ -238,8 +238,7 @@ public class DistracterFilterCheckingExactMatchesAndSuggestions implements Distr } final SettingsValuesForSuggestion settingsValuesForSuggestion = new SettingsValuesForSuggestion(false /* blockPotentiallyOffensive */, - false /* spaceAwareGestureEnabled */, - null /* additionalFeaturesSettingValues */); + false /* spaceAwareGestureEnabled */); final int trailingSingleQuotesCount = StringUtils.getTrailingSingleQuotesCount(testedWord); final String consideredWord = trailingSingleQuotesCount > 0 ? testedWord.substring(0, testedWord.length() - trailingSingleQuotesCount) : diff --git a/java/src/com/android/inputmethod/latin/utils/FragmentUtils.java b/java/src/com/android/inputmethod/latin/utils/FragmentUtils.java index ae2de44c7..147e57b13 100644 --- a/java/src/com/android/inputmethod/latin/utils/FragmentUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/FragmentUtils.java @@ -25,7 +25,6 @@ import com.android.inputmethod.latin.settings.CorrectionSettingsFragment; import com.android.inputmethod.latin.settings.CustomInputStyleSettingsFragment; import com.android.inputmethod.latin.settings.DebugSettingsFragment; import com.android.inputmethod.latin.settings.GestureSettingsFragment; -import com.android.inputmethod.latin.settings.MultiLingualSettingsFragment; import com.android.inputmethod.latin.settings.PreferencesSettingsFragment; import com.android.inputmethod.latin.settings.SettingsFragment; import com.android.inputmethod.latin.settings.ThemeSettingsFragment; @@ -46,7 +45,6 @@ public class FragmentUtils { sLatinImeFragments.add(AccountsSettingsFragment.class.getName()); sLatinImeFragments.add(AppearanceSettingsFragment.class.getName()); sLatinImeFragments.add(ThemeSettingsFragment.class.getName()); - sLatinImeFragments.add(MultiLingualSettingsFragment.class.getName()); sLatinImeFragments.add(CustomInputStyleSettingsFragment.class.getName()); sLatinImeFragments.add(GestureSettingsFragment.class.getName()); sLatinImeFragments.add(CorrectionSettingsFragment.class.getName());