summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2018-02-13 16:48:33 +0100
committercyBerta <cyberta@riseup.net>2018-02-13 16:48:33 +0100
commit69d79a7002df96f2d69a83fd19c69b3bdb19c829 (patch)
tree46c1426bb83460f0fe045dae3f770c6048438109 /app
parenta41e0b0f7ec0cff1dc7a34b42d663c777a317e61 (diff)
#8831 add a fadeout animation for the progressbar
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipFragment.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java26
2 files changed, 26 insertions, 4 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
index a082b047..4bacfff8 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
@@ -416,7 +416,7 @@ public class EipFragment extends Fragment implements Observer {
} else if (eipStatus.isConnected() || isOpenVpnRunningWithoutNetwork()) {
mainButton.setText(activity.getString(R.string.vpn_button_turn_off));
vpnStateImage.setStateIcon(R.drawable.vpn_connected);
- vpnStateImage.stopProgress();
+ vpnStateImage.stopProgress(true);
routedText.setVisibility(VISIBLE);
vpnRoute.setVisibility(VISIBLE);
vpnRoute.setText(ConfigHelper.getProviderName(preferences));
@@ -424,7 +424,7 @@ public class EipFragment extends Fragment implements Observer {
} else {
mainButton.setText(activity.getString(R.string.vpn_button_turn_on));
vpnStateImage.setStateIcon(R.drawable.vpn_disconnected);
- vpnStateImage.stopProgress();
+ vpnStateImage.stopProgress(false);
routedText.setVisibility(GONE);
vpnRoute.setVisibility(GONE);
greyscaleBackground();
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) {