Commit 00f54c8b authored by Matthew Jones's avatar Matthew Jones Committed by Commit Bot

Fix padding issues on Duet NTP

This patch reduces the padding above the logo on the NTP to reduce
the unneeded whitespace and adds padding to the bottom so that the
footer is not obscured by the bottom toolbar.

Bug: 870748,869612
Change-Id: I9e003149d32d54b2652e20e1a45524724985abff
Reviewed-on: https://chromium-review.googlesource.com/1169587Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582185}
parent 38786b89
......@@ -344,6 +344,7 @@
<dimen name="tile_view_title_margin_top_condensed">62dp</dimen>
<dimen name="tile_view_title_margin_top_modern">61dp</dimen>
<dimen name="ntp_logo_height">100dp</dimen>
<dimen name="duet_ntp_logo_top_padding">16dp</dimen>
<dimen name="ntp_search_box_height">62dp</dimen>
<dimen name="ntp_search_box_height_modern">48dp</dimen>
<dimen name="ntp_search_box_shadow_width">4dp</dimen>
......
......@@ -46,6 +46,7 @@ import org.chromium.chrome.browser.suggestions.TileGroup;
import org.chromium.chrome.browser.suggestions.TileRenderer;
import org.chromium.chrome.browser.suggestions.TileView;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.browser.util.MathUtils;
import org.chromium.chrome.browser.util.ViewUtils;
import org.chromium.chrome.browser.vr.VrModeObserver;
......@@ -187,6 +188,14 @@ public class NewTabPageLayout extends LinearLayout implements TileGroup.Observer
ViewStub exploreStub = findViewById(R.id.explore_sites_stub);
mExploreSectionView = exploreStub.inflate();
}
// Strip the padding from the top of the view (which would otherwise be the height of the
// top toolbar) when Duet is enabled to remove some of the empty space.
if (FeatureUtilities.isBottomToolbarEnabled()) {
setPadding(getPaddingLeft(),
getResources().getDimensionPixelSize(R.dimen.duet_ntp_logo_top_padding),
getPaddingRight(), getPaddingBottom());
}
}
/**
......
......@@ -30,6 +30,7 @@ import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate;
import org.chromium.chrome.browser.suggestions.TileGroup;
import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.browser.util.ViewUtils;
import org.chromium.chrome.browser.widget.displaystyle.UiConfig;
......@@ -280,6 +281,11 @@ public class NewTabPageView extends FrameLayout {
// immediately attached to the window if the RecyclerView is scrolled when the NTP
// is refocused.
if (mManager.isLocationBarShownInNTP()) mNewTabPageLayout.updateSearchBoxOnScroll();
if (FeatureUtilities.isBottomToolbarEnabled()) {
((MarginLayoutParams) getLayoutParams()).bottomMargin =
getResources().getDimensionPixelSize(R.dimen.bottom_toolbar_height);
}
}
/**
......
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