Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4025)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java

Issue 2167973004: Revert of 📰 Adjust the card display depending on the screen width. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ZineTabletUI
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java
index a7cb3d7f9754c638cedae15624b37c4a8799af1d..f45eb14d1c7139e11ee8df8297b226937886bb35 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardViewHolder.java
@@ -13,7 +13,6 @@
import android.view.animation.Interpolator;
import org.chromium.chrome.R;
-import org.chromium.chrome.browser.ntp.UiConfig;
import org.chromium.chrome.browser.util.MathUtils;
/**
@@ -27,9 +26,6 @@
* - When peeking, tapping on cards will make them request a scroll up (see
* {@link NewTabPageRecyclerView#showCardsFrom(int)}). Tap events in non-peeking state will be
* routed through {@link #onCardTapped()} for subclasses to override.
- *
- * - Cards will get some lateral margins when the viewport is sufficiently wide.
- * (see {@link UiConfig#DISPLAY_STYLE_WIDE})
*
* Note: If a subclass overrides {@link #onBindViewHolder(NewTabPageListItem)}, it should call the
* parent implementation to reset the private state when a card is recycled.
@@ -49,10 +45,6 @@
private final NewTabPageRecyclerView mRecyclerView;
- private final UiConfig mUiConfig;
- private final int mWideMarginSizePixels;
- private final DisplayStyleObserverAdapter mDisplayStyleObserverAdapter;
-
/**
* Current padding value. The padding and the margins are manipulated together to create the
* shrunk/peeking appearance of the cards. When the padding is low, the margins are high and
@@ -65,13 +57,9 @@
/**
* @param layoutId resource id of the layout to inflate and to use as card.
* @param recyclerView ViewGroup that will contain the newly created view.
- * @param uiConfig The NTP UI configuration object used to adjust the card UI.
*/
- public CardViewHolder(
- int layoutId, final NewTabPageRecyclerView recyclerView, UiConfig uiConfig) {
+ public CardViewHolder(int layoutId, final NewTabPageRecyclerView recyclerView) {
super(inflateView(layoutId, recyclerView));
- mWideMarginSizePixels = itemView.getResources().getDimensionPixelSize(
- R.dimen.ntp_wide_card_lateral_margins);
mCards9PatchAdjustment = recyclerView.getResources().getDimensionPixelSize(
R.dimen.snippets_card_9_patch_adjustment);
@@ -93,9 +81,6 @@
}
}
});
-
- mUiConfig = uiConfig;
- mDisplayStyleObserverAdapter = MarginResizer.createWithViewAdapter(itemView, mUiConfig);
}
/**
@@ -179,23 +164,13 @@
// Modify the padding so as the margin increases, the padding decreases, keeping the card's
// contents in the same position. The top and bottom remain the same.
- int lateralPadding;
- int lateralMargin;
- if (mDisplayStyleObserverAdapter.getDisplayStyle() != UiConfig.DISPLAY_STYLE_WIDE) {
- lateralPadding = mPeekPadding;
- lateralMargin = mMaxPeekPadding - (mPeekPadding + mCards9PatchAdjustment);
- } else {
- lateralPadding = mMaxPeekPadding;
- lateralMargin = mWideMarginSizePixels;
- }
-
- itemView.setPadding(lateralPadding, mMaxPeekPadding, lateralPadding, mMaxPeekPadding);
+ itemView.setPadding(mPeekPadding, mMaxPeekPadding, mPeekPadding, mMaxPeekPadding);
// This mCards9PatchAdjustment value will be used to adjust the padding so the card width
// is the actual width not including the elevation shadow so we can have full bleed.
RecyclerView.LayoutParams params = getParams();
- params.leftMargin = lateralMargin;
- params.rightMargin = lateralMargin;
+ params.leftMargin = mMaxPeekPadding - (mPeekPadding + mCards9PatchAdjustment);
+ params.rightMargin = mMaxPeekPadding - (mPeekPadding + mCards9PatchAdjustment);
// Set the opacity of the card content to be 0 when peeking and 1 when full width.
int itemViewChildCount = ((ViewGroup) itemView).getChildCount();

Powered by Google App Engine
This is Rietveld 408576698