Commit 21659326 authored by Theresa's avatar Theresa Committed by Commit Bot

[Modern] Increase height of fake search box on NTP

BUG=818754

Change-Id: I66c89c85f79d6599837abec757e89116c3de53eb
Reviewed-on: https://chromium-review.googlesource.com/1028226Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553750}
parent 077ce1f7
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
<!-- NTP dimensions --> <!-- NTP dimensions -->
<dimen name="ntp_logo_height">180dp</dimen> <dimen name="ntp_logo_height">180dp</dimen>
<dimen name="ntp_search_box_height_modern">48dp</dimen>
<dimen name="ntp_search_box_transition_length">60dp</dimen> <dimen name="ntp_search_box_transition_length">60dp</dimen>
<!-- Recent tabs page --> <!-- Recent tabs page -->
......
...@@ -281,7 +281,9 @@ ...@@ -281,7 +281,9 @@
<!-- Modern toolbar dimensions --> <!-- Modern toolbar dimensions -->
<dimen name="modern_toolbar_background_focused_left_margin">6dp</dimen> <dimen name="modern_toolbar_background_focused_left_margin">6dp</dimen>
<dimen name="modern_toolbar_background_size">40dp</dimen> <dimen name="modern_toolbar_background_size">40dp</dimen>
<dimen name="modern_toolbar_background_corner_radius">20dp</dimen> <!-- Sometimes the modern toolbar is shown at 48dp so a corner radius of
24dp is needed to completely round the corners. -->
<dimen name="modern_toolbar_background_corner_radius">24dp</dimen>
<dimen name="modern_toolbar_background_lateral_inset">2dp</dimen> <dimen name="modern_toolbar_background_lateral_inset">2dp</dimen>
<!-- Omnibox suggestions --> <!-- Omnibox suggestions -->
...@@ -342,15 +344,15 @@ ...@@ -342,15 +344,15 @@
<dimen name="ntp_logo_margin_bottom_modern">64dp</dimen> <dimen name="ntp_logo_margin_bottom_modern">64dp</dimen>
<dimen name="ntp_logo_max_internal_space_bottom_modern">8dp</dimen> <dimen name="ntp_logo_max_internal_space_bottom_modern">8dp</dimen>
<dimen name="ntp_search_box_height">62dp</dimen> <dimen name="ntp_search_box_height">62dp</dimen>
<dimen name="ntp_search_box_height_modern">40dp</dimen> <dimen name="ntp_search_box_height_modern">48dp</dimen>
<dimen name="ntp_search_box_shadow_width">4dp</dimen> <dimen name="ntp_search_box_shadow_width">4dp</dimen>
<dimen name="ntp_search_box_transition_length">16dp</dimen> <dimen name="ntp_search_box_transition_length">16dp</dimen>
<dimen name="ntp_search_box_logo_padding">8dp</dimen> <dimen name="ntp_search_box_logo_padding">8dp</dimen>
<dimen name="ntp_search_box_voice_search_margin_end_modern">6dp</dimen> <dimen name="ntp_search_box_voice_search_margin_end_modern">6dp</dimen>
<!-- Negative lateral inset added to the search box bounds when modern is enabled. 8dp is added <!-- Negative vertical inset added to the search box bounds when modern is enabled. 4dp is added
to both the top and bottom bounds to bring the 40dp modern_toolbar_background_size to 56dp to both the top and bottom bounds to bring the 48dp modern_toolbar_background_size to 56dp
(matches toolbar_height_no_shadow). --> (matches toolbar_height_no_shadow). -->
<dimen name="ntp_search_box_bounds_lateral_inset_modern">-8dp</dimen> <dimen name="ntp_search_box_bounds_vertical_inset_modern">-4dp</dimen>
<dimen name="ntp_wide_card_lateral_margins">48dp</dimen> <dimen name="ntp_wide_card_lateral_margins">48dp</dimen>
<dimen name="ntp_shadow_height">9dp</dimen> <dimen name="ntp_shadow_height">9dp</dimen>
<dimen name="ntp_sign_in_promo_margin_top">20dp</dimen> <dimen name="ntp_sign_in_promo_margin_top">20dp</dimen>
......
...@@ -11,7 +11,6 @@ import android.content.Context; ...@@ -11,7 +11,6 @@ import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.drawable.GradientDrawable;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
...@@ -148,10 +147,10 @@ public class NewTabPageView ...@@ -148,10 +147,10 @@ public class NewTabPageView
private ContextMenuManager mContextMenuManager; private ContextMenuManager mContextMenuManager;
/** /**
* Lateral inset to add to the top and bottom of the search box bounds. May be 0 if no inset * Vertical inset to add to the top and bottom of the search box bounds. May be 0 if no inset
* should be applied. See {@link Rect#inset(int, int)}. * should be applied. See {@link Rect#inset(int, int)}.
*/ */
private int mSearchBoxBoundsLateralInset; private int mSearchBoxBoundsVerticalInset;
/** /**
* Manages the view interaction with the rest of the system. * Manages the view interaction with the rest of the system.
...@@ -291,11 +290,8 @@ public class NewTabPageView ...@@ -291,11 +290,8 @@ public class NewTabPageView
getResources().getDimensionPixelSize(R.dimen.ntp_search_box_height_modern); getResources().getDimensionPixelSize(R.dimen.ntp_search_box_height_modern);
if (!DeviceFormFactor.isTablet()) { if (!DeviceFormFactor.isTablet()) {
mSearchBoxBoundsLateralInset = getResources().getDimensionPixelSize( mSearchBoxBoundsVerticalInset = getResources().getDimensionPixelSize(
R.dimen.ntp_search_box_bounds_lateral_inset_modern); R.dimen.ntp_search_box_bounds_vertical_inset_modern);
} else {
GradientDrawable background = (GradientDrawable) mSearchBoxView.getBackground();
background.setCornerRadius(mSearchBoxView.getLayoutParams().height / 2.f);
} }
} }
mNoSearchLogoSpacer = mNewTabPageLayout.findViewById(R.id.no_search_logo_spacer); mNoSearchLogoSpacer = mNewTabPageLayout.findViewById(R.id.no_search_logo_spacer);
...@@ -775,7 +771,7 @@ public class NewTabPageView ...@@ -775,7 +771,7 @@ public class NewTabPageView
+ mNewTabPageLayout.getPaddingTop(); + mNewTabPageLayout.getPaddingTop();
int target = Math.max(basePosition, int target = Math.max(basePosition,
mSearchBoxView.getBottom() - mSearchBoxView.getPaddingBottom() mSearchBoxView.getBottom() - mSearchBoxView.getPaddingBottom()
- mSearchBoxBoundsLateralInset); - mSearchBoxBoundsVerticalInset);
mNewTabPageLayout.setTranslationY(percent * (basePosition - target)); mNewTabPageLayout.setTranslationY(percent * (basePosition - target));
} }
...@@ -835,7 +831,7 @@ public class NewTabPageView ...@@ -835,7 +831,7 @@ public class NewTabPageView
bounds.offset(translation.x, translation.y); bounds.offset(translation.x, translation.y);
if (translation.y != Integer.MIN_VALUE) { if (translation.y != Integer.MIN_VALUE) {
bounds.inset(0, mSearchBoxBoundsLateralInset); bounds.inset(0, mSearchBoxBoundsVerticalInset);
} }
} }
......
...@@ -1216,11 +1216,18 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -1216,11 +1216,18 @@ public class ToolbarPhone extends ToolbarLayout
int leftBoundDifference = mNtpSearchBoxBounds.left - mLocationBarBackgroundBounds.left; int leftBoundDifference = mNtpSearchBoxBounds.left - mLocationBarBackgroundBounds.left;
int rightBoundDifference = mNtpSearchBoxBounds.right - mLocationBarBackgroundBounds.right; int rightBoundDifference = mNtpSearchBoxBounds.right - mLocationBarBackgroundBounds.right;
int verticalInset = 0;
if (mLocationBar.useModernDesign()) {
verticalInset = (int) (getResources().getDimensionPixelSize(
R.dimen.ntp_search_box_bounds_vertical_inset_modern)
* (1.f - mUrlExpansionPercent));
}
mLocationBarBackgroundNtpOffset.set( mLocationBarBackgroundNtpOffset.set(
Math.round(leftBoundDifference * shrinkage), Math.round(leftBoundDifference * shrinkage),
locationBarTranslationY, locationBarTranslationY,
Math.round(rightBoundDifference * shrinkage), Math.round(rightBoundDifference * shrinkage),
locationBarTranslationY); locationBarTranslationY);
mLocationBarBackgroundNtpOffset.inset(0, verticalInset);
// The omnibox background bounds are outset by |mLocationBarBackgroundCornerRadius| in the // The omnibox background bounds are outset by |mLocationBarBackgroundCornerRadius| in the
// fully expanded state (and only there!) to hide the rounded corners, so undo that before // fully expanded state (and only there!) to hide the rounded corners, so undo that before
......
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