Fix the highlight error and remove the empty card
Fix: 209918251
Test: manual
Change-Id: I2a5afceea18cd4e1009114091433a2da22ac105e
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java
index d5e8235..9076053 100644
--- a/src/com/android/settings/homepage/SettingsHomepageActivity.java
+++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -125,11 +125,8 @@
}
Log.i(TAG, "showHomepageWithSuggestion: " + showSuggestion);
final View homepageView = mHomepageView;
- if (!mIsTwoPaneLastTime) {
- mSuggestionView.setVisibility(showSuggestion ? View.VISIBLE : View.GONE);
- } else {
- mTwoPaneSuggestionView.setVisibility(showSuggestion ? View.VISIBLE : View.GONE);
- }
+ mSuggestionView.setVisibility(showSuggestion ? View.VISIBLE : View.GONE);
+ mTwoPaneSuggestionView.setVisibility(showSuggestion ? View.VISIBLE : View.GONE);
mHomepageView = null;
mLoadedListeners.forEach(listener -> listener.onHomepageLoaded());
diff --git a/src/com/android/settings/homepage/TopLevelSettings.java b/src/com/android/settings/homepage/TopLevelSettings.java
index 2bb8e34..f2e5a35 100644
--- a/src/com/android/settings/homepage/TopLevelSettings.java
+++ b/src/com/android/settings/homepage/TopLevelSettings.java
@@ -54,6 +54,7 @@
private static final String PREF_KEY_SUPPORT = "top_level_support";
private TopLevelHighlightMixin mHighlightMixin;
+ private boolean mFirstStarted = true;
public TopLevelSettings() {
final Bundle args = new Bundle();
@@ -135,9 +136,11 @@
@Override
public void onStart() {
- // Set default highlight menu key for 1-pane homepage since it will show the placeholder
- // page once changing back to 2-pane.
- if (!ActivityEmbeddingUtils.isTwoPaneResolution(getActivity())) {
+ if (mFirstStarted) {
+ mFirstStarted = false;
+ } else if (!ActivityEmbeddingUtils.isTwoPaneResolution(getActivity())) {
+ // Set default highlight menu key for 1-pane homepage since it will show the placeholder
+ // page once changing back to 2-pane.
setHighlightMenuKey(getString(SettingsHomepageActivity.DEFAULT_HIGHLIGHT_MENU_KEY),
/* scrollNeeded= */ false);
}