diff options
Diffstat (limited to 'app/src/main/java/se/leap')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 4 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java | 26 |
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) { |