From 7e55369cb99cf8362072a0d4fc78bdd238bc24f4 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 26 Nov 2021 11:56:39 +0100 Subject: instead of leaving the settings screen, show a toast if VPN needs to reconnect to apply setting changes --- .../leap/bitmaskclient/base/fragments/SettingsFragment.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) 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 a38314d1..a695fcb2 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 @@ -7,6 +7,7 @@ import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -94,7 +95,7 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh useBridges(getContext(), isChecked); if (VpnStatus.isVPNActive()) { EipCommand.startVPN(getContext(), false); - showVPNFragment(); + Toast.makeText(getContext(), R.string.reconnecting, Toast.LENGTH_LONG).show(); } }); @@ -143,7 +144,7 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh preferUDP(getContext(), isChecked); if (VpnStatus.isVPNActive()) { EipCommand.startVPN(getContext(), false); - showVPNFragment(); + Toast.makeText(getContext(), R.string.reconnecting, Toast.LENGTH_LONG).show(); } }); } @@ -191,14 +192,6 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh }); } - private void showVPNFragment() { - Intent intent = new Intent(getContext(), MainActivity.class); - intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); - intent.setAction(ACTION_SHOW_VPN_FRAGMENT); - startActivity(intent); - } - - private void initTetheringEntry(View rootView) { tethering = rootView.findViewById(R.id.tethering); tethering.setOnClickListener((buttonView) -> { -- cgit v1.2.3