aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java')
-rw-r--r--java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index b04a2cb5b..68c891bf3 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -46,6 +46,7 @@ import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.suggestions.MoreSuggestions.MoreSuggestionsListener;
import com.android.inputmethod.latin.utils.CollectionUtils;
+import com.android.inputmethod.latin.utils.ImportantNoticeUtils;
import com.android.inputmethod.research.ResearchLogger;
import java.util.ArrayList;
@@ -220,11 +221,20 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
return false;
}
- // TODO: This method should be called after this View has been attached and displayed.
- public void showImportantNoticeTitle() {
- mLayoutHelper.layoutImportantNotice(mImportantNoticeStrip, getWidth());
+ // 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() {
+ if (!ImportantNoticeUtils.hasNewImportantNotice(getContext())
+ || ImportantNoticeUtils.isInSystemSetupWizard(getContext())) {
+ return false;
+ }
+ final int width = getWidth();
+ if (width <= 0) return false;
+ mLayoutHelper.layoutImportantNotice(mImportantNoticeStrip, width);
mStripVisibilityGroup.showImportantNoticeStrip();
mImportantNoticeStrip.setOnClickListener(this);
+ return true;
}
public void clear() {
@@ -415,4 +425,11 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
super.onDetachedFromWindow();
dismissMoreSuggestionsPanel();
}
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ // 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.
+ maybeShowImportantNoticeTitle();
+ }
}