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; |
+ } |
+ } |
+} |