| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
|
| index ed07b24b808799a63c7534d99b78318c5b591569..2b32ad21d0658a498b6b268eacb4e6dbef317f5a 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
|
| @@ -5,6 +5,7 @@
|
| package org.chromium.chrome.browser.ntp;
|
|
|
| import android.content.Context;
|
| +import android.content.res.Resources;
|
| import android.util.AttributeSet;
|
| import android.view.View;
|
|
|
| @@ -29,6 +30,7 @@
|
| private final int mMiddleSpacerHeight;
|
| private final int mBottomSpacerHeight;
|
| private final int mTotalSpacerHeight;
|
| + private final int mMostVisitedLayoutBleed;
|
|
|
| private int mParentScrollViewportHeight;
|
|
|
| @@ -37,16 +39,22 @@
|
| private View mBottomSpacer;
|
| private View mScrollCompensationSpacer;
|
|
|
| + private LogoView mSearchProviderLogoView;
|
| + private View mSearchBoxView;
|
| + private MostVisitedLayout mMostVisitedLayout;
|
| +
|
| /**
|
| * Constructor for inflating from XML.
|
| */
|
| public NewTabPageLayout(Context context, AttributeSet attrs) {
|
| super(context, attrs);
|
| - float density = getResources().getDisplayMetrics().density;
|
| + Resources res = getResources();
|
| + float density = res.getDisplayMetrics().density;
|
| mTopSpacerHeight = Math.round(density * TOP_SPACER_HEIGHT_DP);
|
| mMiddleSpacerHeight = Math.round(density * MIDDLE_SPACER_HEIGHT_DP);
|
| mBottomSpacerHeight = Math.round(density * BOTTOM_SPACER_HEIGHT_DP);
|
| mTotalSpacerHeight = Math.round(density * TOTAL_SPACER_HEIGHT_DP);
|
| + mMostVisitedLayoutBleed = res.getDimensionPixelSize(R.dimen.most_visited_layout_bleed);
|
| }
|
|
|
| @Override
|
| @@ -56,6 +64,9 @@ protected void onFinishInflate() {
|
| mMiddleSpacer = findViewById(R.id.ntp_middle_spacer);
|
| mBottomSpacer = findViewById(R.id.ntp_bottom_spacer);
|
| mScrollCompensationSpacer = findViewById(R.id.ntp_scroll_spacer);
|
| + mSearchProviderLogoView = (LogoView) findViewById(R.id.search_provider_logo);
|
| + mSearchBoxView = findViewById(R.id.search_box);
|
| + mMostVisitedLayout = (MostVisitedLayout) findViewById(R.id.most_visited_layout);
|
| }
|
|
|
| /**
|
| @@ -106,6 +117,19 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
| } else {
|
| mScrollCompensationSpacer.setVisibility(View.GONE);
|
| }
|
| +
|
| + // Make the search box and logo as wide as the most visited items
|
| + if (mMostVisitedLayout.getVisibility() != GONE) {
|
| + int mostVisitedWidthSpec = MeasureSpec.makeMeasureSpec(
|
| + mMostVisitedLayout.getMeasuredWidth() - mMostVisitedLayoutBleed,
|
| + MeasureSpec.EXACTLY);
|
| + int searchBoxHeight = MeasureSpec.makeMeasureSpec(
|
| + mSearchBoxView.getMeasuredHeight(), MeasureSpec.EXACTLY);
|
| + mSearchBoxView.measure(mostVisitedWidthSpec, searchBoxHeight);
|
| + int logoHeight = MeasureSpec.makeMeasureSpec(
|
| + mSearchProviderLogoView.getMeasuredHeight(), MeasureSpec.EXACTLY);
|
| + mSearchProviderLogoView.measure(mostVisitedWidthSpec, logoHeight);
|
| + }
|
| }
|
|
|
| /**
|
|
|