diff options
author | 2014-02-03 11:49:34 +0900 | |
---|---|---|
committer | 2014-02-10 21:15:35 +0900 | |
commit | 8dda9e480b6519ca57565c8aa507e14bff739b60 (patch) | |
tree | a4283b0102da8f3609381084bb320289bd483832 /java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java | |
parent | 6422f77e9497120fe6b2d7ec012c214c06829bab (diff) | |
download | latinime-8dda9e480b6519ca57565c8aa507e14bff739b60.tar.gz latinime-8dda9e480b6519ca57565c8aa507e14bff739b60.tar.xz latinime-8dda9e480b6519ca57565c8aa507e14bff739b60.zip |
Show important notice strip
Bug: 10587358
Change-Id: I1af3faa59afb2fc4cb90176acff1c2b0b1ba369c
Diffstat (limited to 'java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java | 23 |
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(); + } } |