From 2b649dbc89481a18318b0c1f4974ce3f650178e7 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 6 Jul 2019 19:55:22 +0200 Subject: add blocking vpn info in corresponding alert dialog, use similar layout as for donation dialog --- .../bitmaskclient/fragments/AlwaysOnDialog.java | 50 +++++++++++------ .../main/res/drawable/cust_button_secondary.xml | 8 +-- app/src/main/res/layout/d_checkbox_confirm.xml | 65 +++++++++++++++++++++- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 5 files changed, 104 insertions(+), 21 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java index e3d004f5..34ad971e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java @@ -1,23 +1,31 @@ package se.leap.bitmaskclient.fragments; import android.app.Dialog; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.v4.text.TextUtilsCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatDialogFragment; +import android.support.v7.widget.AppCompatTextView; +import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; +import android.widget.Button; import android.widget.CheckBox; import butterknife.ButterKnife; import butterknife.InjectView; +import butterknife.OnClick; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.views.IconTextView; import static se.leap.bitmaskclient.utils.PreferenceHelper.saveShowAlwaysOnDialog; +import static se.leap.bitmaskclient.utils.ViewHelper.convertDimensionToPx; /** @@ -36,6 +44,10 @@ public class AlwaysOnDialog extends AppCompatDialogFragment { @InjectView(R.id.user_message) IconTextView userMessage; + @InjectView(R.id.block_vpn_user_message) + AppCompatTextView blockVpnUserMessage; + + @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -51,22 +63,28 @@ public class AlwaysOnDialog extends AppCompatDialogFragment { userMessage.setIcon(R.drawable.ic_settings); userMessage.setText(getString(R.string.always_on_vpn_user_message)); - builder.setView(view) - .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - if (doNotShowAgainCheckBox.isChecked()) { - saveShowAlwaysOnDialog(getContext(), false); - } - Intent intent = new Intent("android.net.vpn.SETTINGS"); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); - } - }) - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - } - }); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + blockVpnUserMessage.setVisibility(View.VISIBLE); + } + + builder.setView(view); return builder.create(); } + + @OnClick(R.id.button_ok) + public void onOkClicked() { + if (doNotShowAgainCheckBox.isChecked()) { + saveShowAlwaysOnDialog(getContext(), false); + } + Intent intent = new Intent("android.net.vpn.SETTINGS"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + dismiss(); + } + + @OnClick(R.id.button_cancel) + public void onCancelClicked() { + dismiss(); + } } diff --git a/app/src/main/res/drawable/cust_button_secondary.xml b/app/src/main/res/drawable/cust_button_secondary.xml index 553adca8..baed7b44 100644 --- a/app/src/main/res/drawable/cust_button_secondary.xml +++ b/app/src/main/res/drawable/cust_button_secondary.xml @@ -4,16 +4,16 @@ - - + + - - + + diff --git a/app/src/main/res/layout/d_checkbox_confirm.xml b/app/src/main/res/layout/d_checkbox_confirm.xml index 6dd22417..5a7f3508 100644 --- a/app/src/main/res/layout/d_checkbox_confirm.xml +++ b/app/src/main/res/layout/d_checkbox_confirm.xml @@ -2,23 +2,86 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 0fba388e..0b25a2a2 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -113,6 +113,7 @@ VPN immer anlassen Nicht erneut anzeigen Um durchgehend aktives VPN in den Android VPN Einstellungen einzuschalten, klicke auf das Zahnrad [img src] und aktiviere den Schalter. + Aktiviere zusätzlich die Option \"Verbindungen nur über VPN zulassen\", um deine Privatsphäre optimal zu schützen. Spenden Spende noch heute, wenn du sichere Kommunikation wertschätzt, die sowohl für Endnutzer*innen als auch Menschen die den Service bereit stellen leicht nutzbar ist. LEAP benötigt Spenden und Stipendien. Spende noch heute wenn du sichere Kommunikation wertschätzt, die sowohl für Enandwender*innen als auch Menschen die den Dienst anbieten leicht nutzbar ist. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 551b7cb1..a827d172 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -104,6 +104,7 @@ Always-on VPN Do not show again To enable always-on VPN in Android VPN Settings click on the configure icon [img src] and turn the switch on. + To protect your privacy optimally, you should also activate the option \"Allow connections only via VPN\". Donate Please donate today if you value secure communication that is easy for both the end-user and the service provider. LEAP depends on donations and grants. Please donate today if you value secure communication that is easy for both the end-user and the service provider. -- cgit v1.2.3