aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorChieu Nguyen <cvnguyen@google.com>2015-03-18 22:36:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-03-18 22:36:10 +0000
commitb56f7d8ca47e5936afe0459928bae49cae6e3615 (patch)
tree55acbbc4044d0792ce435dc46943eea6c5273e91 /java/src
parent59d3408727488d461fc45f2131ad81124d035dd1 (diff)
parent8ec36026c93d13c1118eda936ac12325e0085561 (diff)
downloadlatinime-b56f7d8ca47e5936afe0459928bae49cae6e3615.tar.gz
latinime-b56f7d8ca47e5936afe0459928bae49cae6e3615.tar.xz
latinime-b56f7d8ca47e5936afe0459928bae49cae6e3615.zip
Merge "Disable message if personalization is disabled."
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java2
-rw-r--r--java/src/com/android/inputmethod/latin/settings/SettingsValues.java4
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java3
-rw-r--r--java/src/com/android/inputmethod/latin/utils/ImportantNoticeUtils.java8
4 files changed, 14 insertions, 3 deletions
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;
}