Commit 3cd9e411 authored by Michael van Ouwerkerk's avatar Michael van Ouwerkerk Committed by Commit Bot

Use up to 8dp internal space at bottom for logo.

Screenshots: http://shortn/_e12t0VKa6o

Bug: 759134
Change-Id: I448ad8960f3999ee7b95b35fe9d5eadaed7d3015
Reviewed-on: https://chromium-review.googlesource.com/776661
Commit-Queue: Michael van Ouwerkerk <mvanouwerkerk@chromium.org>
Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517409}
parent 630b49ff
...@@ -329,6 +329,7 @@ ...@@ -329,6 +329,7 @@
<dimen name="ntp_logo_margin_top_modern">25dp</dimen> <dimen name="ntp_logo_margin_top_modern">25dp</dimen>
<!-- bottom_control_container_height + 8 --> <!-- bottom_control_container_height + 8 -->
<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_search_box_height">62dp</dimen> <dimen name="ntp_search_box_height">62dp</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>
......
...@@ -25,6 +25,7 @@ import android.widget.FrameLayout; ...@@ -25,6 +25,7 @@ import android.widget.FrameLayout;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ntp.LogoBridge.Logo; import org.chromium.chrome.browser.ntp.LogoBridge.Logo;
import org.chromium.chrome.browser.search_engines.TemplateUrlService; import org.chromium.chrome.browser.search_engines.TemplateUrlService;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.browser.widget.LoadingView; import org.chromium.chrome.browser.widget.LoadingView;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
...@@ -45,6 +46,9 @@ public class LogoView extends FrameLayout implements OnClickListener { ...@@ -45,6 +46,9 @@ public class LogoView extends FrameLayout implements OnClickListener {
// The default logo is shared across all NTPs. // The default logo is shared across all NTPs.
private static WeakReference<Bitmap> sDefaultLogo; private static WeakReference<Bitmap> sDefaultLogo;
// The maximum internal bottom space for when the image is smaller than the view.
private final int mLogoMaxInternalSpaceBottom;
// mLogo and mNewLogo are remembered for cross fading animation. // mLogo and mNewLogo are remembered for cross fading animation.
private Bitmap mLogo; private Bitmap mLogo;
private Bitmap mNewLogo; private Bitmap mNewLogo;
...@@ -104,6 +108,9 @@ public class LogoView extends FrameLayout implements OnClickListener { ...@@ -104,6 +108,9 @@ public class LogoView extends FrameLayout implements OnClickListener {
public LogoView(Context context, AttributeSet attrs) { public LogoView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mLogoMaxInternalSpaceBottom = getResources().getDimensionPixelSize(
R.dimen.ntp_logo_max_internal_space_bottom_modern);
mLogoMatrix = new Matrix(); mLogoMatrix = new Matrix();
mLogoIsDefault = true; mLogoIsDefault = true;
...@@ -285,7 +292,14 @@ public class LogoView extends FrameLayout implements OnClickListener { ...@@ -285,7 +292,14 @@ public class LogoView extends FrameLayout implements OnClickListener {
if (preventUpscaling) scale = Math.min(1.0f, scale); if (preventUpscaling) scale = Math.min(1.0f, scale);
int imageOffsetX = Math.round((width - imageWidth * scale) * 0.5f); int imageOffsetX = Math.round((width - imageWidth * scale) * 0.5f);
int imageOffsetY = Math.round((height - imageHeight * scale) * 0.5f);
final int imageOffsetY;
float whitespace = height - imageHeight * scale;
if (FeatureUtilities.isChromeHomeEnabled()) {
imageOffsetY = Math.max(0, (int) whitespace - mLogoMaxInternalSpaceBottom);
} else {
imageOffsetY = Math.round(whitespace * 0.5f);
}
matrix.setScale(scale, scale); matrix.setScale(scale, scale);
matrix.postTranslate(imageOffsetX, imageOffsetY); matrix.postTranslate(imageOffsetX, imageOffsetY);
......
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