summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-01-08 23:11:57 -0600
committerSamuel Holland <samuel@sholland.org>2018-01-08 23:39:32 -0600
commit011d683c233dedf90a52b9edb59f311bcfa3e065 (patch)
tree7756588d8ca5988b5935835ca6ef453497954197 /app/src/main/java/com
parentb87568482d32e0b94fd82a1a77793f5b12de2e7c (diff)
ToolsInstallerPreference: Examine current state on load
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r--app/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java b/app/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java
index 15a8ab6a..1620fd10 100644
--- a/app/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java
+++ b/app/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java
@@ -59,6 +59,13 @@ public class ToolsInstallerPreference extends Preference {
}
@Override
+ protected void onAttachedToActivity() {
+ super.onAttachedToActivity();
+ asyncWorker.supplyAsync(toolsInstaller::areInstalled)
+ .thenAccept(installed -> setState(installed ? State.ALREADY : State.INITIAL));
+ }
+
+ @Override
protected void onClick() {
setState(State.WORKING);
asyncWorker.supplyAsync(toolsInstaller::install)