Commit d6d62019 authored by Justin DeWitt's avatar Justin DeWitt Committed by Commit Bot

[Feed V2] Update margins to render the external surface cards correctly.

Bug: 1106425, b/161142289
Change-Id: If3c89644289b6eb1d5b61f6680f03bf95e3b6888
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303172Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarCarlos Knippschild <carlosk@chromium.org>
Commit-Queue: Justin DeWitt <dewittj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789547}
parent 00974e7e
......@@ -73,6 +73,7 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider {
private final View mNtpHeader;
private final boolean mShowDarkBackground;
private final boolean mIsPlaceholderShown;
private final boolean mV2Enabled;
private final FeedSurfaceDelegate mDelegate;
private final int mDefaultMargin;
private final int mWideMargin;
......@@ -216,6 +217,8 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider {
mSectionHeaderView = sectionHeaderView;
mShowDarkBackground = showDarkBackground;
mIsPlaceholderShown = isPlaceholderShown;
mV2Enabled = FeatureList.isInitialized()
&& ChromeFeatureList.isEnabled(ChromeFeatureList.INTEREST_FEED_V2);
mDelegate = delegate;
mPageNavigationDelegate = pageNavigationDelegate;
mBottomSheetController = bottomSheetController;
......@@ -223,9 +226,12 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider {
mActionOptions = actionOptions;
Resources resources = mActivity.getResources();
mDefaultMargin =
resources.getDimensionPixelSize(R.dimen.content_suggestions_card_modern_margin);
mWideMargin = resources.getDimensionPixelSize(R.dimen.ntp_wide_card_lateral_margins);
mDefaultMargin = resources.getDimensionPixelSize(mV2Enabled
? R.dimen.content_suggestions_card_modern_margin_v2
: R.dimen.content_suggestions_card_modern_margin);
mWideMargin = resources.getDimensionPixelSize(mV2Enabled
? R.dimen.ntp_wide_card_lateral_margins_v2
: R.dimen.ntp_wide_card_lateral_margins);
mRootView = new RootView(mActivity);
mRootView.setPadding(0, resources.getDimensionPixelOffset(R.dimen.tab_strip_height), 0, 0);
......@@ -308,9 +314,7 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider {
mScrollViewResizer = null;
}
boolean v2Enabled = FeatureList.isInitialized()
&& ChromeFeatureList.isEnabled(ChromeFeatureList.INTEREST_FEED_V2);
if (v2Enabled) {
if (mV2Enabled) {
mStream = new FeedStream(mActivity, mShowDarkBackground, mSnackbarManager,
mPageNavigationDelegate, mBottomSheetController);
} else {
......@@ -352,7 +356,7 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider {
mStream.setHeaderViews(Arrays.asList(new NonDismissibleHeader(mSectionHeaderView)));
}
if (!v2Enabled) {
if (!mV2Enabled) {
mStream.addScrollListener(new FeedLoggingBridge.ScrollEventReporter(
FeedProcessScopeFactory.getFeedLoggingBridge()));
}
......
......@@ -354,9 +354,11 @@
(matches toolbar_height_no_shadow). -->
<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_v2">36dp</dimen>
<dimen name="snippets_article_header_height">40dp</dimen>
<!-- This is in sp because we want the icon to scale with the TextView it sits alongside. -->
<dimen name="content_suggestions_card_modern_margin">12dp</dimen>
<dimen name="content_suggestions_card_modern_margin_v2">0dp</dimen>
<!-- This is in sp because we want the icon to scale with the TextView it sits alongside. -->
<dimen name="md_incognito_ntp_line_spacing">6sp</dimen>
<dimen name="md_incognito_ntp_padding_left">16dp</dimen>
......
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