From d157f98aebc088205f427861ac414d19c7a05c3a Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 24 Oct 2023 21:57:06 +0200 Subject: show progress spinner during provider setup in custom flavored apps --- .../bitmaskclient/base/views/ProgressSpinner.java | 5 + .../fragments/ConfigureProviderFragment.java | 8 ++ .../setup_rotate_progress_image.xml | 103 +++++++++++++++++++++ .../drawable-hdpi/setup_rotate_progress_image.png | Bin 0 -> 6427 bytes .../drawable-xhdpi/setup_rotate_progress_image.png | Bin 0 -> 9736 bytes .../setup_rotate_progress_image.png | Bin 0 -> 12752 bytes .../main/res/drawable/setup_progress_spinner.xml | 28 ++++++ .../res/drawable/setup_rotate_progress_image.png | Bin 0 -> 4945 bytes 8 files changed, 144 insertions(+) create mode 100644 app/src/main/res/drawable-anydpi-v24/setup_rotate_progress_image.xml create mode 100644 app/src/main/res/drawable-hdpi/setup_rotate_progress_image.png create mode 100644 app/src/main/res/drawable-xhdpi/setup_rotate_progress_image.png create mode 100644 app/src/main/res/drawable-xxhdpi/setup_rotate_progress_image.png create mode 100644 app/src/main/res/drawable/setup_progress_spinner.xml create mode 100644 app/src/main/res/drawable/setup_rotate_progress_image.png (limited to 'app/src/main') 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 index 380ddf23..97238ec6 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/ProgressSpinner.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/ProgressSpinner.java @@ -2,6 +2,7 @@ package se.leap.bitmaskclient.base.views; import android.annotation.TargetApi; import android.content.Context; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.RelativeLayout; @@ -60,4 +61,8 @@ public class ProgressSpinner extends RelativeLayout { } textView.setText(text); } + + public void setAnimatedSpinnerDrawable(Drawable drawable) { + spinnerView.setImageDrawable(drawable); + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ConfigureProviderFragment.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ConfigureProviderFragment.java index 3c36065e..26eb5f4c 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ConfigureProviderFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/ConfigureProviderFragment.java @@ -9,6 +9,7 @@ import static se.leap.bitmaskclient.R.string.description_configure_provider_circ import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_CODE; import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_RESULT_KEY; import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseSnowflake; import static se.leap.bitmaskclient.base.utils.ViewHelper.animateContainerVisibility; import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_DOWNLOADED_VPN_CERTIFICATE; @@ -28,6 +29,7 @@ import static se.leap.bitmaskclient.tor.TorStatusObservable.getLastTorLog; import android.app.Activity; import android.content.Intent; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -35,6 +37,7 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.content.res.ResourcesCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -42,6 +45,7 @@ import java.util.List; import java.util.Observable; import java.util.Observer; +import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.databinding.FConfigureProviderBinding; import se.leap.bitmaskclient.eip.EipSetupListener; @@ -116,6 +120,10 @@ public class ConfigureProviderFragment extends BaseSetupFragment implements Obse ignoreProviderAPIUpdates = false; binding.detailContainer.setVisibility(getUseSnowflake() ? VISIBLE : GONE); binding.tvCircumventionDescription.setText(getUseSnowflake() ? description_configure_provider_circumvention : description_configure_provider); + if (!isDefaultBitmask()) { + Drawable drawable = ResourcesCompat.getDrawable(getResources(), R.drawable.setup_progress_spinner, null); + binding.progressSpinner.setAnimatedSpinnerDrawable(drawable); + } setupActivityCallback.setNavigationButtonHidden(true); setupActivityCallback.setCancelButtonHidden(false); ProviderAPICommand.execute(getContext(), SET_UP_PROVIDER, setupActivityCallback.getSelectedProvider()); diff --git a/app/src/main/res/drawable-anydpi-v24/setup_rotate_progress_image.xml b/app/src/main/res/drawable-anydpi-v24/setup_rotate_progress_image.xml new file mode 100644 index 00000000..44a35ba9 --- /dev/null +++ b/app/src/main/res/drawable-anydpi-v24/setup_rotate_progress_image.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/setup_rotate_progress_image.png b/app/src/main/res/drawable-hdpi/setup_rotate_progress_image.png new file mode 100644 index 00000000..d7c85e02 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/setup_rotate_progress_image.png differ diff --git a/app/src/main/res/drawable-xhdpi/setup_rotate_progress_image.png b/app/src/main/res/drawable-xhdpi/setup_rotate_progress_image.png new file mode 100644 index 00000000..d6eb6b65 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/setup_rotate_progress_image.png differ diff --git a/app/src/main/res/drawable-xxhdpi/setup_rotate_progress_image.png b/app/src/main/res/drawable-xxhdpi/setup_rotate_progress_image.png new file mode 100644 index 00000000..893b074b Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/setup_rotate_progress_image.png differ diff --git a/app/src/main/res/drawable/setup_progress_spinner.xml b/app/src/main/res/drawable/setup_progress_spinner.xml new file mode 100644 index 00000000..1664e2b7 --- /dev/null +++ b/app/src/main/res/drawable/setup_progress_spinner.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/setup_rotate_progress_image.png b/app/src/main/res/drawable/setup_rotate_progress_image.png new file mode 100644 index 00000000..fe7f3526 Binary files /dev/null and b/app/src/main/res/drawable/setup_rotate_progress_image.png differ -- cgit v1.2.3