Skip to content

Commit

Permalink
release v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mthli committed Jan 3, 2016
1 parent c8785e8 commit d15a09c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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!
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions slice/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
defaultConfig {
minSdkVersion 7
targetSdkVersion 23
versionCode 2
versionName "1.1"
versionCode 3
versionName "1.2"
}

buildTypes {
Expand Down
10 changes: 3 additions & 7 deletions slice/src/main/java/io/github/mthli/slice/Slice.java
Original file line number Diff line number Diff line change
Expand Up @@ -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}
);
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d15a09c

Please sign in to comment.