Skip to content

Commit 2e561fc

Browse files
committed
syntactic sugar
1 parent d779eab commit 2e561fc

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

circularanim/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ group='com.github.XunMengWinter'
55

66
android {
77
compileSdkVersion 24
8-
buildToolsVersion "24.0.0"
8+
buildToolsVersion "24.0.1"
99

1010
defaultConfig {
1111
minSdkVersion 14
@@ -23,6 +23,6 @@ android {
2323

2424
dependencies {
2525
compile fileTree(dir: 'libs', include: ['*.jar'])
26-
testCompile 'junit:junit:4.12'
27-
compile 'com.android.support:appcompat-v7:24.0.0'
26+
// testCompile 'junit:junit:4.12'
27+
// compile 'com.android.support:appcompat-v7:24.1.1'
2828
}

circularanim/src/main/java/top/wefor/circularanim/CircularAnim.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import android.animation.AnimatorListenerAdapter;
55
import android.annotation.SuppressLint;
66
import android.app.Activity;
7-
import android.support.annotation.DrawableRes;
87
import android.view.View;
98
import android.view.ViewAnimationUtils;
109
import android.view.ViewGroup;
@@ -17,7 +16,7 @@
1716
* <p/>
1817
* GitHub: https://github.com/XunMengWinter
1918
* <p/>
20-
* latest edited date: 2016-08-05 20:00
19+
* latest edited date: 2016-08-29 01:17
2120
*
2221
* @author ice
2322
*/
@@ -32,6 +31,7 @@ public interface OnAnimationEndListener {
3231

3332
@SuppressLint("NewApi")
3433
public static class VisibleBuilder {
34+
3535
private View mAnimView, mTriggerView;
3636

3737
private Float mStartRadius, mEndRadius;
@@ -73,12 +73,19 @@ public VisibleBuilder duration(long durationMills) {
7373
return this;
7474
}
7575

76+
@Deprecated //You can use method - go(OnAnimationEndListener onAnimationEndListener).
7677
public VisibleBuilder onAnimationEndListener(OnAnimationEndListener onAnimationEndListener) {
7778
mOnAnimationEndListener = onAnimationEndListener;
7879
return this;
7980
}
8081

8182
public void go() {
83+
go(null);
84+
}
85+
86+
public void go(OnAnimationEndListener onAnimationEndListener) {
87+
mOnAnimationEndListener = onAnimationEndListener;
88+
8289
// 版本判断
8390
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
8491
doOnEnd();
@@ -171,7 +178,6 @@ public static class FullActivityBuilder {
171178
private Activity mActivity;
172179
private View mTriggerView;
173180
private float mStartRadius = MINI_RADIUS;
174-
@DrawableRes
175181
private int mColorOrImageRes = android.R.color.white;
176182
private Long mDurationMills;
177183
private OnAnimationEndListener mOnAnimationEndListener;
@@ -187,7 +193,7 @@ public FullActivityBuilder startRadius(float startRadius) {
187193
return this;
188194
}
189195

190-
public FullActivityBuilder colorOrImageRes(@DrawableRes int colorOrImageRes) {
196+
public FullActivityBuilder colorOrImageRes(int colorOrImageRes) {
191197
mColorOrImageRes = colorOrImageRes;
192198
return this;
193199
}

demo/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 24
5-
buildToolsVersion "24.0.0"
5+
buildToolsVersion "24.0.1"
66

77
defaultConfig {
88
applicationId "top.wefor.circularanim"
@@ -22,8 +22,8 @@ android {
2222
dependencies {
2323
compile fileTree(dir: 'libs', include: ['*.jar'])
2424
testCompile 'junit:junit:4.12'
25-
compile 'com.android.support:appcompat-v7:24.0.0'
26-
compile 'com.android.support:design:24.0.0'
25+
compile 'com.android.support:appcompat-v7:24.1.1'
26+
compile 'com.android.support:design:24.1.1'
2727

2828
compile project(path: ':circularanim')
2929

demo/src/main/java/top/wefor/circularanimdemo/ListActivity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package top.wefor.circularanimdemo;
22

3-
import android.content.Context;
43
import android.content.Intent;
54
import android.os.Bundle;
65
import android.support.annotation.Nullable;
@@ -69,7 +68,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
6968

7069
@Override
7170
public int getItemCount() {
72-
return 2;
71+
return 3;
7372
}
7473

7574
class MyViewHolder extends RecyclerView.ViewHolder {

demo/src/main/java/top/wefor/circularanimdemo/MainActivity.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void onClick(View view) {
5757
public void onClick(View view) {
5858
CircularAnim.hide(mChangeBtn2)
5959
.endRadius(mProgressBar2.getHeight() / 2)
60-
.onAnimationEndListener(new CircularAnim.OnAnimationEndListener() {
60+
.go(new CircularAnim.OnAnimationEndListener() {
6161
@Override
6262
public void onAnimationEnd() {
6363
mProgressBar2.setVisibility(View.VISIBLE);
@@ -75,7 +75,7 @@ public void onAnimationEnd() {
7575
}
7676
}, 3000);
7777
}
78-
}).go();
78+
});
7979
}
8080
});
8181

@@ -109,6 +109,7 @@ public void onAnimationEnd() {
109109
}
110110
});
111111

112+
112113
mLogoBtnIv.setOnClickListener(new View.OnClickListener() {
113114
@Override
114115
public void onClick(View view) {

0 commit comments

Comments
 (0)