am 30a72da4: [IL37] Small simplification

* commit '30a72da42c479adb4cedff5d7a40846a3103ac9b':
  [IL37] Small simplification
main
Jean Chalard 2013-12-25 21:22:52 -08:00 committed by Android Git Automerger
commit 69d8055bb6
3 changed files with 7 additions and 12 deletions

View File

@ -1147,7 +1147,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override @Override
public boolean onEvaluateFullscreenMode() { public boolean onEvaluateFullscreenMode() {
// Reread resource value here, because this method is called by framework anytime as needed. // Reread resource value here, because this method is called by the framework as needed.
final boolean isFullscreenModeAllowed = Settings.readUseFullscreenMode(getResources()); final boolean isFullscreenModeAllowed = Settings.readUseFullscreenMode(getResources());
if (super.onEvaluateFullscreenMode() && isFullscreenModeAllowed) { if (super.onEvaluateFullscreenMode() && isFullscreenModeAllowed) {
// TODO: Remove this hack. Actually we should not really assume NO_EXTRACT_UI // TODO: Remove this hack. Actually we should not really assume NO_EXTRACT_UI
@ -1628,9 +1628,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
autoCorrection = typedWord; autoCorrection = typedWord;
} }
mInputLogic.mWordComposer.setAutoCorrection(autoCorrection); mInputLogic.mWordComposer.setAutoCorrection(autoCorrection);
final boolean isAutoCorrection = suggestedWords.willAutoCorrect(); setSuggestedWords(suggestedWords, suggestedWords.mWillAutoCorrect);
setSuggestedWords(suggestedWords, isAutoCorrection); setAutoCorrectionIndicator(suggestedWords.mWillAutoCorrect);
setAutoCorrectionIndicator(isAutoCorrection);
setSuggestionStripShown(isSuggestionsStripVisible()); setSuggestionStripShown(isSuggestionsStripVisible());
// An auto-correction is available, cache it in accessibility code so // An auto-correction is available, cache it in accessibility code so
// we can be speak it if the user touches a key that will insert it. // we can be speak it if the user touches a key that will insert it.

View File

@ -104,10 +104,6 @@ public final class SuggestedWords {
return debugString; return debugString;
} }
public boolean willAutoCorrect() {
return mWillAutoCorrect;
}
@Override @Override
public String toString() { public String toString() {
// Pretty-print method to help debug // Pretty-print method to help debug
@ -150,7 +146,7 @@ public final class SuggestedWords {
for (int index = 1; index < previousSize; index++) { for (int index = 1; index < previousSize; index++) {
final SuggestedWordInfo prevWordInfo = previousSuggestions.getInfo(index); final SuggestedWordInfo prevWordInfo = previousSuggestions.getInfo(index);
final String prevWord = prevWordInfo.mWord; final String prevWord = prevWordInfo.mWord;
// Filter out duplicate suggestion. // Filter out duplicate suggestions.
if (!alreadySeen.contains(prevWord)) { if (!alreadySeen.contains(prevWord)) {
suggestionsList.add(prevWordInfo); suggestionsList.add(prevWordInfo);
alreadySeen.add(prevWord); alreadySeen.add(prevWord);

View File

@ -208,7 +208,7 @@ final class SuggestionStripLayoutHelper {
} }
final String word = suggestedWords.getWord(indexInSuggestedWords); final String word = suggestedWords.getWord(indexInSuggestedWords);
final boolean isAutoCorrect = indexInSuggestedWords == 1 final boolean isAutoCorrect = indexInSuggestedWords == 1
&& suggestedWords.willAutoCorrect(); && suggestedWords.mWillAutoCorrect;
final boolean isTypedWordValid = indexInSuggestedWords == 0 final boolean isTypedWordValid = indexInSuggestedWords == 0
&& suggestedWords.mTypedWordValid; && suggestedWords.mTypedWordValid;
if (!isAutoCorrect && !isTypedWordValid) { if (!isAutoCorrect && !isTypedWordValid) {
@ -232,7 +232,7 @@ final class SuggestionStripLayoutHelper {
final SuggestedWords suggestedWords) { final SuggestedWords suggestedWords) {
final int indexToDisplayMostImportantSuggestion; final int indexToDisplayMostImportantSuggestion;
final int indexToDisplaySecondMostImportantSuggestion; final int indexToDisplaySecondMostImportantSuggestion;
if (suggestedWords.willAutoCorrect()) { if (suggestedWords.mWillAutoCorrect) {
indexToDisplayMostImportantSuggestion = SuggestedWords.INDEX_OF_AUTO_CORRECTION; indexToDisplayMostImportantSuggestion = SuggestedWords.INDEX_OF_AUTO_CORRECTION;
indexToDisplaySecondMostImportantSuggestion = SuggestedWords.INDEX_OF_TYPED_WORD; indexToDisplaySecondMostImportantSuggestion = SuggestedWords.INDEX_OF_TYPED_WORD;
} else { } else {
@ -257,7 +257,7 @@ final class SuggestionStripLayoutHelper {
final boolean isSuggested = (indexInSuggestedWords != SuggestedWords.INDEX_OF_TYPED_WORD); final boolean isSuggested = (indexInSuggestedWords != SuggestedWords.INDEX_OF_TYPED_WORD);
final int color; final int color;
if (positionInStrip == mCenterPositionInStrip && suggestedWords.willAutoCorrect()) { if (positionInStrip == mCenterPositionInStrip && suggestedWords.mWillAutoCorrect) {
color = mColorAutoCorrect; color = mColorAutoCorrect;
} else if (positionInStrip == mCenterPositionInStrip && suggestedWords.mTypedWordValid) { } else if (positionInStrip == mCenterPositionInStrip && suggestedWords.mTypedWordValid) {
color = mColorValidTypedWord; color = mColorValidTypedWord;