diff --git a/README.md b/README.md index ca5dd4e..21c77cc 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ For example, we can build a card style background for RecyclerView: ![example.png](./example.png "example.png") -Here has a [demo apk](https://github.com/mthli/Slice/releases/download/v1.1/SliceDemo.1.1.apk "SliceDemo.1.1.apk"), and it's [source code](https://github.com/mthli/Slice/tree/master/app "SliceDemo.1.1.apk's source code"), very easy to understand~ +Here has a [demo apk](https://github.com/mthli/Slice/releases/download/v1.2/SliceDemo.1.2.apk "SliceDemo.1.2.apk"), and it's [source code](https://github.com/mthli/Slice/tree/master/app "SliceDemo.1.2.apk's source code"), very easy to understand~ ## API @@ -55,7 +55,7 @@ At your top-level `build.gradle` file: And then at your project `build.gradle` file: dependencies { - compile 'com.github.mthli:Slice:v1.1' + compile 'com.github.mthli:Slice:v1.2' } Done! diff --git a/app/build.gradle b/app/build.gradle index f0b31c8..9fd89a5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,8 +24,8 @@ android { applicationId "io.github.mthli.slicedemo" minSdkVersion 14 targetSdkVersion 23 - versionCode 2 - versionName "1.1" + versionCode 3 + versionName "1.2" } buildTypes { diff --git a/slice/build.gradle b/slice/build.gradle index 19a3970..69243f0 100644 --- a/slice/build.gradle +++ b/slice/build.gradle @@ -23,8 +23,8 @@ android { defaultConfig { minSdkVersion 7 targetSdkVersion 23 - versionCode 2 - versionName "1.1" + versionCode 3 + versionName "1.2" } buildTypes { diff --git a/slice/src/main/java/io/github/mthli/slice/Slice.java b/slice/src/main/java/io/github/mthli/slice/Slice.java index 0c0380a..d4999cb 100644 --- a/slice/src/main/java/io/github/mthli/slice/Slice.java +++ b/slice/src/main/java/io/github/mthli/slice/Slice.java @@ -68,14 +68,12 @@ private float dp2px(float dp) { return view.getResources().getDisplayMetrics().density * dp; } - @TargetApi(Build.VERSION_CODES.HONEYCOMB) - private ColorStateList buildColorStateList(int normal, int pressed) { + private ColorStateList buildColorStateList(int pressed) { return new ColorStateList(new int[][]{ new int[] {android.R.attr.state_pressed}, new int[] {android.R.attr.state_focused}, - new int[] {android.R.attr.state_activated}, new int[] {}}, - new int[] {pressed, pressed, pressed, normal} + new int[] {pressed, pressed, pressed} ); } @@ -117,9 +115,7 @@ public void draw(Canvas canvas, Paint paint) { } }); - int color = ((CustomRoundRectDrawable) drawable).getColor(); - RippleDrawable ripple = new RippleDrawable(buildColorStateList(color, mask), drawable, shape); - + RippleDrawable ripple = new RippleDrawable(buildColorStateList(mask), drawable, shape); view.setBackground(ripple); } else { view.setBackground(drawable);