Merge "[IL111] Remove a member."
This commit is contained in:
commit
27c23c691c
3 changed files with 30 additions and 22 deletions
|
@ -124,9 +124,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
private View mKeyPreviewBackingView;
|
private View mKeyPreviewBackingView;
|
||||||
private SuggestionStripView mSuggestionStripView;
|
private SuggestionStripView mSuggestionStripView;
|
||||||
|
|
||||||
// TODO[IL]: remove this member completely.
|
|
||||||
public CompletionInfo[] mApplicationSpecifiedCompletions;
|
|
||||||
|
|
||||||
private RichInputMethodManager mRichImm;
|
private RichInputMethodManager mRichImm;
|
||||||
@UsedForTesting final KeyboardSwitcher mKeyboardSwitcher;
|
@UsedForTesting final KeyboardSwitcher mKeyboardSwitcher;
|
||||||
private final SubtypeSwitcher mSubtypeSwitcher;
|
private final SubtypeSwitcher mSubtypeSwitcher;
|
||||||
|
@ -812,7 +809,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// The EditorInfo might have a flag that affects fullscreen mode.
|
// The EditorInfo might have a flag that affects fullscreen mode.
|
||||||
// Note: This call should be done by InputMethodService?
|
// Note: This call should be done by InputMethodService?
|
||||||
updateFullscreenMode();
|
updateFullscreenMode();
|
||||||
mApplicationSpecifiedCompletions = null;
|
|
||||||
|
|
||||||
// The app calling setText() has the effect of clearing the composing
|
// The app calling setText() has the effect of clearing the composing
|
||||||
// span, so we should reset our state unconditionally, even if restarting is true.
|
// span, so we should reset our state unconditionally, even if restarting is true.
|
||||||
|
@ -1034,8 +1030,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mApplicationSpecifiedCompletions =
|
|
||||||
CompletionInfoUtils.removeNulls(applicationSpecifiedCompletions);
|
|
||||||
|
|
||||||
final ArrayList<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords =
|
final ArrayList<SuggestedWords.SuggestedWordInfo> applicationSuggestedWords =
|
||||||
SuggestedWords.getFromApplicationSpecifiedCompletions(
|
SuggestedWords.getFromApplicationSpecifiedCompletions(
|
||||||
|
|
|
@ -167,15 +167,10 @@ public class SuggestedWords {
|
||||||
final CompletionInfo[] infos) {
|
final CompletionInfo[] infos) {
|
||||||
final ArrayList<SuggestedWordInfo> result = CollectionUtils.newArrayList();
|
final ArrayList<SuggestedWordInfo> result = CollectionUtils.newArrayList();
|
||||||
for (final CompletionInfo info : infos) {
|
for (final CompletionInfo info : infos) {
|
||||||
if (info == null) continue;
|
if (null == info || null == info.getText()) {
|
||||||
final CharSequence text = info.getText();
|
continue;
|
||||||
if (null == text) continue;
|
}
|
||||||
final SuggestedWordInfo suggestedWordInfo = new SuggestedWordInfo(text.toString(),
|
result.add(new SuggestedWordInfo(info));
|
||||||
SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_APP_DEFINED,
|
|
||||||
Dictionary.DICTIONARY_APPLICATION_DEFINED,
|
|
||||||
SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */,
|
|
||||||
SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */);
|
|
||||||
result.add(suggestedWordInfo);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -234,6 +229,9 @@ public class SuggestedWords {
|
||||||
public static final int KIND_FLAG_EXACT_MATCH = 0x40000000;
|
public static final int KIND_FLAG_EXACT_MATCH = 0x40000000;
|
||||||
|
|
||||||
public final String mWord;
|
public final String mWord;
|
||||||
|
// The completion info from the application. Null for suggestions that don't come from
|
||||||
|
// the application (including keyboard-computed ones, so this is almost always null)
|
||||||
|
public final CompletionInfo mApplicationSpecifiedCompletionInfo;
|
||||||
public final int mScore;
|
public final int mScore;
|
||||||
public final int mKind; // one of the KIND_* constants above
|
public final int mKind; // one of the KIND_* constants above
|
||||||
public final int mCodePointCount;
|
public final int mCodePointCount;
|
||||||
|
@ -260,6 +258,7 @@ public class SuggestedWords {
|
||||||
final Dictionary sourceDict, final int indexOfTouchPointOfSecondWord,
|
final Dictionary sourceDict, final int indexOfTouchPointOfSecondWord,
|
||||||
final int autoCommitFirstWordConfidence) {
|
final int autoCommitFirstWordConfidence) {
|
||||||
mWord = word;
|
mWord = word;
|
||||||
|
mApplicationSpecifiedCompletionInfo = null;
|
||||||
mScore = score;
|
mScore = score;
|
||||||
mKind = kind;
|
mKind = kind;
|
||||||
mSourceDict = sourceDict;
|
mSourceDict = sourceDict;
|
||||||
|
@ -268,6 +267,22 @@ public class SuggestedWords {
|
||||||
mAutoCommitFirstWordConfidence = autoCommitFirstWordConfidence;
|
mAutoCommitFirstWordConfidence = autoCommitFirstWordConfidence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new suggested word info from an application-specified completion.
|
||||||
|
* If the passed argument or its contained text is null, this throws a NPE.
|
||||||
|
* @param applicationSpecifiedCompletion The application-specified completion info.
|
||||||
|
*/
|
||||||
|
public SuggestedWordInfo(final CompletionInfo applicationSpecifiedCompletion) {
|
||||||
|
mWord = applicationSpecifiedCompletion.getText().toString();
|
||||||
|
mApplicationSpecifiedCompletionInfo = applicationSpecifiedCompletion;
|
||||||
|
mScore = SuggestedWordInfo.MAX_SCORE;
|
||||||
|
mKind = SuggestedWordInfo.KIND_APP_DEFINED;
|
||||||
|
mSourceDict = Dictionary.DICTIONARY_APPLICATION_DEFINED;
|
||||||
|
mCodePointCount = StringUtils.codePointCount(mWord);
|
||||||
|
mIndexOfTouchPointOfSecondWord = SuggestedWordInfo.NOT_AN_INDEX;
|
||||||
|
mAutoCommitFirstWordConfidence = SuggestedWordInfo.NOT_A_CONFIDENCE;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isEligibleForAutoCommit() {
|
public boolean isEligibleForAutoCommit() {
|
||||||
return (KIND_CORRECTION == mKind && NOT_AN_INDEX != mIndexOfTouchPointOfSecondWord);
|
return (KIND_CORRECTION == mKind && NOT_AN_INDEX != mIndexOfTouchPointOfSecondWord);
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,17 +227,16 @@ public final class InputLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: stop relying on mApplicationSpecifiedCompletions. The SuggestionInfo object
|
// TODO: We should not need the following branch. We should be able to take the same
|
||||||
// should contain a reference to the CompletionInfo instead.
|
// code path as for other kinds, use commitChosenWord, and do everything normally. We will
|
||||||
if (settingsValues.isApplicationSpecifiedCompletionsOn()
|
// however need to reset the suggestion strip right away, because we know we can't take
|
||||||
&& mLatinIME.mApplicationSpecifiedCompletions != null
|
// the risk of calling commitCompletion twice because we don't know how the app will react.
|
||||||
&& index >= 0 && index < mLatinIME.mApplicationSpecifiedCompletions.length) {
|
if (SuggestedWordInfo.KIND_APP_DEFINED == suggestionInfo.mKind) {
|
||||||
mSuggestedWords = SuggestedWords.EMPTY;
|
mSuggestedWords = SuggestedWords.EMPTY;
|
||||||
mSuggestionStripViewAccessor.setNeutralSuggestionStrip();
|
mSuggestionStripViewAccessor.setNeutralSuggestionStrip();
|
||||||
keyboardSwitcher.updateShiftState();
|
keyboardSwitcher.updateShiftState();
|
||||||
resetComposingState(true /* alsoResetLastComposedWord */);
|
resetComposingState(true /* alsoResetLastComposedWord */);
|
||||||
final CompletionInfo completionInfo = mLatinIME.mApplicationSpecifiedCompletions[index];
|
mConnection.commitCompletion(suggestionInfo.mApplicationSpecifiedCompletionInfo);
|
||||||
mConnection.commitCompletion(completionInfo);
|
|
||||||
mConnection.endBatchEdit();
|
mConnection.endBatchEdit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue