diff options
author | cyBerta <cyberta@riseup.net> | 2018-02-13 16:48:33 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2018-02-13 16:48:33 +0100 |
commit | 69d79a7002df96f2d69a83fd19c69b3bdb19c829 (patch) | |
tree | 46c1426bb83460f0fe045dae3f770c6048438109 /app/src/main/java/se/leap/bitmaskclient/views | |
parent | a41e0b0f7ec0cff1dc7a34b42d663c777a317e61 (diff) |
#8831 add a fadeout animation for the progressbar
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/views')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java b/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java index 46221ae8..2efd83d6 100644 --- a/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java +++ b/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java @@ -6,6 +6,8 @@ import android.support.v7.widget.AppCompatImageView; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; import android.widget.ProgressBar; import se.leap.bitmaskclient.R; @@ -49,8 +51,28 @@ public class VpnStateImage extends ConstraintLayout { } - public void stopProgress() { - progressBar.setVisibility(GONE); + public void stopProgress(boolean animated) { + if (!animated) { + progressBar.setVisibility(GONE); + return; + } + + AlphaAnimation fadeOutAnimation = new AlphaAnimation(1.0f, 0.0f); + fadeOutAnimation.setDuration(1000); + fadeOutAnimation.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) {} + + @Override + public void onAnimationEnd(Animation animation) { + progressBar.setVisibility(GONE); + } + + @Override + public void onAnimationRepeat(Animation animation) {} + }); + + progressBar.startAnimation(fadeOutAnimation); } public void setStateIcon(int resource) { |