diff options
author | cyBerta <cyberta@riseup.net> | 2018-02-13 04:41:00 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2018-02-13 04:41:00 +0100 |
commit | 1da539ddf8c0f651dd9dd363641fd7641b5b13be (patch) | |
tree | 235875feea535f7709c376e6dfc2e8002f26587f /app/src/main/java/se/leap/bitmaskclient/views | |
parent | b37575a680cd1e345339bdc5c4c4bc1137b2e4f1 (diff) |
#8831 add a progress animation to EipFragment and don't start blocking vpn when user triggered vpn start from UI
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/views')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java | 61 |
1 files changed, 61 insertions, 0 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 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); + } + + +} |