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

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: Changes from review Created 4 years, 9 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..552b4c9dfa7c600c2943091b802c769252ece7ad
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetItemDecoration.java
@@ -0,0 +1,32 @@
+// 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,
newt (away) 2016/04/04 20:57:34 The javadoc for getItemOffsets() says "If this Ite
mcwilliams 2016/04/05 09:58:37 Done.
newt (away) 2016/04/05 16:43:36 Actually, you need to call outRect.setEmpty() outs
mcwilliams 2016/04/05 17:29:08 That makes sense :) https://codereview.chromium.or
+ RecyclerView.State state) {
+ if (parent.getChildAdapterPosition(view) != parent.getAdapter().getItemCount() - 1) {
+ 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