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