diff --git a/app/build.gradle b/app/build.gradle index 39592cf..e1e8e04 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.github.axet.audiorecorder" minSdkVersion 16 targetSdkVersion 23 - versionCode 34 - versionName "1.1.13" + versionCode 35 + versionName "1.1.14" } signingConfigs { release { diff --git a/app/src/main/java/com/github/axet/audiorecorder/animations/StepAnimation.java b/app/src/main/java/com/github/axet/audiorecorder/animations/StepAnimation.java index 5e80e29..d7c522d 100644 --- a/app/src/main/java/com/github/axet/audiorecorder/animations/StepAnimation.java +++ b/app/src/main/java/com/github/axet/audiorecorder/animations/StepAnimation.java @@ -2,9 +2,7 @@ package com.github.axet.audiorecorder.animations; import android.util.Log; import android.view.View; -import android.view.ViewGroup; import android.view.animation.Animation; -import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.view.animation.Transformation; @@ -28,8 +26,8 @@ public class StepAnimation extends Animation { if (animate) { if (m.hasEnded()) { - if ((expand && v.getVisibility() == View.GONE) || (!expand && v.getVisibility() == View.VISIBLE)) { - StepAnimation mm = c.create(); + StepAnimation mm = c.create(); + if (mm.animationReady()) { mm.startAnimation(v); } else { // do nothing, already visible view @@ -54,7 +52,8 @@ public class StepAnimation extends Animation { } else { StepAnimation mm = c.create(); if (animate) { - if ((expand && v.getVisibility() == View.GONE) || (!expand && v.getVisibility() == View.VISIBLE)) { + Log.d("123", "new " + expand + " " + mm.view.getVisibility()); + if (mm.animationReady()) { mm.startAnimation(v); } else { // do nothing. already visible @@ -71,6 +70,11 @@ public class StepAnimation extends Animation { this.expand = expand; } + // start animation only if view in proper visible state. gone for expanding, and visible for collapsing. + public boolean animationReady() { + return (expand && view.getVisibility() == View.GONE) || (!expand && view.getVisibility() == View.VISIBLE); + } + public void startAnimation(View v) { init(); // do first step to hide view (we animation does it).