diff options
author | cyberta <cyberta@riseup.net> | 2023-08-07 01:51:31 +0000 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2023-08-07 01:51:31 +0000 |
commit | 5c8c3bcc384631edd45983b8beb066cf637695d9 (patch) | |
tree | 0b1be88a74c9594036d86147177d7ca5d9f67241 /app/src/main/java/se/leap/bitmaskclient/base/views/ProgressSpinner.java | |
parent | 46bbdf33a07f65c51f93f51075c6b11b43bad4ee (diff) | |
parent | 34539d080f2ce05eb668267180283f8332835d2c (diff) |
Merge branch 'first_run_improvements' into 'master'
update design and UX for provider setup
See merge request leap/bitmask_android!252
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base/views/ProgressSpinner.java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/views/ProgressSpinner.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/ProgressSpinner.java b/app/src/main/java/se/leap/bitmaskclient/base/views/ProgressSpinner.java new file mode 100644 index 00000000..380ddf23 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/ProgressSpinner.java @@ -0,0 +1,63 @@ +package se.leap.bitmaskclient.base.views; + +import android.annotation.TargetApi; +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.widget.RelativeLayout; + +import androidx.appcompat.widget.AppCompatImageView; +import androidx.appcompat.widget.AppCompatTextView; +import androidx.core.content.ContextCompat; + +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.databinding.VProgressSpinnerBinding; + +public class ProgressSpinner extends RelativeLayout { + + private static final String TAG = ProgressSpinner.class.getSimpleName(); + + AppCompatImageView spinnerView; + AppCompatTextView textView; + + public ProgressSpinner(Context context) { + super(context); + initLayout(context); + } + + public ProgressSpinner(Context context, AttributeSet attrs) { + super(context, attrs); + initLayout(context); + } + + public ProgressSpinner(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + initLayout(context); + } + + + public ProgressSpinner(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + initLayout(context); + } + + private void initLayout(Context context) { + VProgressSpinnerBinding binding = VProgressSpinnerBinding.inflate(LayoutInflater.from(context), this, true); + spinnerView = binding.spinnerView; + textView = binding.tvProgress; + } + + public void update(int progress) { + String text = ""; + if (progress > 0) { + if ((progress / 10) == 0) { + text = text + " "; + } + if ((progress / 100) == 0) { + text = text + " "; + } + text = text + progress + "%"; + } + textView.setText(text); + } +} |