From e4045a93f3d52b93bc35b094b534bc142d697b6f Mon Sep 17 00:00:00 2001 From: Sergey Eremin Date: Fri, 2 Jun 2017 03:53:39 +0300 Subject: [PATCH] Install button is now disabled until installation finishes if auto install preference is on --- .../yeriomin/yalpstore/DetailsDownloadReceiver.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/com/github/yeriomin/yalpstore/DetailsDownloadReceiver.java b/app/src/main/java/com/github/yeriomin/yalpstore/DetailsDownloadReceiver.java index 726476f9e..4e7eb3a0f 100644 --- a/app/src/main/java/com/github/yeriomin/yalpstore/DetailsDownloadReceiver.java +++ b/app/src/main/java/com/github/yeriomin/yalpstore/DetailsDownloadReceiver.java @@ -39,11 +39,19 @@ public class DetailsDownloadReceiver extends BroadcastReceiver { if (!state.isEverythingFinished()) { return; } + draw(context, state); + } + + private void draw(Context context, DownloadState state) { buttonDownload.setText(R.string.details_download); buttonDownload.setEnabled(true); if (state.isEverythingSuccessful()) { buttonDownload.setVisibility(View.GONE); buttonInstall.setVisibility(View.VISIBLE); + if (PreferenceActivity.getBoolean(context, PreferenceActivity.PREFERENCE_AUTO_INSTALL)) { + buttonInstall.setEnabled(false); + buttonInstall.setText(R.string.details_installing); + } } } }