diff options
author | 2014-06-05 11:25:56 +0900 | |
---|---|---|
committer | 2014-06-06 19:41:21 +0900 | |
commit | 987bff9136ec101d06db7903ebb3f505e4ea78d6 (patch) | |
tree | 0711cd218040947e63641120b905afb268114779 /java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java | |
parent | 8cae9f50b4081564f98abd75d45d19f8091348f2 (diff) | |
download | latinime-987bff9136ec101d06db7903ebb3f505e4ea78d6.tar.gz latinime-987bff9136ec101d06db7903ebb3f505e4ea78d6.tar.xz latinime-987bff9136ec101d06db7903ebb3f505e4ea78d6.zip |
Refactor logic to determine showing suggestions strip or not
The logic to determine when the suggestions strip (a.k.a. the
contextual strip) should be shown is already complex. In addition to
that the voice input key get shown on the strip as well. There are a
several factors to be considered and a few things to control.
- The password input field shouldn't have the strip.
- Show voice input key on the strip or not.
- User preference settings "Show Voice Input Key".
- A voice IME exists and is enabled.
- The input field may have a private IME option to prevent the voice
input key from being displayed.
- Application can specify auto completions.
- Full screen mode or not.
- User preference settings "Show correction suggestions".
- Always show, Show in portrait mode, Always hide.
- The input field may have flags to prevent showing suggestions or
auto corrections.
- Suggestions is empty or not.
- An important notice may be shown.
Bug: 14981852
Bug: 15436479
Change-Id: I3050fd53ee6271fc64a8f17b6b12d9581d37b750
Diffstat (limited to 'java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java index 99d1aa753..97241498a 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java @@ -42,7 +42,6 @@ import com.android.inputmethod.keyboard.MainKeyboardView; import com.android.inputmethod.keyboard.MoreKeysPanel; import com.android.inputmethod.latin.AudioAndHapticFeedbackManager; import com.android.inputmethod.latin.Constants; -import com.android.inputmethod.latin.InputAttributes; import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.SuggestedWords; @@ -207,9 +206,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick final int visibility = shouldBeVisible ? VISIBLE : (isFullscreenMode ? GONE : INVISIBLE); setVisibility(visibility); final SettingsValues currentSettingsValues = Settings.getInstance().getCurrent(); - final boolean shouldShowVoiceKey = (currentSettingsValues != null) - && currentSettingsValues.mShowsVoiceInputKey; - mVoiceKey.setVisibility(shouldShowVoiceKey ? VISIBLE : INVISIBLE); + mVoiceKey.setVisibility(currentSettingsValues.mShowsVoiceInputKey ? VISIBLE : INVISIBLE); } public void setSuggestions(final SuggestedWords suggestedWords, final boolean isRtlLanguage) { @@ -249,8 +246,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick // This method checks if we should show the important notice (checks on permanent storage if // it has been shown once already or not, and if in the setup wizard). If applicable, it shows // the notice. In all cases, it returns true if it was shown, false otherwise. - public boolean maybeShowImportantNoticeTitle(final InputAttributes inputAttributes) { - if (!ImportantNoticeUtils.shouldShowImportantNotice(getContext(), inputAttributes)) { + public boolean maybeShowImportantNoticeTitle() { + if (!ImportantNoticeUtils.shouldShowImportantNotice(getContext())) { return false; } if (getWidth() <= 0) { @@ -475,7 +472,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick // Called by the framework when the size is known. Show the important notice if applicable. // This may be overriden by showing suggestions later, if applicable. if (oldw <= 0 && w > 0) { - maybeShowImportantNoticeTitle(Settings.getInstance().getCurrent().mInputAttributes); + maybeShowImportantNoticeTitle(); } } } |