diff options
author | Arne Schwabe <arne@rfc2549.org> | 2016-05-04 19:11:11 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2016-05-04 19:11:11 +0200 |
commit | a8a3589d7fa6a5e088bfd5e530e78c6e4f15686c (patch) | |
tree | cf757a3316d02ebfb95c04f3e879adf1adcdfddb /main | |
parent | c126740f463582545afcd27b7725fc84b2d0907c (diff) |
Dismiss error dialog on touch outside
Diffstat (limited to 'main')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/LaunchVPN.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java b/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java index df19565c..1df4b0e4 100644 --- a/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java +++ b/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java @@ -5,6 +5,7 @@ package de.blinkt.openvpn; +import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; import android.content.ActivityNotFoundException; @@ -13,6 +14,7 @@ import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.SharedPreferences; import android.net.VpnService; +import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.InputType; @@ -233,9 +235,27 @@ public class LaunchVPN extends Activity { } }); + d.setOnCancelListener(new DialogInterface.OnCancelListener() { + @Override + public void onCancel(DialogInterface dialog) { + finish(); + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) + setOnDismissListener(d); d.show(); } + @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) + private void setOnDismissListener(AlertDialog.Builder d) { + d.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + finish(); + } + }); + } + void launchVPN() { int vpnok = mSelectedProfile.checkProfile(this); if (vpnok != R.string.no_error_found) { |