diff options
Diffstat (limited to 'java')
6 files changed, 39 insertions, 39 deletions
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index f7d34c8e3..2a47d7afa 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -409,26 +409,27 @@ <!-- Title of the button to revert to the default value of the device in the settings dialog [CHAR LIMIT=15] --> <string name="button_default">Default</string> + <!-- TODO: Remove translatable="false" once wordings are finalized. --> <!-- Title of the setup wizard. [CHAR LIMT=40] --> - <string name="setup_title">"Installing <xliff:g id="application_name">%s</xliff:g>"</string> + <string name="setup_title" translatable="false">"Installing <xliff:g id="application_name">%s</xliff:g>"</string> <!-- Ordinal number of the 1st step in the setup wizard. [CHAR LIMIT=5] --> - <string name="setup_step1_bullet">1</string> + <string name="setup_step1_bullet" translatable="false">1</string> <!-- Title of the 1st step in the setup wizard. [CHAR LIMIT=64] --> - <string name="setup_step1_title">"Enable <xliff:g id="application_name">%s</xliff:g> in settings."</string> + <string name="setup_step1_title" translatable="false">"Enable <xliff:g id="application_name">%s</xliff:g> in settings."</string> <!-- Detailed instruction of the 1st step in the setup wizard. [CHAR LIMIT=80] --> - <string name="setup_step1_instruction">"For security, please check \"<xliff:g id="application_name">%s</xliff:g>\""</string> + <string name="setup_step1_instruction" translatable="false">"For security, please check \"<xliff:g id="application_name">%s</xliff:g>\""</string> <!-- Ordinal number of the 2nd step in the setup wizard. [CHAR LIMIT=5] --> - <string name="setup_step2_bullet">2</string> + <string name="setup_step2_bullet" translatable="false">2</string> <!-- Title of the 2nd step in the setup wizard. [CHAR LIMIT=64] --> - <string name="setup_step2_title">"Switch to <xliff:g id="application_name">%s</xliff:g>."</string> + <string name="setup_step2_title" translatable="false">"Switch to <xliff:g id="application_name">%s</xliff:g>."</string> <!-- Detailed instruction of the 2nd step in the setup wizard. [CHAR LIMIT=80] --> - <string name="setup_step2_instruction">"Now that you've enabled <xliff:g id="application_name">%s</xliff:g>, you can switch to it."</string> + <string name="setup_step2_instruction" translatable="false">"Now that you've enabled <xliff:g id="application_name">%s</xliff:g>, you can switch to it."</string> <!-- Ordinal number of the 3rd step in the setup wizard. [CHAR LIMIT=5] --> - <string name="setup_step3_bullet">3</string> + <string name="setup_step3_bullet" translatable="false">3</string> <!-- Title of the 3rd step in the setup wizard. [CHAR LIMIT=64] --> - <string name="setup_step3_title">"Congratulations, you're all set!"</string> + <string name="setup_step3_title" translatable="false">"Congratulations, you're all set!"</string> <!-- Detailed instruction of the 3rd step in the setup wizard. [CHAR LIMIT=80] --> - <string name="setup_step3_instruction">Configure additional languages</string> + <string name="setup_step3_instruction" translatable="false">Configure additional languages</string> <!-- Title of the Language & input settings. This should be aligned with msgid="5292716747264442359" --> <string name="language_settings">Language & input</string> <!-- Title of the Input method picker. This should be aligned with msgid="4653387336791222978" --> diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 365c35b48..350dc69b2 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -635,15 +635,9 @@ public class KeyboardView extends View { invalidate(x, y, x + key.mWidth, y + key.mHeight); } - // TODO: Remove this method. - public void closing() { - mInvalidateAllKeys = true; - } - @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - closing(); freeOffscreenBuffer(); } } diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 4d10f0e69..bc27f8553 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -1236,13 +1236,11 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack mDrawingHandler.cancelAllMessages(); } - @Override public void closing() { dismissAllKeyPreviews(); cancelAllMessages(); onDismissMoreKeysPanel(); mMoreKeysKeyboardCache.clear(); - super.closing(); } /** diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java index 9e75f8b8a..0d42ab2fe 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java @@ -174,7 +174,6 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel @Override public boolean dismissMoreKeysPanel() { - super.closing(); if (mController == null) return false; return mController.onDismissMoreKeysPanel(); } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 2050c7663..79a05ceae 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -132,6 +132,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction private View mKeyPreviewBackingView; private View mSuggestionsContainer; private SuggestionStripView mSuggestionStripView; + // Never null + private SuggestedWords mSuggestedWords = SuggestedWords.EMPTY; @UsedForTesting Suggest mSuggest; private CompletionInfo[] mApplicationSpecifiedCompletions; private ApplicationInfo mTargetApplicationInfo; @@ -731,6 +733,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // otherwise it will clear the suggestion strip. setPunctuationSuggestions(); } + mSuggestedWords = SuggestedWords.EMPTY; mConnection.resetCachesUponCursorMove(editorInfo.initialSelStart); @@ -995,7 +998,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction false /* isPrediction */); // When in fullscreen mode, show completions generated by the application final boolean isAutoCorrection = false; - setSuggestionStrip(suggestedWords, isAutoCorrection); + setSuggestedWords(suggestedWords, isAutoCorrection); setAutoCorrectionIndicator(isAutoCorrection); setSuggestionStripShown(true); if (ProductionFlag.IS_EXPERIMENTAL) { @@ -1120,7 +1123,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction if (mSettings.getCurrent().mBigramPredictionEnabled) { clearSuggestionStrip(); } else { - setSuggestionStrip(mSettings.getCurrent().mSuggestPuncList, false); + setSuggestedWords(mSettings.getCurrent().mSuggestPuncList, false); } mConnection.resetCachesUponCursorMove(newCursorPosition); } @@ -1983,8 +1986,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // Outside LatinIME, only used by the test suite. @UsedForTesting boolean isShowingPunctuationList() { - if (mSuggestionStripView == null) return false; - return mSettings.getCurrent().mSuggestPuncList == mSuggestionStripView.getSuggestions(); + if (mSuggestedWords == null) return false; + return mSettings.getCurrent().mSuggestPuncList == mSuggestedWords; } private boolean isSuggestionsStripVisible() { @@ -2000,11 +2003,12 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } private void clearSuggestionStrip() { - setSuggestionStrip(SuggestedWords.EMPTY, false); + setSuggestedWords(SuggestedWords.EMPTY, false); setAutoCorrectionIndicator(false); } - private void setSuggestionStrip(final SuggestedWords words, final boolean isAutoCorrection) { + private void setSuggestedWords(final SuggestedWords words, final boolean isAutoCorrection) { + mSuggestedWords = words; if (mSuggestionStripView != null) { mSuggestionStripView.setSuggestions(words); mKeyboardSwitcher.onAutoCorrectionStateChanged(isAutoCorrection); @@ -2087,15 +2091,16 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } private SuggestedWords getOlderSuggestions(final String typedWord) { - SuggestedWords previousSuggestions = mSuggestionStripView.getSuggestions(); - if (previousSuggestions == mSettings.getCurrent().mSuggestPuncList) { - previousSuggestions = SuggestedWords.EMPTY; + SuggestedWords previousSuggestedWords = mSuggestedWords; + if (previousSuggestedWords == mSettings.getCurrent().mSuggestPuncList) { + previousSuggestedWords = SuggestedWords.EMPTY; } if (typedWord == null) { - return previousSuggestions; + return previousSuggestedWords; } final ArrayList<SuggestedWords.SuggestedWordInfo> typedWordAndPreviousSuggestions = - SuggestedWords.getTypedWordAndPreviousSuggestions(typedWord, previousSuggestions); + SuggestedWords.getTypedWordAndPreviousSuggestions(typedWord, + previousSuggestedWords); return new SuggestedWords(typedWordAndPreviousSuggestions, false /* typedWordValid */, false /* hasAutoCorrectionCandidate */, @@ -2117,7 +2122,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } mWordComposer.setAutoCorrection(autoCorrection); final boolean isAutoCorrection = suggestedWords.willAutoCorrect(); - setSuggestionStrip(suggestedWords, isAutoCorrection); + setSuggestedWords(suggestedWords, isAutoCorrection); setAutoCorrectionIndicator(isAutoCorrection); setSuggestionStripShown(isSuggestionsStripVisible()); } @@ -2140,7 +2145,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction Stats.onAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer); } if (ProductionFlag.IS_EXPERIMENTAL) { - final SuggestedWords suggestedWords = mSuggestionStripView.getSuggestions(); + final SuggestedWords suggestedWords = mSuggestedWords; ResearchLogger.latinIme_commitCurrentAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer.isBatchMode(), suggestedWords); } @@ -2165,7 +2170,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // interface @Override public void pickSuggestionManually(final int index, final String suggestion) { - final SuggestedWords suggestedWords = mSuggestionStripView.getSuggestions(); + final SuggestedWords suggestedWords = mSuggestedWords; // If this is a punctuation picked from the suggestion strip, pass it to onCodeInput if (suggestion.length() == 1 && isShowingPunctuationList()) { // Word separators are suggested before the user inputs something. @@ -2197,6 +2202,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction if (mSettings.getCurrent().isApplicationSpecifiedCompletionsOn() && mApplicationSpecifiedCompletions != null && index >= 0 && index < mApplicationSpecifiedCompletions.length) { + mSuggestedWords = SuggestedWords.EMPTY; if (mSuggestionStripView != null) { mSuggestionStripView.clear(); } @@ -2252,7 +2258,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction */ private void commitChosenWord(final String chosenWord, final int commitType, final String separatorString) { - final SuggestedWords suggestedWords = mSuggestionStripView.getSuggestions(); + final SuggestedWords suggestedWords = mSuggestedWords; mConnection.commitText(SuggestionSpanUtils.getTextWithSuggestionSpan( this, chosenWord, suggestedWords, mIsMainDictionaryAvailable), 1); // Add the word to the user history dictionary @@ -2269,7 +2275,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction if (mSettings.getCurrent().mBigramPredictionEnabled) { clearSuggestionStrip(); } else { - setSuggestionStrip(mSettings.getCurrent().mSuggestPuncList, false); + setSuggestedWords(mSettings.getCurrent().mSuggestPuncList, false); } setAutoCorrectionIndicator(false); setSuggestionStripShown(isSuggestionsStripVisible()); @@ -2566,6 +2572,12 @@ public final class LatinIME extends InputMethodService implements KeyboardAction dialog.show(); } + // TODO: can this be removed somehow without breaking the tests? + @UsedForTesting + /* package for test */ String getFirstSuggestedWord() { + return mSuggestedWords.size() > 0 ? mSuggestedWords.getWord(0) : null; + } + public void debugDumpStateAndCrashWithException(final String context) { final StringBuilder s = new StringBuilder(); s.append("Target application : ").append(mTargetApplicationInfo.name) diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java index bc51d5d62..5a29eee4e 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java @@ -644,10 +644,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick return false; } - public SuggestedWords getSuggestions() { - return mSuggestedWords; - } - public void clear() { mSuggestionsStrip.removeAllViews(); removeAllViews(); |