diff options
author | cyBerta <cyberta@riseup.net> | 2019-07-06 19:55:22 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2019-07-12 17:03:55 +0200 |
commit | 2b649dbc89481a18318b0c1f4974ce3f650178e7 (patch) | |
tree | b79c9ce78314f4ef733ad5d1fbc9436aff8c7786 /app/src/main/java | |
parent | 65a09aa799e525d3bc60f5f4f489a3d70c6a8554 (diff) |
add blocking vpn info in corresponding alert dialog, use similar layout as for donation dialog
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java | 50 |
1 files changed, 34 insertions, 16 deletions
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(); + } } |