From 3ab717d12df8a045ec79f51d982017be3b45c0b3 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 3 Nov 2015 17:38:47 -0800 Subject: Make dragging fast scroller smooth instead of jumping between the tops of items --- .../main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java') diff --git a/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java b/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java index 2d7f4c44..b59e7157 100644 --- a/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java +++ b/app/src/main/java/github/daneren2005/dsub/view/GridSpacingDecoration.java @@ -22,12 +22,13 @@ import android.util.TypedValue; import android.view.View; public class GridSpacingDecoration extends RecyclerView.ItemDecoration { + public static final int SPACING = 10; @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); - int spacing = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, view.getResources().getDisplayMetrics()); + int spacing = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, SPACING, view.getResources().getDisplayMetrics()); int halfSpacing = spacing / 2; int childCount = parent.getChildCount(); -- cgit v1.2.3