From 1da539ddf8c0f651dd9dd363641fd7641b5b13be Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 13 Feb 2018 04:41:00 +0100 Subject: #8831 add a progress animation to EipFragment and don't start blocking vpn when user triggered vpn start from UI --- .../se/leap/bitmaskclient/views/VpnStateImage.java | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java (limited to 'app/src/main/java/se/leap/bitmaskclient/views') diff --git a/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java b/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java new file mode 100644 index 00000000..46221ae8 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java @@ -0,0 +1,61 @@ +package se.leap.bitmaskclient.views; + +import android.content.Context; +import android.support.constraint.ConstraintLayout; +import android.support.v7.widget.AppCompatImageView; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ProgressBar; + +import se.leap.bitmaskclient.R; + +/** + * Created by cyberta on 12.02.18. + */ + + +public class VpnStateImage extends ConstraintLayout { + + ProgressBar progressBar; + AppCompatImageView stateIcon; + + public VpnStateImage(Context context) { + super(context); + initLayout(context); + } + + public VpnStateImage(Context context, AttributeSet attrs) { + super(context, attrs); + initLayout(context); + } + + public VpnStateImage(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + initLayout(context); + } + + void initLayout(Context context) { + LayoutInflater inflater = (LayoutInflater) context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View rootview = inflater.inflate(R.layout.v_main_button, this, true); + stateIcon = rootview.findViewById(R.id.vpn_state_key); + progressBar = rootview.findViewById(R.id.progressBar); + progressBar.setIndeterminate(true); + } + + public void showProgress() { + progressBar.setVisibility(VISIBLE); + } + + + public void stopProgress() { + progressBar.setVisibility(GONE); + } + + public void setStateIcon(int resource) { + stateIcon.setImageResource(resource); + } + + +} -- cgit v1.2.3