Commit e5721e18 authored by Vincent Boisselle's avatar Vincent Boisselle Committed by Commit Bot

Toggle the the SectionHeader first before doing any other update to data

When using the feed header menu mSectionHeader.toggleHeader() has side effects needed by the subsequent steps to set the SectionHeader data model before updating the SectionHeaderView through updateVisuals().

Bug: 1094437
Change-Id: Id539e2f060398cde9b8319bf6d791e032202a723
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2243601
Commit-Queue: Vincent Boisselle <vincb@google.com>
Reviewed-by: default avatarDan H <harringtond@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777982}
parent cef20045
...@@ -288,14 +288,15 @@ class FeedSurfaceMediator implements NewTabPageLayout.ScrollDelegate, ...@@ -288,14 +288,15 @@ class FeedSurfaceMediator implements NewTabPageLayout.ScrollDelegate,
/** Update whether the section header should be expanded and its text contents. */ /** Update whether the section header should be expanded and its text contents. */
private void updateSectionHeader() { private void updateSectionHeader() {
boolean suggestionsVisible =
PrefServiceBridge.getInstance().getBoolean(Pref.ARTICLES_LIST_VISIBLE);
if (mSectionHeader.isExpanded() != suggestionsVisible) mSectionHeader.toggleHeader();
mSectionHeader.setHeaderText(getSectionHeaderText(mSectionHeader.isExpanded())); mSectionHeader.setHeaderText(getSectionHeaderText(mSectionHeader.isExpanded()));
if (mHasHeaderMenu) { if (mHasHeaderMenu) {
mSectionHeader.setMenuModelList(buildMenuItems()); mSectionHeader.setMenuModelList(buildMenuItems());
} }
boolean suggestionsVisible =
PrefServiceBridge.getInstance().getBoolean(Pref.ARTICLES_LIST_VISIBLE);
if (mSectionHeader.isExpanded() != suggestionsVisible) mSectionHeader.toggleHeader();
if (mSignInPromo != null) { if (mSignInPromo != null) {
mSignInPromo.setCanShowPersonalizedSuggestions(suggestionsVisible); mSignInPromo.setCanShowPersonalizedSuggestions(suggestionsVisible);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment