From 987bff9136ec101d06db7903ebb3f505e4ea78d6 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 5 Jun 2014 11:25:56 +0900 Subject: 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 --- .../inputmethod/latin/utils/ImportantNoticeUtils.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java') diff --git a/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java b/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java index 7d937a9d2..8b7077879 100644 --- a/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java @@ -23,7 +23,6 @@ import android.provider.Settings.SettingNotFoundException; import android.text.TextUtils; import android.util.Log; -import com.android.inputmethod.latin.InputAttributes; import com.android.inputmethod.latin.R; public final class ImportantNoticeUtils { @@ -78,14 +77,7 @@ public final class ImportantNoticeUtils { return getCurrentImportantNoticeVersion(context) > lastVersion; } - public static boolean shouldShowImportantNotice(final Context context, - final InputAttributes inputAttributes) { - if (inputAttributes == null || inputAttributes.mIsPasswordField) { - return false; - } - if (isInSystemSetupWizard(context)) { - return false; - } + public static boolean shouldShowImportantNotice(final Context context) { if (!hasNewImportantNotice(context)) { return false; } @@ -93,6 +85,9 @@ public final class ImportantNoticeUtils { if (TextUtils.isEmpty(importantNoticeTitle)) { return false; } + if (isInSystemSetupWizard(context)) { + return false; + } return true; } -- cgit v1.2.3-83-g751a