Skip to content

Commit

Permalink
Lowered minsdk to 14 and updated readme. Ready for release!
Browse files Browse the repository at this point in the history
  • Loading branch information
tom0334 committed Jan 24, 2018
1 parent ee4ba90 commit dd5131f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -9,15 +9,39 @@ 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)
* N columns and M rows
* 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);
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android {
compileSdkVersion 26
defaultConfig {
applicationId "f.tom.consistentspacingdemo"
minSdkVersion 15
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class MainActivity extends AppCompatActivity {
private ArrayList<RecyclerViewData> data;
private MyRecyclerViewAdapter adapter;
private RecyclerView recv;
private GridLayoutManager gridMan;
private boolean useConsistentSpacing = true;

//the better way
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion consistentspacingdecoration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {


defaultConfig {
minSdkVersion 15
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
Expand Down

0 comments on commit dd5131f

Please sign in to comment.