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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetItemDecoration.java

Issue 1849173002: Add a snippet item decoration to recycler view for cards and make the card full bleed with a divide… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@always-show-snippets
Patch Set: Update outRect to empty Created 4 years, 8 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/snippets/SnippetItemDecoration.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetItemDecoration.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetItemDecoration.java
new file mode 100644
index 0000000000000000000000000000000000000000..2c080995a3deaa32af0c910140765512e0ecdfe8
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetItemDecoration.java
@@ -0,0 +1,33 @@
+// 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.snippets;
+
+import android.content.Context;
+import android.graphics.Rect;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+import org.chromium.chrome.R;
+
+/**
+ * A class that decorates the RecyclerView elements.
+ */
+public class SnippetItemDecoration extends RecyclerView.ItemDecoration {
+ private final int mVerticalSpace;
+
+ public SnippetItemDecoration(Context context) {
+ this.mVerticalSpace =
+ context.getResources().getDimensionPixelSize(R.dimen.snippets_vertical_space);
+ }
+
+ @Override
+ public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
+ RecyclerView.State state) {
+ if (parent.getChildAdapterPosition(view) != parent.getAdapter().getItemCount() - 1) {
+ outRect.setEmpty();
+ outRect.bottom = mVerticalSpace;
+ }
+ }
+}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java ('k') | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698