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 { ...@@ -73,6 +73,7 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider {
private final View mNtpHeader; private final View mNtpHeader;
private final boolean mShowDarkBackground; private final boolean mShowDarkBackground;
private final boolean mIsPlaceholderShown; private final boolean mIsPlaceholderShown;
private final boolean mV2Enabled;
private final FeedSurfaceDelegate mDelegate; private final FeedSurfaceDelegate mDelegate;
private final int mDefaultMargin; private final int mDefaultMargin;
private final int mWideMargin; private final int mWideMargin;
...@@ -216,6 +217,8 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider { ...@@ -216,6 +217,8 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider {
mSectionHeaderView = sectionHeaderView; mSectionHeaderView = sectionHeaderView;
mShowDarkBackground = showDarkBackground; mShowDarkBackground = showDarkBackground;
mIsPlaceholderShown = isPlaceholderShown; mIsPlaceholderShown = isPlaceholderShown;
mV2Enabled = FeatureList.isInitialized()
&& ChromeFeatureList.isEnabled(ChromeFeatureList.INTEREST_FEED_V2);
mDelegate = delegate; mDelegate = delegate;
mPageNavigationDelegate = pageNavigationDelegate; mPageNavigationDelegate = pageNavigationDelegate;
mBottomSheetController = bottomSheetController; mBottomSheetController = bottomSheetController;
...@@ -223,9 +226,12 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider { ...@@ -223,9 +226,12 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider {
mActionOptions = actionOptions; mActionOptions = actionOptions;
Resources resources = mActivity.getResources(); Resources resources = mActivity.getResources();
mDefaultMargin = mDefaultMargin = resources.getDimensionPixelSize(mV2Enabled
resources.getDimensionPixelSize(R.dimen.content_suggestions_card_modern_margin); ? R.dimen.content_suggestions_card_modern_margin_v2
mWideMargin = resources.getDimensionPixelSize(R.dimen.ntp_wide_card_lateral_margins); : 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 = new RootView(mActivity);
mRootView.setPadding(0, resources.getDimensionPixelOffset(R.dimen.tab_strip_height), 0, 0); mRootView.setPadding(0, resources.getDimensionPixelOffset(R.dimen.tab_strip_height), 0, 0);
...@@ -308,9 +314,7 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider { ...@@ -308,9 +314,7 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider {
mScrollViewResizer = null; mScrollViewResizer = null;
} }
boolean v2Enabled = FeatureList.isInitialized() if (mV2Enabled) {
&& ChromeFeatureList.isEnabled(ChromeFeatureList.INTEREST_FEED_V2);
if (v2Enabled) {
mStream = new FeedStream(mActivity, mShowDarkBackground, mSnackbarManager, mStream = new FeedStream(mActivity, mShowDarkBackground, mSnackbarManager,
mPageNavigationDelegate, mBottomSheetController); mPageNavigationDelegate, mBottomSheetController);
} else { } else {
...@@ -352,7 +356,7 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider { ...@@ -352,7 +356,7 @@ public class FeedSurfaceCoordinator implements FeedSurfaceProvider {
mStream.setHeaderViews(Arrays.asList(new NonDismissibleHeader(mSectionHeaderView))); mStream.setHeaderViews(Arrays.asList(new NonDismissibleHeader(mSectionHeaderView)));
} }
if (!v2Enabled) { if (!mV2Enabled) {
mStream.addScrollListener(new FeedLoggingBridge.ScrollEventReporter( mStream.addScrollListener(new FeedLoggingBridge.ScrollEventReporter(
FeedProcessScopeFactory.getFeedLoggingBridge())); FeedProcessScopeFactory.getFeedLoggingBridge()));
} }
......
...@@ -354,9 +354,11 @@ ...@@ -354,9 +354,11 @@
(matches toolbar_height_no_shadow). --> (matches toolbar_height_no_shadow). -->
<dimen name="ntp_search_box_bounds_vertical_inset_modern">-4dp</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_wide_card_lateral_margins_v2">36dp</dimen>
<dimen name="snippets_article_header_height">40dp</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">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_line_spacing">6sp</dimen>
<dimen name="md_incognito_ntp_padding_left">16dp</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