am 4197c6f3
: Merge "Show the suggestion strip for the important notice"
* commit '4197c6f3ab1db7d37bfb5fca05bd7169504f451e': Show the suggestion strip for the important notice
This commit is contained in:
commit
19d5d141a5
3 changed files with 9 additions and 6 deletions
|
@ -1320,6 +1320,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
return false;
|
return false;
|
||||||
if (mSuggestionStripView.isShowingAddToDictionaryHint())
|
if (mSuggestionStripView.isShowingAddToDictionaryHint())
|
||||||
return true;
|
return true;
|
||||||
|
if (ImportantNoticeUtils.hasNewImportantNoticeAndNotInSetupWizard(this))
|
||||||
|
return true;
|
||||||
if (null == currentSettings)
|
if (null == currentSettings)
|
||||||
return false;
|
return false;
|
||||||
if (!currentSettings.isSuggestionStripVisible())
|
if (!currentSettings.isSuggestionStripVisible())
|
||||||
|
@ -1352,7 +1354,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
if (mSuggestionStripView != null) {
|
if (mSuggestionStripView != null) {
|
||||||
final boolean showSuggestions;
|
final boolean showSuggestions;
|
||||||
if (SuggestedWords.EMPTY == suggestedWords
|
if (SuggestedWords.EMPTY == suggestedWords
|
||||||
|| suggestedWords.mIsPunctuationSuggestions) {
|
|| suggestedWords.mIsPunctuationSuggestions
|
||||||
|
|| !mSettings.getCurrent().isSuggestionsRequested()) {
|
||||||
showSuggestions = !mSuggestionStripView.maybeShowImportantNoticeTitle();
|
showSuggestions = !mSuggestionStripView.maybeShowImportantNoticeTitle();
|
||||||
} else {
|
} else {
|
||||||
showSuggestions = true;
|
showSuggestions = true;
|
||||||
|
|
|
@ -227,8 +227,7 @@ 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
|
// 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.
|
// the notice. In all cases, it returns true if it was shown, false otherwise.
|
||||||
public boolean maybeShowImportantNoticeTitle() {
|
public boolean maybeShowImportantNoticeTitle() {
|
||||||
if (!ImportantNoticeUtils.hasNewImportantNotice(getContext())
|
if (!ImportantNoticeUtils.hasNewImportantNoticeAndNotInSetupWizard(getContext())) {
|
||||||
|| ImportantNoticeUtils.isInSystemSetupWizard(getContext())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int width = getWidth();
|
final int width = getWidth();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public final class ImportantNoticeUtils {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isInSystemSetupWizard(final Context context) {
|
private static boolean isInSystemSetupWizard(final Context context) {
|
||||||
try {
|
try {
|
||||||
final int userSetupComplete = Settings.Secure.getInt(
|
final int userSetupComplete = Settings.Secure.getInt(
|
||||||
context.getContentResolver(), Settings_Secure_USER_SETUP_COMPLETE);
|
context.getContentResolver(), Settings_Secure_USER_SETUP_COMPLETE);
|
||||||
|
@ -62,10 +62,11 @@ public final class ImportantNoticeUtils {
|
||||||
return context.getResources().getInteger(R.integer.config_important_notice_version);
|
return context.getResources().getInteger(R.integer.config_important_notice_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasNewImportantNotice(final Context context) {
|
public static boolean hasNewImportantNoticeAndNotInSetupWizard(final Context context) {
|
||||||
final SharedPreferences prefs = getImportantNoticePreferences(context);
|
final SharedPreferences prefs = getImportantNoticePreferences(context);
|
||||||
final int lastVersion = prefs.getInt(KEY_IMPORTANT_NOTICE_VERSION, 0);
|
final int lastVersion = prefs.getInt(KEY_IMPORTANT_NOTICE_VERSION, 0);
|
||||||
return getCurrentImportantNoticeVersion(context) > lastVersion;
|
return getCurrentImportantNoticeVersion(context) > lastVersion
|
||||||
|
&& !isInSystemSetupWizard(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateLastImportantNoticeVersion(final Context context) {
|
public static void updateLastImportantNoticeVersion(final Context context) {
|
||||||
|
|
Loading…
Reference in a new issue