aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-02-10 04:27:26 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2014-02-10 04:27:26 -0800
commit909ad2c4ff38b24aad59fba2a95b530248704ce9 (patch)
tree6f38f8a3c0cf7ef557285aca0a1493ff7ab2d7a6 /java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
parentb4747d83004c57e425b933ed89826440b4a0bce1 (diff)
parentf9e5b1ee4ffa08fd10f8685cceff34daf2258ae0 (diff)
downloadlatinime-909ad2c4ff38b24aad59fba2a95b530248704ce9.tar.gz
latinime-909ad2c4ff38b24aad59fba2a95b530248704ce9.tar.xz
latinime-909ad2c4ff38b24aad59fba2a95b530248704ce9.zip
am f9e5b1ee: Merge "Show important notice strip"
* commit 'f9e5b1ee4ffa08fd10f8685cceff34daf2258ae0': Show important notice strip
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();
+ }
}