From 011d683c233dedf90a52b9edb59f311bcfa3e065 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 8 Jan 2018 23:11:57 -0600 Subject: ToolsInstallerPreference: Examine current state on load Signed-off-by: Samuel Holland --- .../com/wireguard/android/preference/ToolsInstallerPreference.java | 7 +++++++ 1 file changed, 7 insertions(+) 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 @@ -58,6 +58,13 @@ public class ToolsInstallerPreference extends Preference { return R.string.tools_installer_title; } + @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); -- cgit v1.2.3