diff --git a/.idea/libraries/animated_vector_drawable_25_1_1.xml b/.idea/libraries/animated_vector_drawable_25_1_1.xml index d2fa75f..bdccb6f 100644 --- a/.idea/libraries/animated_vector_drawable_25_1_1.xml +++ b/.idea/libraries/animated_vector_drawable_25_1_1.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/appcompat_v7_25_1_1.xml b/.idea/libraries/appcompat_v7_25_1_1.xml index 418ea36..a1c526e 100644 --- a/.idea/libraries/appcompat_v7_25_1_1.xml +++ b/.idea/libraries/appcompat_v7_25_1_1.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/espresso_core_2_2_2.xml b/.idea/libraries/espresso_core_2_2_2.xml index 1a1c740..476e2f0 100644 --- a/.idea/libraries/espresso_core_2_2_2.xml +++ b/.idea/libraries/espresso_core_2_2_2.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/espresso_idling_resource_2_2_2.xml b/.idea/libraries/espresso_idling_resource_2_2_2.xml index 5222a92..646527a 100644 --- a/.idea/libraries/espresso_idling_resource_2_2_2.xml +++ b/.idea/libraries/espresso_idling_resource_2_2_2.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/exposed_instrumentation_api_publish_0_5.xml b/.idea/libraries/exposed_instrumentation_api_publish_0_5.xml index 5152e66..2565f08 100644 --- a/.idea/libraries/exposed_instrumentation_api_publish_0_5.xml +++ b/.idea/libraries/exposed_instrumentation_api_publish_0_5.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/rules_0_5.xml b/.idea/libraries/rules_0_5.xml index 597212e..91c140d 100644 --- a/.idea/libraries/rules_0_5.xml +++ b/.idea/libraries/rules_0_5.xml @@ -5,8 +5,8 @@ - - + + diff --git a/.idea/libraries/runner_0_5.xml b/.idea/libraries/runner_0_5.xml index 1b33ac7..96316de 100644 --- a/.idea/libraries/runner_0_5.xml +++ b/.idea/libraries/runner_0_5.xml @@ -5,8 +5,8 @@ - - + + diff --git a/.idea/libraries/support_compat_25_1_1.xml b/.idea/libraries/support_compat_25_1_1.xml index 2d993b9..1045396 100644 --- a/.idea/libraries/support_compat_25_1_1.xml +++ b/.idea/libraries/support_compat_25_1_1.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/support_core_ui_25_1_1.xml b/.idea/libraries/support_core_ui_25_1_1.xml index d9eb80d..8da7045 100644 --- a/.idea/libraries/support_core_ui_25_1_1.xml +++ b/.idea/libraries/support_core_ui_25_1_1.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/support_core_utils_25_1_1.xml b/.idea/libraries/support_core_utils_25_1_1.xml index 5f45667..e2d1b01 100644 --- a/.idea/libraries/support_core_utils_25_1_1.xml +++ b/.idea/libraries/support_core_utils_25_1_1.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/support_fragment_25_1_1.xml b/.idea/libraries/support_fragment_25_1_1.xml index 36cf780..0a07a5a 100644 --- a/.idea/libraries/support_fragment_25_1_1.xml +++ b/.idea/libraries/support_fragment_25_1_1.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/support_media_compat_25_1_1.xml b/.idea/libraries/support_media_compat_25_1_1.xml index 43b001c..4526a84 100644 --- a/.idea/libraries/support_media_compat_25_1_1.xml +++ b/.idea/libraries/support_media_compat_25_1_1.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/support_v4_25_1_1.xml b/.idea/libraries/support_v4_25_1_1.xml index 1d42a0a..612912d 100644 --- a/.idea/libraries/support_v4_25_1_1.xml +++ b/.idea/libraries/support_v4_25_1_1.xml @@ -1,8 +1,8 @@ - - + + diff --git a/.idea/libraries/support_vector_drawable_25_1_1.xml b/.idea/libraries/support_vector_drawable_25_1_1.xml index 57b1ae5..c183294 100644 --- a/.idea/libraries/support_vector_drawable_25_1_1.xml +++ b/.idea/libraries/support_vector_drawable_25_1_1.xml @@ -1,8 +1,8 @@ - - + + diff --git a/build.gradle b/build.gradle index 166d919..dbb3ca8 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.0-beta4' + classpath 'com.android.tools.build:gradle:2.3.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' } } diff --git a/library/src/main/java/com/dx/dxloadingbutton/lib/LoadingButton.java b/library/src/main/java/com/dx/dxloadingbutton/lib/LoadingButton.java index 39e8690..2e1205c 100644 --- a/library/src/main/java/com/dx/dxloadingbutton/lib/LoadingButton.java +++ b/library/src/main/java/com/dx/dxloadingbutton/lib/LoadingButton.java @@ -86,7 +86,7 @@ public enum AnimationType { private RectF mButtonRectF,mArcRectF; - private ValueAnimator mLoadingAnimator; + private AnimatorSet mLoadingAnimatorSet; public LoadingButton(Context context) { super(context); @@ -254,8 +254,8 @@ public void startLoading(){ * loading data successful */ public void loadingSuccessful(){ - if(mLoadingAnimator != null && mLoadingAnimator.isRunning()){ - mLoadingAnimator.end(); + if(mLoadingAnimatorSet != null && mLoadingAnimatorSet.isStarted()){ + mLoadingAnimatorSet.end(); mCurrentState = STATE_STOP_LOADING; playSuccessAnimation(); } @@ -265,8 +265,8 @@ public void loadingSuccessful(){ * loading data failed */ public void loadingFailed(){ - if(mLoadingAnimator != null && mLoadingAnimator.isRunning()){ - mLoadingAnimator.end(); + if(mLoadingAnimatorSet != null && mLoadingAnimatorSet.isStarted()){ + mLoadingAnimatorSet.end(); mCurrentState = STATE_STOP_LOADING; playFailedAnimation(); } @@ -495,26 +495,26 @@ public void onAnimationEnd(Animator animator) { } }); - mLoadingAnimator = ValueAnimator.ofInt(30,300); - mLoadingAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + ValueAnimator loadingAnimator = ValueAnimator.ofInt(30,300); + loadingAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { mAngle = (Integer) valueAnimator.getAnimatedValue(); invalidate(); } }); - mLoadingAnimator.setDuration(1000); - mLoadingAnimator.setRepeatCount(-1); - mLoadingAnimator.setRepeatMode(ValueAnimator.REVERSE); - mLoadingAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); + loadingAnimator.setDuration(1000); + loadingAnimator.setRepeatCount(-1); + loadingAnimator.setRepeatMode(ValueAnimator.REVERSE); + loadingAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); - AnimatorSet set = new AnimatorSet(); + mLoadingAnimatorSet = new AnimatorSet(); if(isReverse){ - set.playSequentially(animator2,animator); + mLoadingAnimatorSet.playSequentially(animator2,animator); }else{ - set.playSequentially(animator,animator2,mLoadingAnimator); + mLoadingAnimatorSet.playSequentially(animator,animator2,loadingAnimator); } - set.start(); + mLoadingAnimatorSet.start(); } private void playSuccessAnimation(){