From 9ea6e5b92381532602b178968c91c98b4fd3b297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dino=20Kovac=CC=8C?= Date: Tue, 27 Sep 2016 16:14:46 +0200 Subject: [PATCH 1/3] Bump gradle version --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 9293c6e..ddb5adf 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.1.2' + classpath 'com.android.tools.build:gradle:2.2.0' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 582a42b..fd7b937 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Jun 23 11:31:54 JST 2016 +#Tue Sep 27 16:13:47 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip From 0fbb36afbb5ba4227582d73813513be6a0e6455d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dino=20Kovac=CC=8C?= Date: Tue, 27 Sep 2016 16:15:51 +0200 Subject: [PATCH 2/3] Bump support lib version --- build.gradle | 4 ++++ library/build.gradle | 4 ++-- sample/build.gradle | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index ddb5adf..54f5f93 100644 --- a/build.gradle +++ b/build.gradle @@ -13,6 +13,10 @@ buildscript { } } +ext { + supportLibVersion = '24.2.1' +} + allprojects { repositories { jcenter() diff --git a/library/build.gradle b/library/build.gradle index f320be6..60562db 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -13,8 +13,8 @@ android { } dependencies { - compile 'com.android.support:appcompat-v7:23.4.0' - compile 'com.android.support:recyclerview-v7:23.4.0' + compile "com.android.support:appcompat-v7:$supportLibVersion" + compile "com.android.support:recyclerview-v7:$supportLibVersion" } android.libraryVariants.all { variant -> diff --git a/sample/build.gradle b/sample/build.gradle index 3fe6074..1ec04d7 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -22,6 +22,6 @@ android { dependencies { compile project(':library') // compile 'com.yqritc:recyclerview-flexibledivider:1.4.0' - compile 'com.android.support:appcompat-v7:23.4.0' - compile 'com.android.support:recyclerview-v7:23.4.0' + compile "com.android.support:appcompat-v7:$supportLibVersion" + compile "com.android.support:recyclerview-v7:$supportLibVersion" } From 60378eca3d88beb4f475a43a19715f25b745e8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dino=20Kovac=CC=8C?= Date: Tue, 27 Sep 2016 16:40:22 +0200 Subject: [PATCH 3/3] Add support annotations for color and pixel dimensions --- .../FlexibleDividerDecoration.java | 6 ++++-- .../HorizontalDividerItemDecoration.java | 7 +++++-- .../VerticalDividerItemDecoration.java | 7 +++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/library/src/main/java/com/yqritc/recyclerviewflexibledivider/FlexibleDividerDecoration.java b/library/src/main/java/com/yqritc/recyclerviewflexibledivider/FlexibleDividerDecoration.java index 26a765a..41ba27f 100644 --- a/library/src/main/java/com/yqritc/recyclerviewflexibledivider/FlexibleDividerDecoration.java +++ b/library/src/main/java/com/yqritc/recyclerviewflexibledivider/FlexibleDividerDecoration.java @@ -7,9 +7,11 @@ import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.support.annotation.ColorInt; import android.support.annotation.ColorRes; import android.support.annotation.DimenRes; import android.support.annotation.DrawableRes; +import android.support.annotation.Px; import android.support.v4.content.ContextCompat; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; @@ -354,7 +356,7 @@ public T paintProvider(PaintProvider provider) { return (T) this; } - public T color(final int color) { + public T color(@ColorInt final int color) { return colorProvider(new ColorProvider() { @Override public int dividerColor(int position, RecyclerView parent) { @@ -390,7 +392,7 @@ public T drawableProvider(DrawableProvider provider) { return (T) this; } - public T size(final int size) { + public T size(@Px final int size) { return sizeProvider(new SizeProvider() { @Override public int dividerSize(int position, RecyclerView parent) { diff --git a/library/src/main/java/com/yqritc/recyclerviewflexibledivider/HorizontalDividerItemDecoration.java b/library/src/main/java/com/yqritc/recyclerviewflexibledivider/HorizontalDividerItemDecoration.java index aefa9d6..67c1c20 100644 --- a/library/src/main/java/com/yqritc/recyclerviewflexibledivider/HorizontalDividerItemDecoration.java +++ b/library/src/main/java/com/yqritc/recyclerviewflexibledivider/HorizontalDividerItemDecoration.java @@ -4,6 +4,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.annotation.DimenRes; +import android.support.annotation.Px; import android.support.v4.view.ViewCompat; import android.support.v7.widget.RecyclerView; import android.view.View; @@ -104,6 +105,7 @@ public interface MarginProvider { * @param parent RecyclerView * @return left margin */ + @Px int dividerLeftMargin(int position, RecyclerView parent); /** @@ -113,6 +115,7 @@ public interface MarginProvider { * @param parent RecyclerView * @return right margin */ + @Px int dividerRightMargin(int position, RecyclerView parent); } @@ -134,7 +137,7 @@ public Builder(Context context) { super(context); } - public Builder margin(final int leftMargin, final int rightMargin) { + public Builder margin(@Px final int leftMargin, @Px final int rightMargin) { return marginProvider(new MarginProvider() { @Override public int dividerLeftMargin(int position, RecyclerView parent) { @@ -148,7 +151,7 @@ public int dividerRightMargin(int position, RecyclerView parent) { }); } - public Builder margin(int horizontalMargin) { + public Builder margin(@Px int horizontalMargin) { return margin(horizontalMargin, horizontalMargin); } diff --git a/library/src/main/java/com/yqritc/recyclerviewflexibledivider/VerticalDividerItemDecoration.java b/library/src/main/java/com/yqritc/recyclerviewflexibledivider/VerticalDividerItemDecoration.java index a7562cc..9dc8e41 100644 --- a/library/src/main/java/com/yqritc/recyclerviewflexibledivider/VerticalDividerItemDecoration.java +++ b/library/src/main/java/com/yqritc/recyclerviewflexibledivider/VerticalDividerItemDecoration.java @@ -4,6 +4,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.annotation.DimenRes; +import android.support.annotation.Px; import android.support.v4.view.ViewCompat; import android.support.v7.widget.RecyclerView; import android.view.View; @@ -104,6 +105,7 @@ public interface MarginProvider { * @param parent RecyclerView * @return top margin */ + @Px int dividerTopMargin(int position, RecyclerView parent); /** @@ -113,6 +115,7 @@ public interface MarginProvider { * @param parent RecyclerView * @return bottom margin */ + @Px int dividerBottomMargin(int position, RecyclerView parent); } @@ -134,7 +137,7 @@ public Builder(Context context) { super(context); } - public Builder margin(final int topMargin, final int bottomMargin) { + public Builder margin(@Px final int topMargin, @Px final int bottomMargin) { return marginProvider(new MarginProvider() { @Override public int dividerTopMargin(int position, RecyclerView parent) { @@ -148,7 +151,7 @@ public int dividerBottomMargin(int position, RecyclerView parent) { }); } - public Builder margin(int verticalMargin) { + public Builder margin(@Px int verticalMargin) { return margin(verticalMargin, verticalMargin); }