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

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

Issue 2088793004: NTP, change the card elevation from setElevation to a 9 patch file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes Created 4 years, 6 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/CardItemDecoration.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardItemDecoration.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardItemDecoration.java
deleted file mode 100644
index 1bfee572b2d1e7aa2583d547b4359b5551f3a517..0000000000000000000000000000000000000000
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardItemDecoration.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.ntp.cards;
-
-import android.content.Context;
-import android.graphics.Rect;
-import android.support.v7.widget.RecyclerView;
-import android.view.View;
-
-import org.chromium.chrome.R;
-
-/**
- * A decorator that places separators between RecyclerView cards.
- */
-public class CardItemDecoration extends RecyclerView.ItemDecoration {
- private final int mCardsVerticalSpacing;
-
- /**
- * @param context used to retrieve resources.
- */
- public CardItemDecoration(Context context) {
- mCardsVerticalSpacing =
- context.getResources().getDimensionPixelSize(R.dimen.snippets_vertical_spacing);
- }
-
- @Override
- public void getItemOffsets(
- Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
- int childPos = parent.getChildAdapterPosition(view);
-
- // childPos can be NO_POSITION if the method is called with a view being removed from the
- // RecyclerView, for example when dismissing an item.
- if (childPos == RecyclerView.NO_POSITION) return;
-
- // Add spacing if the current item and the next are cards.
- if (parent.getChildViewHolder(view) instanceof CardViewHolder
- && parent.findViewHolderForAdapterPosition(childPos + 1)
- instanceof CardViewHolder) {
- outRect.set(0, 0, 0, mCardsVerticalSpacing);
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698