diff options
author | cyBerta <cyberta@riseup.net> | 2023-08-04 13:11:45 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2023-08-04 13:11:45 +0200 |
commit | e3cdc73429b42bdfab9b836bddab49c6b3fc9640 (patch) | |
tree | e1af03df6fa8a8f8b21d73086146f130a1ea2db1 /app/src/main/java/se | |
parent | b0f511db4c55a4afa1ef4812dd2b88d74cf1087f (diff) |
implement custom 'start vpn' button design for initial provider setup
Diffstat (limited to 'app/src/main/java/se')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/views/MainButton.java | 15 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/SetupSuccessFragment.java | 4 |
2 files changed, 18 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/MainButton.java b/app/src/main/java/se/leap/bitmaskclient/base/views/MainButton.java index c7273613..2fcc036e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/MainButton.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/MainButton.java @@ -2,10 +2,13 @@ package se.leap.bitmaskclient.base.views; import android.annotation.TargetApi; import android.content.Context; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.RelativeLayout; +import androidx.annotation.DrawableRes; import androidx.appcompat.widget.AppCompatImageView; import androidx.core.content.ContextCompat; @@ -56,4 +59,16 @@ public class MainButton extends RelativeLayout { button.setTag(isOn ? "button_circle_stop" : "button_circle_start"); } } + + public void setCustomDrawable(@DrawableRes int drawableResource) { + // Drawable drawable = ContextCompat.getDrawable(getContext(), drawableResource); + Drawable drawable = getContext().getDrawable(drawableResource); + if (drawable == null) { + return; + } + + drawable.setColorFilter(ContextCompat.getColor(getContext(), R.color.colorPrimaryLight), PorterDuff.Mode.MULTIPLY); + button.setImageDrawable(drawable); + button.setTag("button_setup_circle_custom"); + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/SetupSuccessFragment.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/SetupSuccessFragment.java index eb775e2a..448e357a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/SetupSuccessFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/SetupSuccessFragment.java @@ -8,6 +8,7 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.databinding.FSetupSuccessBinding; public class SetupSuccessFragment extends BaseSetupFragment { @@ -28,9 +29,10 @@ public class SetupSuccessFragment extends BaseSetupFragment { binding.mainButton.setOnClickListener(v -> { setupActivityCallback.onSetupFinished(); - binding.mainButton.updateState(false, true); binding.mainButton.setEnabled(false); + binding.mainButton.setCustomDrawable(R.drawable.button_setup_circle_progress); }); + binding.mainButton.setCustomDrawable(R.drawable.button_setup_circle_start); return binding.getRoot(); } |