am 2c4cce8d
: Merge "Introduce #shouldShowAddToDictionaryHint" into lmp-dev
* commit '2c4cce8d6c92dc4492e4376a2b3973d76a016fdd': Introduce #shouldShowAddToDictionaryHint
This commit is contained in:
commit
b65a1e46ce
1 changed files with 15 additions and 8 deletions
|
@ -232,6 +232,20 @@ public final class InputLogic {
|
||||||
return inputTransaction;
|
return inputTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether "Touch again to save" should be shown or not.
|
||||||
|
* @param suggestionInfo the suggested word chosen by the user.
|
||||||
|
* @return {@code true} if we should show the "Touch again to save" hint.
|
||||||
|
*/
|
||||||
|
private boolean shouldShowAddToDictionaryHint(final SuggestedWordInfo suggestionInfo) {
|
||||||
|
// We should show the "Touch again to save" hint if the user pressed the first entry
|
||||||
|
// AND it's in none of our current dictionaries (main, user or otherwise).
|
||||||
|
return (suggestionInfo.isKindOf(SuggestedWordInfo.KIND_TYPED)
|
||||||
|
|| suggestionInfo.isKindOf(SuggestedWordInfo.KIND_OOV_CORRECTION))
|
||||||
|
&& !mDictionaryFacilitator.isValidWord(suggestionInfo.mWord, true /* ignoreCase */)
|
||||||
|
&& mDictionaryFacilitator.isUserDictionaryEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A suggestion was picked from the suggestion strip.
|
* A suggestion was picked from the suggestion strip.
|
||||||
* @param settingsValues the current values of the settings.
|
* @param settingsValues the current values of the settings.
|
||||||
|
@ -298,14 +312,7 @@ public final class InputLogic {
|
||||||
mSpaceState = SpaceState.PHANTOM;
|
mSpaceState = SpaceState.PHANTOM;
|
||||||
inputTransaction.requireShiftUpdate(InputTransaction.SHIFT_UPDATE_NOW);
|
inputTransaction.requireShiftUpdate(InputTransaction.SHIFT_UPDATE_NOW);
|
||||||
|
|
||||||
// We should show the "Touch again to save" hint if the user pressed the first entry
|
if (shouldShowAddToDictionaryHint(suggestionInfo)) {
|
||||||
// AND it's in none of our current dictionaries (main, user or otherwise).
|
|
||||||
final boolean showingAddToDictionaryHint =
|
|
||||||
(suggestionInfo.isKindOf(SuggestedWordInfo.KIND_TYPED)
|
|
||||||
|| suggestionInfo.isKindOf(SuggestedWordInfo.KIND_OOV_CORRECTION))
|
|
||||||
&& !mDictionaryFacilitator.isValidWord(suggestion, true /* ignoreCase */);
|
|
||||||
|
|
||||||
if (showingAddToDictionaryHint && mDictionaryFacilitator.isUserDictionaryEnabled()) {
|
|
||||||
mSuggestionStripViewAccessor.showAddToDictionaryHint(suggestion);
|
mSuggestionStripViewAccessor.showAddToDictionaryHint(suggestion);
|
||||||
} else {
|
} else {
|
||||||
// If we're not showing the "Touch again to save", then update the suggestion strip.
|
// If we're not showing the "Touch again to save", then update the suggestion strip.
|
||||||
|
|
Loading…
Reference in a new issue