summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java15
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java26
-rw-r--r--app/src/main/res/layout/f_censorship_circumvention.xml2
-rw-r--r--app/src/main/res/layout/f_settings.xml33
-rw-r--r--app/src/main/res/values/strings.xml1
5 files changed, 64 insertions, 13 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java
index ca27f8e9..74a9ba4a 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java
@@ -16,14 +16,17 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RadioButton;
+import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
+import de.blinkt.openvpn.core.VpnStatus;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.base.models.ProviderObservable;
import se.leap.bitmaskclient.databinding.FCensorshipCircumventionBinding;
+import se.leap.bitmaskclient.eip.EipCommand;
public class CensorshipCircumventionFragment extends Fragment {
public static int DISCOVERY_NONE = 100200000;
@@ -94,9 +97,18 @@ public class CensorshipCircumventionFragment extends Fragment {
} else if (checkedId == DISCOVERY_INVITE_PROXY) {
useSnowflake(false);
}
+
+ tryReconnectVpn();
});
}
+ private void tryReconnectVpn() {
+ if (VpnStatus.isVPNActive()) {
+ EipCommand.startVPN(getContext(), false);
+ Toast.makeText(getContext(), R.string.reconnecting, Toast.LENGTH_LONG).show();
+ }
+ }
+
private void initTunneling() {
RadioButton noneRadioButton = new RadioButton(binding.getRoot().getContext());
@@ -132,7 +144,7 @@ public class CensorshipCircumventionFragment extends Fragment {
setUseObfs4Kcp(true);
setUseObfs4(false);
}
-
+ tryReconnectVpn();
});
}
@@ -145,6 +157,7 @@ public class CensorshipCircumventionFragment extends Fragment {
return;
}
setUsePortHopping(isChecked);
+ tryReconnectVpn();
});
}
} \ No newline at end of file
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java
index 1a9fd809..1167e8a7 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java
@@ -42,6 +42,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.appcompat.widget.SwitchCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
@@ -128,14 +129,15 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh
}
private void initManualCircumventionEntry(View rootView) {
- IconSwitchEntry manualConfiguration = rootView.findViewById(R.id.bridge_manual_switch);
+ IconTextEntry manualConfiguration = rootView.findViewById(R.id.bridge_manual_switch);
manualConfiguration.setVisibility(ProviderObservable.getInstance().getCurrentProvider().supportsPluggableTransports() ? VISIBLE : GONE);
- manualConfiguration.setChecked(usesManualBridges());
- manualConfiguration.setOnCheckedChangeListener((buttonView, isChecked) -> {
+ SwitchCompat manualConfigurationSwitch = rootView.findViewById(R.id.bridge_manual_switch_control);
+ manualConfigurationSwitch.setChecked(usesManualBridges());
+ manualConfigurationSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (!buttonView.isPressed()) {
return;
}
- openManualConfigurationFragment();
+ resetManualConfig();
});
manualConfiguration.setOnClickListener((buttonView) -> openManualConfigurationFragment());
@@ -147,6 +149,22 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh
manualConfiguration.setSubtitle(getString(useUDP? R.string.disabled_while_udp_on:R.string.manual_bridge_description));
}
+ private void resetManualConfig() {
+ useSnowflake(false);
+ setUseObfs4Kcp(false);
+ setUseObfs4(false);
+ setUsePortHopping(false);
+ if (VpnStatus.isVPNActive()) {
+ EipCommand.startVPN(getContext(), false);
+ Toast.makeText(getContext(), R.string.reconnecting, Toast.LENGTH_LONG).show();
+ }
+ View rootView = getView();
+ if (rootView == null) {
+ return;
+ }
+ initAutomaticCircumventionEntry(rootView);
+ }
+
private void openManualConfigurationFragment() {
FragmentManagerEnhanced fragmentManager = new FragmentManagerEnhanced(getActivity().getSupportFragmentManager());
Fragment fragment = CensorshipCircumventionFragment.newInstance();
diff --git a/app/src/main/res/layout/f_censorship_circumvention.xml b/app/src/main/res/layout/f_censorship_circumvention.xml
index 907b3b02..6e2d7b5d 100644
--- a/app/src/main/res/layout/f_censorship_circumvention.xml
+++ b/app/src/main/res/layout/f_censorship_circumvention.xml
@@ -59,7 +59,7 @@
android:layout_height="wrap_content"
android:paddingTop="@dimen/stdpadding"
app:text="@string/port_hopping"
- app:subtitle="\n"
+ app:subtitle="@string/port_hopping_description"
app:singleLine="false" />
</LinearLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/f_settings.xml b/app/src/main/res/layout/f_settings.xml
index e45f0bac..e7b4356f 100644
--- a/app/src/main/res/layout/f_settings.xml
+++ b/app/src/main/res/layout/f_settings.xml
@@ -62,14 +62,33 @@
app:icon="@drawable/bridge_automatic"
app:singleLine="false" />
- <se.leap.bitmaskclient.base.views.IconSwitchEntry
- android:id="@+id/bridge_manual_switch"
- android:layout_width="match_parent"
+ <LinearLayout
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- app:text="@string/manual_bridge"
- app:subtitle="@string/manual_bridge_description"
- app:icon="@drawable/bridge_manual"
- app:singleLine="false" />
+ android:orientation="horizontal">
+ <se.leap.bitmaskclient.base.views.IconTextEntry
+ android:id="@+id/bridge_manual_switch"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ app:text="@string/manual_bridge"
+ app:subtitle="@string/manual_bridge_description"
+ app:icon="@drawable/bridge_manual"
+ app:singleLine="false" />
+ <View
+ android:layout_width="1px"
+ android:background="@android:color/darker_gray"
+ android:layout_marginHorizontal="@dimen/stdpadding"
+ android:layout_marginVertical="@dimen/stdpadding"
+ android:layout_height="match_parent"/>
+ <androidx.appcompat.widget.SwitchCompat
+ android:id="@+id/bridge_manual_switch_control"
+ android:layout_gravity="center"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight"/>
+ </LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/experimental_header"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 14a884b3..656a8ea5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -261,4 +261,5 @@
<string name="tunnelling">Tunneling</string>
<string name="tunnelling_description">Censors can block access to the open internet. Choose a circumvention option to bypass blocks.</string>
<string name="port_hopping">Port Hopping</string>
+ <string name="port_hopping_description">"Censors use traffic analysis to block access to the open internet. Port Hopping can make this harder for them. "</string>
</resources>