| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
|
| index 7f075a2fd6b92a5d07db0426c9411a8f1f30391e..8fdc0c973c824a98eee487d6cf6e4c06273342ec 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
|
| @@ -6,6 +6,7 @@
|
|
|
| import android.annotation.SuppressLint;
|
| import android.content.Context;
|
| +import android.content.res.Configuration;
|
| import android.content.res.Resources;
|
| import android.graphics.Bitmap;
|
| import android.graphics.BitmapFactory;
|
| @@ -95,6 +96,7 @@
|
|
|
| private OnSearchBoxScrollListener mSearchBoxScrollListener;
|
|
|
| + private UiConfig mUiConfig;
|
| private NewTabPageManager mManager;
|
| private MostVisitedDesign mMostVisitedDesign;
|
| private MostVisitedItem[] mMostVisitedItems;
|
| @@ -255,6 +257,7 @@ public NewTabPageView(Context context, AttributeSet attrs) {
|
| public void initialize(NewTabPageManager manager, boolean searchProviderHasLogo,
|
| SnippetsBridge snippetsBridge) {
|
| mManager = manager;
|
| + mUiConfig = new UiConfig(this);
|
| ViewStub stub = (ViewStub) findViewById(R.id.new_tab_page_layout_stub);
|
|
|
| mUseCardsUi = snippetsBridge != null;
|
| @@ -305,7 +308,8 @@ public void initialize(NewTabPageManager manager, boolean searchProviderHasLogo,
|
|
|
| // Set up snippets
|
| if (mUseCardsUi) {
|
| - mNewTabPageAdapter = new NewTabPageAdapter(mManager, mNewTabPageLayout, snippetsBridge);
|
| + mNewTabPageAdapter =
|
| + new NewTabPageAdapter(mManager, mNewTabPageLayout, snippetsBridge, mUiConfig);
|
| mRecyclerView.setAdapter(mNewTabPageAdapter);
|
|
|
| // Set up swipe-to-dismiss
|
| @@ -1102,6 +1106,18 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
| }
|
| }
|
|
|
| + @Override
|
| + protected void onConfigurationChanged(Configuration newConfig) {
|
| + super.onConfigurationChanged(newConfig);
|
| +
|
| + // When the viewport configuration changes, we want to update the display style so that the
|
| + // listeners are aware of the new available space. Another moment to do this update could
|
| + // be through a OnLayoutChangeListener, but then we get notified of the change after the
|
| + // layout pass, which means that the new style will only be visible after layout happens
|
| + // again. We prefer updating here to avoid having to require that additional layout pass.
|
| + mUiConfig.updateDisplayStyle();
|
| + }
|
| +
|
| private int getVerticalScroll() {
|
| if (mUseCardsUi) {
|
| return mRecyclerView.computeVerticalScrollOffset();
|
|
|