aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r--java/src/com/android/inputmethod/latin/DictionaryFacilitator.java43
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java44
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputMethodSubtype.java11
-rw-r--r--java/src/com/android/inputmethod/latin/SubtypeSwitcher.java30
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java13
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java5
-rw-r--r--java/src/com/android/inputmethod/latin/settings/DebugSettings.java4
-rw-r--r--java/src/com/android/inputmethod/latin/settings/DebugSettingsFragment.java4
-rw-r--r--java/src/com/android/inputmethod/latin/settings/Settings.java2
-rw-r--r--java/src/com/android/inputmethod/latin/settings/SettingsValues.java6
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java18
-rw-r--r--java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java11
12 files changed, 102 insertions, 89 deletions
diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java
index 1f0317288..4a218d550 100644
--- a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java
+++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java
@@ -416,33 +416,38 @@ public class DictionaryFacilitator {
}
@UsedForTesting
- public void resetDictionariesForTesting(final Context context, final Locale locale,
+ public void resetDictionariesForTesting(final Context context, final Locale[] locales,
final ArrayList<String> dictionaryTypes, final HashMap<String, File> dictionaryFiles,
final Map<String, Map<String, String>> additionalDictAttributes) {
Dictionary mainDictionary = null;
final Map<String, ExpandableBinaryDictionary> subDicts = new HashMap<>();
- for (final String dictType : dictionaryTypes) {
- if (dictType.equals(Dictionary.TYPE_MAIN)) {
- mainDictionary = DictionaryFactory.createMainDictionaryFromManager(context, locale);
- } else {
- final File dictFile = dictionaryFiles.get(dictType);
- final ExpandableBinaryDictionary dict = getSubDict(
- dictType, context, locale, dictFile, "" /* dictNamePrefix */);
- if (additionalDictAttributes.containsKey(dictType)) {
- dict.clearAndFlushDictionaryWithAdditionalAttributes(
- additionalDictAttributes.get(dictType));
- }
- if (dict == null) {
- throw new RuntimeException("Unknown dictionary type: " + dictType);
+ final DictionaryGroup[] dictionaryGroups = new DictionaryGroup[locales.length];
+ for (int i = 0; i < locales.length; ++i) {
+ final Locale locale = locales[i];
+ for (final String dictType : dictionaryTypes) {
+ if (dictType.equals(Dictionary.TYPE_MAIN)) {
+ mainDictionary = DictionaryFactory.createMainDictionaryFromManager(context,
+ locale);
+ } else {
+ final File dictFile = dictionaryFiles.get(dictType);
+ final ExpandableBinaryDictionary dict = getSubDict(
+ dictType, context, locale, dictFile, "" /* dictNamePrefix */);
+ if (additionalDictAttributes.containsKey(dictType)) {
+ dict.clearAndFlushDictionaryWithAdditionalAttributes(
+ additionalDictAttributes.get(dictType));
+ }
+ if (dict == null) {
+ throw new RuntimeException("Unknown dictionary type: " + dictType);
+ }
+ dict.reloadDictionaryIfRequired();
+ dict.waitAllTasksForTests();
+ subDicts.put(dictType, dict);
}
- dict.reloadDictionaryIfRequired();
- dict.waitAllTasksForTests();
- subDicts.put(dictType, dict);
}
+ dictionaryGroups[i] = new DictionaryGroup(locale, mainDictionary, subDicts);
}
- mDictionaryGroups = new DictionaryGroup[] {
- new DictionaryGroup(locale, mainDictionary, subDicts) };
+ mDictionaryGroups = dictionaryGroups;
}
public void closeDictionaries() {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index bb7a36b4f..64e65effe 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -102,7 +102,7 @@ import com.android.inputmethod.latin.utils.ViewLayoutUtils;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Collections;
+import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
@@ -594,18 +594,19 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Has to be package-visible for unit tests
@UsedForTesting
void loadSettings() {
- final Locale locale = mSubtypeSwitcher.getCurrentSubtypeLocale();
+ final Locale[] locales = mSubtypeSwitcher.getCurrentSubtypeLocales();
final EditorInfo editorInfo = getCurrentInputEditorInfo();
final InputAttributes inputAttributes = new InputAttributes(
editorInfo, isFullscreenMode(), getPackageName());
- mSettings.loadSettings(this, locale, inputAttributes);
+ // TODO: pass the array instead
+ mSettings.loadSettings(this, locales[0], inputAttributes);
final SettingsValues currentSettingsValues = mSettings.getCurrent();
AudioAndHapticFeedbackManager.getInstance().onSettingsChanged(currentSettingsValues);
// This method is called on startup and language switch, before the new layout has
// been displayed. Opening dictionaries never affects responsivity as dictionaries are
// asynchronously loaded.
if (!mHandler.hasPendingReopenDictionaries()) {
- resetDictionaryFacilitatorForLocale(locale);
+ resetDictionaryFacilitatorForLocale(locales);
}
mDictionaryFacilitator.updateEnabledSubtypes(mRichImm.getMyEnabledInputMethodSubtypeList(
true /* allowsImplicitlySelectedSubtypes */));
@@ -647,35 +648,34 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
private void resetDictionaryFacilitatorIfNecessary() {
- final Locale switcherSubtypeLocale = mSubtypeSwitcher.getCurrentSubtypeLocale();
- if (mDictionaryFacilitator.isForLocales(new Locale[] { switcherSubtypeLocale })) {
+ final Locale[] subtypeSwitcherLocales = mSubtypeSwitcher.getCurrentSubtypeLocales();
+ if (mDictionaryFacilitator.isForLocales(subtypeSwitcherLocales)) {
return;
}
- final String switcherLocaleStr = switcherSubtypeLocale.toString();
- final Locale subtypeLocale;
- if (TextUtils.isEmpty(switcherLocaleStr)) {
+ final Locale[] subtypeLocales;
+ if (0 == subtypeSwitcherLocales.length) {
// This happens in very rare corner cases - for example, immediately after a switch
// to LatinIME has been requested, about a frame later another switch happens. In this
// case, we are about to go down but we still don't know it, however the system tells
- // us there is no current subtype so the locale is the empty string. Take the best
- // possible guess instead -- it's bound to have no consequences, and we have no way
- // of knowing anyway.
+ // us there is no current subtype.
Log.e(TAG, "System is reporting no current subtype.");
- subtypeLocale = getResources().getConfiguration().locale;
+ subtypeLocales = new Locale[] { getResources().getConfiguration().locale };
} else {
- subtypeLocale = switcherSubtypeLocale;
+ subtypeLocales = subtypeSwitcherLocales;
}
- resetDictionaryFacilitatorForLocale(subtypeLocale);
+ resetDictionaryFacilitatorForLocale(subtypeLocales);
}
/**
- * Reset the facilitator by loading dictionaries for the locale and the current settings values.
+ * Reset the facilitator by loading dictionaries for the locales and the current settings values
*
- * @param locale the locale
+ * @param locales the locales
*/
- // TODO: make sure the current settings always have the right locale, and read from them
- private void resetDictionaryFacilitatorForLocale(final Locale locale) {
+ // TODO: make sure the current settings always have the right locales, and read from them
+ private void resetDictionaryFacilitatorForLocale(final Locale[] locales) {
final SettingsValues settingsValues = mSettings.getCurrent();
+ // TODO: pass the array instead
+ final Locale locale = locales[0];
mDictionaryFacilitator.resetDictionaries(this /* context */, locale,
settingsValues.mUseContactsDict, settingsValues.mUsePersonalizedDicts,
false /* forceReloadMainDictionary */, this);
@@ -899,7 +899,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Update to a gesture consumer with the current editor and IME state.
mGestureConsumer = GestureConsumer.newInstance(editorInfo,
mInputLogic.getPrivateCommandPerformer(),
- Collections.singletonList(mSubtypeSwitcher.getCurrentSubtypeLocale()),
+ Arrays.asList(mSubtypeSwitcher.getCurrentSubtypeLocales()),
switcher.getKeyboard());
// Forward this event to the accessibility utilities, if enabled.
@@ -1455,7 +1455,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void onStartBatchInput() {
mInputLogic.onStartBatchInput(mSettings.getCurrent(), mKeyboardSwitcher, mHandler);
mGestureConsumer.onGestureStarted(
- Collections.singletonList(mSubtypeSwitcher.getCurrentSubtypeLocale()),
+ Arrays.asList(mSubtypeSwitcher.getCurrentSubtypeLocales()),
mKeyboardSwitcher.getKeyboard());
}
@@ -1579,7 +1579,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// We should clear the contextual strip if there is no suggestion from dictionaries.
|| noSuggestionsFromDictionaries) {
mSuggestionStripView.setSuggestions(suggestedWords,
- SubtypeLocaleUtils.isRtlLanguage(mSubtypeSwitcher.getCurrentSubtype()));
+ mSubtypeSwitcher.getCurrentSubtype().isRtlSubtype());
}
}
diff --git a/java/src/com/android/inputmethod/latin/RichInputMethodSubtype.java b/java/src/com/android/inputmethod/latin/RichInputMethodSubtype.java
index 0b08c48e5..8d055531c 100644
--- a/java/src/com/android/inputmethod/latin/RichInputMethodSubtype.java
+++ b/java/src/com/android/inputmethod/latin/RichInputMethodSubtype.java
@@ -114,10 +114,13 @@ public final class RichInputMethodSubtype {
return "Multi-lingual subtype: " + mSubtype.toString() + ", " + Arrays.toString(mLocales);
}
- // TODO: remove this method! We can always have several locales. Multi-lingual input will only
- // be done when this method is gone.
- public String getLocale() {
- return mSubtype.getLocale();
+ public Locale[] getLocales() {
+ return mLocales;
+ }
+
+ public boolean isRtlSubtype() {
+ // The subtype is considered RTL if the language of the main subtype is RTL.
+ return SubtypeLocaleUtils.isRtlLanguage(mLocales[0]);
}
// TODO: remove this method
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index 45d67ff88..c339e96fb 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -170,15 +170,21 @@ public final class SubtypeSwitcher {
Log.w(TAG, "onSubtypeChanged: " + newSubtype.getNameForLogging());
}
- final Locale newLocale = SubtypeLocaleUtils.getSubtypeLocale(newSubtype);
- final Locale systemLocale = mResources.getConfiguration().locale;
- final boolean sameLocale = systemLocale.equals(newLocale);
- final boolean sameLanguage = systemLocale.getLanguage().equals(newLocale.getLanguage());
- final boolean implicitlyEnabled = mRichImm
- .checkIfSubtypeBelongsToThisImeAndImplicitlyEnabled(newSubtype.getRawSubtype());
- mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(
- sameLocale || (sameLanguage && implicitlyEnabled));
-
+ final Locale[] newLocales = newSubtype.getLocales();
+ if (newLocales.length > 1) {
+ // In multi-locales mode, the system language is never the same as the input language
+ // because there is no single input language.
+ mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(false);
+ } else {
+ final Locale newLocale = newLocales[0];
+ final Locale systemLocale = mResources.getConfiguration().locale;
+ final boolean sameLocale = systemLocale.equals(newLocale);
+ final boolean sameLanguage = systemLocale.getLanguage().equals(newLocale.getLanguage());
+ final boolean implicitlyEnabled = mRichImm
+ .checkIfSubtypeBelongsToThisImeAndImplicitlyEnabled(newSubtype.getRawSubtype());
+ mLanguageOnSpacebarHelper.updateIsSystemLanguageSameAsInputLanguage(
+ sameLocale || (sameLanguage && implicitlyEnabled));
+ }
updateShortcutIME();
}
@@ -284,11 +290,11 @@ public final class SubtypeSwitcher {
sForcedSubtypeForTesting = new RichInputMethodSubtype(subtype);
}
- public Locale getCurrentSubtypeLocale() {
+ public Locale[] getCurrentSubtypeLocales() {
if (null != sForcedSubtypeForTesting) {
- return LocaleUtils.constructLocaleFromString(sForcedSubtypeForTesting.getLocale());
+ return sForcedSubtypeForTesting.getLocales();
}
- return SubtypeLocaleUtils.getSubtypeLocale(getCurrentSubtype());
+ return getCurrentSubtype().getLocales();
}
public RichInputMethodSubtype getCurrentSubtype() {
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index e6fd43a07..466576465 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -113,6 +113,19 @@ public class SuggestedWords {
}
/**
+ * Get suggested word to show as suggestions to UI.
+ *
+ * @param shouldShowLxxSuggestionUi true if showing suggestion UI introduced in LXX and later.
+ * @return the count of suggested word to show as suggestions to UI.
+ */
+ public int getWordCountToShow(final boolean shouldShowLxxSuggestionUi) {
+ if (isPrediction() || !shouldShowLxxSuggestionUi) {
+ return size();
+ }
+ return size() - /* typed word */ 1;
+ }
+
+ /**
* Get suggested word at <code>index</code>.
* @param index The index of the suggested word.
* @return The suggested word.
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index f67a9a6ef..07bfd0dee 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -53,7 +53,6 @@ import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.WordComposer;
import com.android.inputmethod.latin.define.DebugFlags;
-import com.android.inputmethod.latin.define.ProductionFlags;
import com.android.inputmethod.latin.settings.SettingsValues;
import com.android.inputmethod.latin.settings.SettingsValuesForSuggestion;
import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
@@ -169,7 +168,7 @@ public final class InputLogic {
mInputLogicHandler.reset();
}
- if (settingsValues.mShouldShowUiToAcceptTypedWord) {
+ if (settingsValues.mShouldShowLxxSuggestionUi) {
mConnection.requestCursorUpdates(true /* enableMonitor */,
true /* requestImmediateCallback */);
}
@@ -2352,7 +2351,7 @@ public final class InputLogic {
// We cannot help in this case because we are heavily relying on this new API.
return false;
}
- if (!settingsValues.mShouldShowUiToAcceptTypedWord) {
+ if (!settingsValues.mShouldShowLxxSuggestionUi) {
return false;
}
if (TextUtils.isEmpty(lastComposedWord.mTypedWord)) {
diff --git a/java/src/com/android/inputmethod/latin/settings/DebugSettings.java b/java/src/com/android/inputmethod/latin/settings/DebugSettings.java
index 48f4c758c..091ca43c6 100644
--- a/java/src/com/android/inputmethod/latin/settings/DebugSettings.java
+++ b/java/src/com/android/inputmethod/latin/settings/DebugSettings.java
@@ -21,8 +21,8 @@ public final class DebugSettings {
public static final String PREF_FORCE_NON_DISTINCT_MULTITOUCH = "force_non_distinct_multitouch";
public static final String PREF_FORCE_PHYSICAL_KEYBOARD_SPECIAL_KEY =
"force_physical_keyboard_special_key";
- public static final String PREF_SHOW_UI_TO_ACCEPT_TYPED_WORD =
- "pref_show_ui_to_accept_typed_word";
+ public static final String PREF_SHOULD_SHOW_LXX_SUGGESTION_UI =
+ "pref_should_show_lxx_suggestion_ui";
public static final String PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS =
"pref_has_custom_key_preview_animation_params";
public static final String PREF_KEY_PREVIEW_SHOW_UP_START_X_SCALE =
diff --git a/java/src/com/android/inputmethod/latin/settings/DebugSettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/DebugSettingsFragment.java
index 5640e2039..e9f8d45aa 100644
--- a/java/src/com/android/inputmethod/latin/settings/DebugSettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/settings/DebugSettingsFragment.java
@@ -56,8 +56,8 @@ public final class DebugSettingsFragment extends SubScreenFragment
super.onCreate(icicle);
addPreferencesFromResource(R.xml.prefs_screen_debug);
- if (!Settings.HAS_UI_TO_ACCEPT_TYPED_WORD) {
- removePreference(DebugSettings.PREF_SHOW_UI_TO_ACCEPT_TYPED_WORD);
+ if (!Settings.SHOULD_SHOW_LXX_SUGGESTION_UI) {
+ removePreference(DebugSettings.PREF_SHOULD_SHOW_LXX_SUGGESTION_UI);
}
mReadExternalDictionaryPref = findPreference(PREF_READ_EXTERNAL_DICTIONARY);
diff --git a/java/src/com/android/inputmethod/latin/settings/Settings.java b/java/src/com/android/inputmethod/latin/settings/Settings.java
index 83adb1c55..84596b4ad 100644
--- a/java/src/com/android/inputmethod/latin/settings/Settings.java
+++ b/java/src/com/android/inputmethod/latin/settings/Settings.java
@@ -77,7 +77,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
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 HAS_UI_TO_ACCEPT_TYPED_WORD =
+ public static final boolean SHOULD_SHOW_LXX_SUGGESTION_UI =
BuildCompatUtils.EFFECTIVE_SDK_INT >= BuildCompatUtils.VERSION_CODES_LXX;
public static final String PREF_SHOW_LANGUAGE_SWITCH_KEY =
"pref_show_language_switch_key";
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
index 99f761ca6..ce8a0ab9c 100644
--- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
@@ -80,7 +80,7 @@ public class SettingsValues {
public final boolean mPhraseGestureEnabled;
public final int mKeyLongpressTimeout;
public final boolean mEnableMetricsLogging;
- public final boolean mShouldShowUiToAcceptTypedWord;
+ public final boolean mShouldShowLxxSuggestionUi;
// Use split layout for keyboard.
public final boolean mIsSplitKeyboardEnabled;
public final int mScreenMetrics;
@@ -163,8 +163,8 @@ public class SettingsValues {
mIsSplitKeyboardEnabled = prefs.getBoolean(Settings.PREF_ENABLE_SPLIT_KEYBOARD, false);
mScreenMetrics = res.getInteger(R.integer.config_screen_metrics);
- mShouldShowUiToAcceptTypedWord = Settings.HAS_UI_TO_ACCEPT_TYPED_WORD
- && prefs.getBoolean(DebugSettings.PREF_SHOW_UI_TO_ACCEPT_TYPED_WORD, true);
+ mShouldShowLxxSuggestionUi = Settings.SHOULD_SHOW_LXX_SUGGESTION_UI
+ && prefs.getBoolean(DebugSettings.PREF_SHOULD_SHOW_LXX_SUGGESTION_UI, true);
// Compute other readable settings
mKeyLongpressTimeout = Settings.readKeyLongpressTimeout(prefs, res);
mKeypressVibrationDuration = Settings.readKeypressVibrationDuration(prefs, res);
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java
index a651774c6..d55939971 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java
@@ -240,9 +240,9 @@ final class SuggestionStripLayoutHelper {
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
final boolean shouldOmitTypedWord = shouldOmitTypedWord(suggestedWords.mInputStyle,
settingsValues.mGestureFloatingPreviewTextEnabled,
- settingsValues.mShouldShowUiToAcceptTypedWord);
+ settingsValues.mShouldShowLxxSuggestionUi);
return getPositionInSuggestionStrip(indexInSuggestedWords, suggestedWords.mWillAutoCorrect,
- settingsValues.mShouldShowUiToAcceptTypedWord && shouldOmitTypedWord,
+ settingsValues.mShouldShowLxxSuggestionUi && shouldOmitTypedWord,
mCenterPositionInStrip, mTypedWordPositionWhenAutocorrect);
}
@@ -367,21 +367,19 @@ final class SuggestionStripLayoutHelper {
(PunctuationSuggestions)suggestedWords, stripView);
}
- final boolean shouldShowUiToAcceptTypedWord = Settings.getInstance().getCurrent()
- .mShouldShowUiToAcceptTypedWord;
- final int suggestionsCount = suggestedWords.size()
- - (shouldShowUiToAcceptTypedWord ? /* typed word */ 1 : 0);
+ final int wordCountToShow = suggestedWords.getWordCountToShow(
+ Settings.getInstance().getCurrent().mShouldShowLxxSuggestionUi);
final int startIndexOfMoreSuggestions = setupWordViewsAndReturnStartIndexOfMoreSuggestions(
suggestedWords, mSuggestionsCountInStrip);
final TextView centerWordView = mWordViews.get(mCenterPositionInStrip);
final int stripWidth = stripView.getWidth();
final int centerWidth = getSuggestionWidth(mCenterPositionInStrip, stripWidth);
- if (suggestionsCount == 1 || getTextScaleX(centerWordView.getText(), centerWidth,
+ if (wordCountToShow == 1 || getTextScaleX(centerWordView.getText(), centerWidth,
centerWordView.getPaint()) < MIN_TEXT_XSCALE) {
// Layout only the most relevant suggested word at the center of the suggestion strip
// by consolidating all slots in the strip.
final int countInStrip = 1;
- mMoreSuggestionsAvailable = (suggestionsCount > countInStrip);
+ mMoreSuggestionsAvailable = (wordCountToShow > countInStrip);
layoutWord(mCenterPositionInStrip, stripWidth - mPadding);
stripView.addView(centerWordView);
setLayoutWeight(centerWordView, 1.0f, ViewGroup.LayoutParams.MATCH_PARENT);
@@ -393,7 +391,7 @@ final class SuggestionStripLayoutHelper {
}
final int countInStrip = mSuggestionsCountInStrip;
- mMoreSuggestionsAvailable = (suggestionsCount > countInStrip);
+ mMoreSuggestionsAvailable = (wordCountToShow > countInStrip);
int x = 0;
for (int positionInStrip = 0; positionInStrip < countInStrip; positionInStrip++) {
if (positionInStrip != 0) {
@@ -557,7 +555,7 @@ final class SuggestionStripLayoutHelper {
public void layoutAddToDictionaryHint(final String word, final ViewGroup addToDictionaryStrip) {
final boolean shouldShowUiToAcceptTypedWord = Settings.getInstance().getCurrent()
- .mShouldShowUiToAcceptTypedWord;
+ .mShouldShowLxxSuggestionUi;
final int stripWidth = addToDictionaryStrip.getWidth();
final int width = shouldShowUiToAcceptTypedWord ? stripWidth
: stripWidth - mDividerWidth - mPadding * 2;
diff --git a/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java b/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java
index 5a7f7662c..61661cd52 100644
--- a/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java
@@ -293,13 +293,6 @@ public final class SubtypeLocaleUtils {
return LocaleUtils.constructLocaleFromString(localeString);
}
- // TODO: remove this. When RichInputMethodSubtype#getLocale is removed we can do away with this
- // method at the same time.
- public static Locale getSubtypeLocale(final RichInputMethodSubtype subtype) {
- final String localeString = subtype.getLocale();
- return LocaleUtils.constructLocaleFromString(localeString);
- }
-
public static String getKeyboardLayoutSetDisplayName(final InputMethodSubtype subtype) {
final String layoutName = getKeyboardLayoutSetName(subtype);
return getKeyboardLayoutSetDisplayName(layoutName);
@@ -348,10 +341,6 @@ public final class SubtypeLocaleUtils {
return Arrays.binarySearch(SORTED_RTL_LANGUAGES, language) >= 0;
}
- public static boolean isRtlLanguage(final RichInputMethodSubtype subtype) {
- return isRtlLanguage(getSubtypeLocale(subtype));
- }
-
public static String getCombiningRulesExtraValue(final InputMethodSubtype subtype) {
return subtype.getExtraValueOf(Constants.Subtype.ExtraValue.COMBINING_RULES);
}