diff options
author | Samuel Holland <samuel@sholland.org> | 2018-01-08 23:11:57 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-01-08 23:39:32 -0600 |
commit | 011d683c233dedf90a52b9edb59f311bcfa3e065 (patch) | |
tree | 7756588d8ca5988b5935835ca6ef453497954197 /app/src/main | |
parent | b87568482d32e0b94fd82a1a77793f5b12de2e7c (diff) |
ToolsInstallerPreference: Examine current state on load
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java | 7 |
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) |