ToolsInstallerPreference: Examine current state on load

Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
Samuel Holland 2018-01-08 23:11:57 -06:00
parent b87568482d
commit 011d683c23

View File

@ -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);