summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java
new file mode 100644
index 00000000..11fa582b
--- /dev/null
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java
@@ -0,0 +1,58 @@
+package se.leap.bitmaskclient.providersetup.fragments;
+
+import android.graphics.Typeface;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import se.leap.bitmaskclient.base.utils.PreferenceHelper;
+import se.leap.bitmaskclient.databinding.FCircumventionSetupBinding;
+
+public class CircumventionSetupFragment extends BaseSetupFragment {
+
+ public static CircumventionSetupFragment newInstance(int position) {
+ CircumventionSetupFragment fragment = new CircumventionSetupFragment();
+ fragment.setArguments(initBundle(position));
+ return fragment;
+ }
+
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ FCircumventionSetupBinding binding = FCircumventionSetupBinding.inflate(inflater, container, false);
+
+ binding.circumventionRadioGroup.setOnCheckedChangeListener((group, checkedId) -> {
+ if (binding.rbCircumvention.getId() == checkedId) {
+ PreferenceHelper.useBridges(true);
+ PreferenceHelper.useSnowflake(true);
+ binding.tvCircumventionDetailDescription.setVisibility(View.VISIBLE);
+ binding.rbCircumvention.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
+ binding.rbPlainVpn.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
+ return;
+ }
+
+ PreferenceHelper.useBridges(false);
+ PreferenceHelper.useSnowflake(false);
+ binding.tvCircumventionDetailDescription.setVisibility(View.GONE);
+ binding.rbPlainVpn.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
+ binding.rbCircumvention.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
+ });
+
+ int id = (PreferenceHelper.hasSnowflakePrefs() && PreferenceHelper.getUseSnowflake()) ?
+ binding.rbCircumvention.getId() :
+ binding.rbPlainVpn.getId();
+ binding.circumventionRadioGroup.check(id);
+ return binding.getRoot();
+ }
+
+ @Override
+ public void onFragmentSelected() {
+ super.onFragmentSelected();
+ setupActivityCallback.setCancelButtonHidden(false);
+ setupActivityCallback.setNavigationButtonHidden(false);
+ }
+} \ No newline at end of file