blob: 11fa582b01007e0bb304241c681d9b3ad390f930 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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);
}
}
|