From 8ec36026c93d13c1118eda936ac12325e0085561 Mon Sep 17 00:00:00 2001 From: Chieu Nguyen Date: Wed, 18 Mar 2015 13:43:55 -0700 Subject: Disable message if personalization is disabled. Bug: 19087415. Change-Id: I3974f1b676aa4a9bb04ab7f609b6daf1860c64f1 --- java/src/com/android/inputmethod/latin/LatinIME.java | 2 +- .../com/android/inputmethod/latin/settings/SettingsValues.java | 4 ++++ .../inputmethod/latin/suggestions/SuggestionStripView.java | 3 ++- .../com/android/inputmethod/latin/utils/ImportantNoticeUtils.java | 8 +++++++- 4 files changed, 14 insertions(+), 3 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 4ddde1926..a8aeb8795 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1450,7 +1450,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } final boolean shouldShowImportantNotice = - ImportantNoticeUtils.shouldShowImportantNotice(this); + ImportantNoticeUtils.shouldShowImportantNotice(this, currentSettingsValues); final boolean shouldShowSuggestionCandidates = currentSettingsValues.mInputAttributes.mShouldShowSuggestions && currentSettingsValues.isSuggestionsEnabledPerUserSettings(); diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java index e21b9ffca..d112e7200 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java @@ -237,6 +237,10 @@ public class SettingsValues { return mSuggestionsEnabledPerUserSettings; } + public boolean isPersonalizationEnabled() { + return mUsePersonalizedDicts; + } + public boolean isWordSeparator(final int code) { return mSpacingAndPunctuations.isWordSeparator(code); } diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java index 17525f650..7dd0f03df 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java @@ -213,7 +213,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick // 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() { - if (!ImportantNoticeUtils.shouldShowImportantNotice(getContext())) { + final SettingsValues currentSettingsValues = Settings.getInstance().getCurrent(); + if (!ImportantNoticeUtils.shouldShowImportantNotice(getContext(), currentSettingsValues)) { return false; } if (getWidth() <= 0) { diff --git a/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java b/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java index 142548b25..df0cd8437 100644 --- a/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java @@ -25,6 +25,7 @@ import android.util.Log; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.latin.R; +import com.android.inputmethod.latin.settings.SettingsValues; import java.util.concurrent.TimeUnit; @@ -105,7 +106,12 @@ public final class ImportantNoticeUtils { return elapsedTime >= TIMEOUT_OF_IMPORTANT_NOTICE; } - public static boolean shouldShowImportantNotice(final Context context) { + public static boolean shouldShowImportantNotice(final Context context, + final SettingsValues settingsValues) { + // Check to see whether personalization is enabled by the user. + if (!settingsValues.isPersonalizationEnabled()) { + return false; + } if (!hasNewImportantNotice(context)) { return false; } -- cgit v1.2.3-83-g751a