Skip to content

Commit a128392

Browse files
committed
Updated the version to v0.3.4.
1 parent fda5234 commit a128392

File tree

6 files changed

+290
-212
lines changed

6 files changed

+290
-212
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.0'
8+
classpath 'com.android.tools.build:gradle:2.2.1'
99
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
1010
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
1111
// NOTE: Do not place your application dependencies here; they belong

library/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ apply plugin: 'com.github.dcendents.android-maven'
33
apply plugin: 'com.jfrog.bintray'
44

55
// This is the library version used when deploying the artifact.
6-
version = "0.3.3"
6+
version = "0.3.4"
77

88
android {
99
compileSdkVersion 24
10-
buildToolsVersion '24.0.0'
10+
buildToolsVersion '24.0.2'
1111
resourcePrefix "waveloadingview"
1212
defaultConfig {
1313
minSdkVersion 14
1414
targetSdkVersion 24
15-
versionCode 4
15+
versionCode 6
1616
versionName "3.0"
1717
}
1818
buildTypes {

library/src/main/java/me/itangqi/waveloadingview/WaveLoadingView.java

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.animation.AnimatorSet;
44
import android.animation.ObjectAnimator;
55
import android.animation.ValueAnimator;
6+
import android.annotation.TargetApi;
67
import android.content.Context;
78
import android.content.res.TypedArray;
89
import android.graphics.Bitmap;
@@ -15,6 +16,7 @@
1516
import android.graphics.Point;
1617
import android.graphics.RectF;
1718
import android.graphics.Shader;
19+
import android.os.Build;
1820
import android.text.TextUtils;
1921
import android.util.AttributeSet;
2022
import android.view.View;
@@ -688,12 +690,44 @@ public void setCenterTitleStrokeColor(int centerTitleStrokeColor) {
688690
mCenterTitleStrokePaint.setColor(centerTitleStrokeColor);
689691
}
690692

691-
private void startAnimation() {
693+
public void startAnimation() {
692694
if (mAnimatorSet != null) {
693695
mAnimatorSet.start();
694696
}
695697
}
696698

699+
public void endAnimation() {
700+
if (mAnimatorSet != null) {
701+
mAnimatorSet.end();
702+
}
703+
}
704+
705+
public void cancelAnimation() {
706+
if (mAnimatorSet != null) {
707+
mAnimatorSet.cancel();
708+
}
709+
}
710+
711+
@TargetApi(Build.VERSION_CODES.KITKAT)
712+
@SuppressWarnings("deprecation")
713+
public void pauseAnimation() {
714+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
715+
if (mAnimatorSet != null) {
716+
mAnimatorSet.pause();
717+
}
718+
}
719+
}
720+
721+
@TargetApi(Build.VERSION_CODES.KITKAT)
722+
@SuppressWarnings("deprecation")
723+
public void resumeAnimation() {
724+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
725+
if (mAnimatorSet != null) {
726+
mAnimatorSet.resume();
727+
}
728+
}
729+
}
730+
697731
private void initAnimation() {
698732
// Wave waves infinitely.
699733
ObjectAnimator waveShiftAnim = ObjectAnimator.ofFloat(this, "waveShiftRatio", 0f, 1f);
@@ -705,12 +739,6 @@ private void initAnimation() {
705739
mAnimatorSet.play(waveShiftAnim);
706740
}
707741

708-
private void cancel() {
709-
if (mAnimatorSet != null) {
710-
mAnimatorSet.end();
711-
}
712-
}
713-
714742
@Override
715743
protected void onAttachedToWindow() {
716744
startAnimation();
@@ -719,7 +747,7 @@ protected void onAttachedToWindow() {
719747

720748
@Override
721749
protected void onDetachedFromWindow() {
722-
cancel();
750+
cancelAnimation();
723751
super.onDetachedFromWindow();
724752
}
725753

sample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android {
77
applicationId "me.itangqi.waveloadingview"
88
minSdkVersion 14
99
targetSdkVersion 24
10-
versionCode 3
10+
versionCode 6
1111
versionName '3.0'
1212
}
1313
buildTypes {

sample/src/main/java/me/itangqi/waveloadingview/MainActivity.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,29 @@ public void onClick(DialogInterface dialog, int which) {
6262
}
6363
});
6464

65+
// Animator
66+
((CheckBox) findViewById(R.id.cb_animator_cancel_and_start)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
67+
@Override
68+
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
69+
if (b) {
70+
mWaveLoadingView.cancelAnimation();
71+
} else {
72+
mWaveLoadingView.startAnimation();
73+
}
74+
}
75+
});
76+
77+
((CheckBox) findViewById(R.id.cb_animator_pause_and_resume)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
78+
@Override
79+
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
80+
if (b) {
81+
mWaveLoadingView.pauseAnimation();
82+
} else {
83+
mWaveLoadingView.resumeAnimation();
84+
}
85+
}
86+
});
87+
6588
// Top Title
6689
((CheckBox) findViewById(R.id.cb_title_top)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
6790
@Override
@@ -169,7 +192,6 @@ public void onColorSelected(@ColorInt int color) {
169192
}
170193
});
171194

172-
173195
// Border Color
174196
((LobsterShadeSlider) findViewById(R.id.shadeslider_border_color)).addOnColorListener(new OnColorListener() {
175197
@Override

0 commit comments

Comments
 (0)