LatinIME portion of multi-lang option removal.

Bug 19188067.

Change-Id: Ic9a3637f59dda30c699141222b9dcac3cd624b99
This commit is contained in:
Dan Zivkovic 2015-01-29 14:45:24 -08:00
parent 174da5c395
commit 77e0fa1d67
16 changed files with 7 additions and 159 deletions

View File

@ -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;
}

View File

@ -30,10 +30,6 @@
android:fragment="com.android.inputmethod.latin.settings.AppearanceSettingsFragment"
android:title="@string/settings_screen_appearance"
android:key="screen_appearance" />
<PreferenceScreen
android:fragment="com.android.inputmethod.latin.settings.MultiLingualSettingsFragment"
android:title="@string/settings_screen_multilingual"
android:key="screen_multilingual" />
<PreferenceScreen
android:fragment="com.android.inputmethod.latin.settings.GestureSettingsFragment"
android:title="@string/settings_screen_gesture"

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/settings_screen_multilingual"
android:key="screen_multilingual">
<CheckBoxPreference
android:key="pref_show_language_switch_key"
android:title="@string/show_language_switch_key"
android:summary="@string/show_language_switch_key_summary"
android:defaultValue="true"
android:persistent="true" />
<CheckBoxPreference
android:key="pref_include_other_imes_in_language_switch_list"
android:dependency="pref_show_language_switch_key"
android:title="@string/include_other_imes_in_language_switch_list"
android:summary="@string/include_other_imes_in_language_switch_list_summary"
android:defaultValue="false"
android:persistent="true" />
</PreferenceScreen>

View File

@ -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] =

View File

@ -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,

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -103,8 +103,6 @@ public final class AdvancedSettingsFragment extends SubScreenFragment {
removePreference(Settings.PREF_ENABLE_METRICS_LOGGING);
}
AdditionalFeaturesSettingUtils.addAdditionalFeaturesPreferences(context, this);
setupKeypressVibrationDurationSettings();
setupKeypressSoundVolumeSettings();
setupKeyLongpressTimeoutSettings();

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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

View File

@ -102,10 +102,6 @@ public class SettingsValues {
private final boolean mSuggestionsEnabledPerUserSettings;
private final AsyncResultHolder<AppWorkaroundsUtils> 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 = ");

View File

@ -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;
}
}

View File

@ -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";

View File

@ -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) :

View File

@ -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());