From dd5131f57dec793c8ad1c4fed8b67325670605f3 Mon Sep 17 00:00:00 2001 From: Tom Friederich Date: Thu, 25 Jan 2018 00:42:23 +0100 Subject: [PATCH] Lowered minsdk to 14 and updated readme. Ready for release! --- README.md | 30 +++++++++++++++++-- app/build.gradle | 2 +- .../consistentspacingdemo/MainActivity.java | 3 +- consistentspacingdecoration/build.gradle | 2 +- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0dc2145..dd25948 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ConsistentSpacingDecoration -A RecyclerViewItemDecoration that provides consistent spacing on all 4 sides when working with GridlayoutManager +A RecyclerViewItemDecoration that provides consistent spacing on all 4 sides when working with GridlayoutManager. When using gridlayoutmanager with cards and padding/margin on your listitems, the spacing between items is doubled. This librfary fixes that. @@ -9,7 +9,7 @@ WITHOUT ConsistentSpacingDecoration | WITH ConsistentSpacingDecoration: ![bad image](https://github.com/tom0334/ConsistentSpacingDecoration/blob/master/screenshots/screenshot_bad.png) | ![bad image](https://github.com/tom0334/ConsistentSpacingDecoration/blob/master/screenshots/screenshot_good.png) -Note the the padding between the items. +Note the the padding between the items. It also supports: * Vertical padding (the vertical padding is also consistent) @@ -17,7 +17,31 @@ It also supports: * Headers that span all columns * Headers that have no padding at all -How to use: + +**How to install:** + +Edit your PROJECT build.gradle file to include this line under the allprojects not the buildscript) repositories part: +maven { url 'https://jitpack.io' } + +Like so: + + allprojects { + repositories { + ... + maven { url 'https://jitpack.io' } + } + } + +Then add the following line to your app build.gradle file: + + dependencies { + compile 'com.github.tom0334:ConsistentSpacingDecoration:1.0' + } + + + + +**How to use:** RecyclerView recv = findViewById(R.id.mainRecyclerView); int paddingPxVertical = getResources().getDimensionPixelSize(R.dimen.recyclerViewSpacing); diff --git a/app/build.gradle b/app/build.gradle index 149de0a..9f7009b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion 26 defaultConfig { applicationId "f.tom.consistentspacingdemo" - minSdkVersion 15 + minSdkVersion 14 targetSdkVersion 26 versionCode 1 versionName "1.0" diff --git a/app/src/main/java/f/tom/consistentspacingdemo/MainActivity.java b/app/src/main/java/f/tom/consistentspacingdemo/MainActivity.java index b67d4e2..cd0d87f 100644 --- a/app/src/main/java/f/tom/consistentspacingdemo/MainActivity.java +++ b/app/src/main/java/f/tom/consistentspacingdemo/MainActivity.java @@ -22,7 +22,6 @@ public class MainActivity extends AppCompatActivity { private ArrayList data; private MyRecyclerViewAdapter adapter; private RecyclerView recv; - private GridLayoutManager gridMan; private boolean useConsistentSpacing = true; //the better way @@ -186,7 +185,7 @@ private void addConsistentDecoration() { private void initRecyclerView() { adapter = new MyRecyclerViewAdapter(data, useConsistentSpacing); recv.setAdapter(adapter); - gridMan = new GridLayoutManager(this, columnCount); + GridLayoutManager gridMan = new GridLayoutManager(this, columnCount); if (useHeader) { // Create a custom SpanSizeLookup where the first item spans both columns diff --git a/consistentspacingdecoration/build.gradle b/consistentspacingdecoration/build.gradle index ccb20cf..ebc1a33 100644 --- a/consistentspacingdecoration/build.gradle +++ b/consistentspacingdecoration/build.gradle @@ -9,7 +9,7 @@ android { defaultConfig { - minSdkVersion 15 + minSdkVersion 14 targetSdkVersion 26 versionCode 1 versionName "1.0"