diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-06-02 18:38:56 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-06-02 18:38:56 +0200 |
commit | 9e278c88e6a261f51ecdcf8f5788a9d0d6902b19 (patch) | |
tree | cfdccb2805bd6c52ca3056c41bd953056527da9b | |
parent | c3246060f53c0b751975278da98ad81fc982c6bc (diff) |
ExporterPreferences: disable control immediately
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | app/src/main/java/com/wireguard/android/preference/LogExporterPreference.java | 6 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/app/src/main/java/com/wireguard/android/preference/LogExporterPreference.java b/app/src/main/java/com/wireguard/android/preference/LogExporterPreference.java index d73c41bc..cba30522 100644 --- a/app/src/main/java/com/wireguard/android/preference/LogExporterPreference.java +++ b/app/src/main/java/com/wireguard/android/preference/LogExporterPreference.java @@ -91,9 +91,9 @@ public class LogExporterPreference extends Preference { Snackbar.make( getPrefActivity(this).findViewById(android.R.id.content), message, Snackbar.LENGTH_LONG).show(); + setEnabled(true); } else { exportedFilePath = filePath; - setEnabled(false); notifyChanged(); } } @@ -115,8 +115,10 @@ public class LogExporterPreference extends Preference { getPrefActivity(this).ensurePermissions( new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, (permissions, granted) -> { - if (granted.length > 0 && granted[0] == PackageManager.PERMISSION_GRANTED) + if (granted.length > 0 && granted[0] == PackageManager.PERMISSION_GRANTED) { + setEnabled(false); exportLog(); + } }); } diff --git a/app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java b/app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java index 70357e44..b2f22a67 100644 --- a/app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java +++ b/app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java @@ -99,9 +99,9 @@ public class ZipExporterPreference extends Preference { Snackbar.make( getPrefActivity(this).findViewById(android.R.id.content), message, Snackbar.LENGTH_LONG).show(); + setEnabled(true); } else { exportedFilePath = filePath; - setEnabled(false); notifyChanged(); } } @@ -123,8 +123,10 @@ public class ZipExporterPreference extends Preference { getPrefActivity(this).ensurePermissions( new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, (permissions, granted) -> { - if (granted.length > 0 && granted[0] == PackageManager.PERMISSION_GRANTED) + if (granted.length > 0 && granted[0] == PackageManager.PERMISSION_GRANTED) { + setEnabled(false); exportZip(); + } }); } |