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

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

Issue 2651743002: 📰 Fix card style when a neighbour is added or removed (Closed)
Patch Set: Revert to previous implementation Created 3 years, 11 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9ba6879aae3ee2fe32f1e7929551dfeabef7cf79..bc9c9b425d19aa831603db4b77062a3104b9ab72 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
@@ -220,18 +220,18 @@ public void updateLayoutParams() {
hasCardBelow = isCard(belowViewType) && belowViewType != ItemViewType.PROMO;
}
+ @DrawableRes
+ int selectedBackground = selectBackground(hasCardAbove, hasCardBelow);
+ if (mBackground == selectedBackground) return;
+
+ mBackground = selectedBackground;
+ ViewUtils.setNinePatchBackgroundResource(itemView, selectedBackground);
+
// By default the apparent distance between two cards is the sum of the bottom and top
// height of their shadows. We want |mCardGap| instead, so we set the bottom margin to
// the difference.
getParams().bottomMargin =
hasCardBelow ? (mCardGap - (mCardShadow.top + mCardShadow.bottom)) : 0;
-
- @DrawableRes
- int selectedBackground = selectBackground(hasCardAbove, hasCardBelow);
- if (mBackground != selectedBackground) {
- mBackground = selectedBackground;
- ViewUtils.setNinePatchBackgroundResource(itemView, selectedBackground);
- }
}
/**
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698