Remove mIsApplicationSpecifiedCompletions flags from SuggestedWords

Bug: 3504990
Change-Id: Ib7588ab05fa8b8ab58bf3bea6ff1f644c53ebb94
This commit is contained in:
Tadashi G. Takaoka 2011-03-02 17:17:15 -08:00
parent c2bbc6a449
commit 1eff7d77c8
3 changed files with 6 additions and 14 deletions

View File

@ -347,9 +347,6 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
if (mShowingAddToDictionary && index == 0) { if (mShowingAddToDictionary && index == 0) {
addToDictionary(word); addToDictionary(word);
} else { } else {
if (!mSuggestions.mIsApplicationSpecifiedCompletions) {
TextEntryState.acceptedSuggestion(mSuggestions.getWord(0), word);
}
mService.pickSuggestionManually(index, word); mService.pickSuggestionManually(index, word);
} }
} }

View File

@ -1636,6 +1636,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return; return;
} }
TextEntryState.acceptedSuggestion(suggestions.getWord(0), suggestion);
// If this is a punctuation, apply it through the normal key press // If this is a punctuation, apply it through the normal key press
if (suggestion.length() == 1 && (isWordSeparator(suggestion.charAt(0)) if (suggestion.length() == 1 && (isWordSeparator(suggestion.charAt(0))
|| isSuggestedPunctuation(suggestion.charAt(0)))) { || isSuggestedPunctuation(suggestion.charAt(0)))) {

View File

@ -24,23 +24,20 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
public class SuggestedWords { public class SuggestedWords {
public static final SuggestedWords EMPTY = new SuggestedWords(null, false, false, false, null); public static final SuggestedWords EMPTY = new SuggestedWords(null, false, false, null);
public final List<CharSequence> mWords; public final List<CharSequence> mWords;
public final boolean mIsApplicationSpecifiedCompletions;
public final boolean mTypedWordValid; public final boolean mTypedWordValid;
public final boolean mHasMinimalSuggestion; public final boolean mHasMinimalSuggestion;
public final List<SuggestedWordInfo> mSuggestedWordInfoList; public final List<SuggestedWordInfo> mSuggestedWordInfoList;
private SuggestedWords(List<CharSequence> words, boolean isApplicationSpecifiedCompletions, private SuggestedWords(List<CharSequence> words, boolean typedWordValid,
boolean typedWordValid, boolean hasMinamlSuggestion, boolean hasMinamlSuggestion, List<SuggestedWordInfo> suggestedWordInfoList) {
List<SuggestedWordInfo> suggestedWordInfoList) {
if (words != null) { if (words != null) {
mWords = words; mWords = words;
} else { } else {
mWords = Collections.emptyList(); mWords = Collections.emptyList();
} }
mIsApplicationSpecifiedCompletions = isApplicationSpecifiedCompletions;
mTypedWordValid = typedWordValid; mTypedWordValid = typedWordValid;
mHasMinimalSuggestion = hasMinamlSuggestion; mHasMinimalSuggestion = hasMinamlSuggestion;
mSuggestedWordInfoList = suggestedWordInfoList; mSuggestedWordInfoList = suggestedWordInfoList;
@ -64,7 +61,6 @@ public class SuggestedWords {
public static class Builder { public static class Builder {
private List<CharSequence> mWords = new ArrayList<CharSequence>(); private List<CharSequence> mWords = new ArrayList<CharSequence>();
private boolean mIsCompletions;
private boolean mTypedWordValid; private boolean mTypedWordValid;
private boolean mHasMinimalSuggestion; private boolean mHasMinimalSuggestion;
private List<SuggestedWordInfo> mSuggestedWordInfoList = private List<SuggestedWordInfo> mSuggestedWordInfoList =
@ -109,7 +105,6 @@ public class SuggestedWords {
public Builder setApplicationSpecifiedCompletions(CompletionInfo[] infos) { public Builder setApplicationSpecifiedCompletions(CompletionInfo[] infos) {
for (CompletionInfo info : infos) for (CompletionInfo info : infos)
addWord(info.getText()); addWord(info.getText());
mIsCompletions = true;
return this; return this;
} }
@ -141,15 +136,14 @@ public class SuggestedWords {
alreadySeen.add(prevWord); alreadySeen.add(prevWord);
} }
} }
mIsCompletions = false;
mTypedWordValid = false; mTypedWordValid = false;
mHasMinimalSuggestion = false; mHasMinimalSuggestion = false;
return this; return this;
} }
public SuggestedWords build() { public SuggestedWords build() {
return new SuggestedWords(mWords, mIsCompletions, mTypedWordValid, return new SuggestedWords(mWords, mTypedWordValid, mHasMinimalSuggestion,
mHasMinimalSuggestion, mSuggestedWordInfoList); mSuggestedWordInfoList);
} }
public int size() { public int size() {