mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-19 21:19:16 -04:00
Manual download no longer triggers autoinstallation
This commit is contained in:
@@ -51,13 +51,19 @@ public class DetailsDownloadReceiver extends BroadcastReceiver {
|
||||
}
|
||||
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);
|
||||
}
|
||||
if (!state.isEverythingSuccessful()) {
|
||||
return;
|
||||
}
|
||||
buttonDownload.setVisibility(View.GONE);
|
||||
buttonInstall.setVisibility(View.VISIBLE);
|
||||
if (PreferenceActivity.getBoolean(context, PreferenceActivity.PREFERENCE_AUTO_INSTALL)
|
||||
&& !state.getTriggeredBy().equals(DownloadState.TriggeredBy.MANUAL_DOWNLOAD_BUTTON)
|
||||
) {
|
||||
buttonInstall.setEnabled(false);
|
||||
buttonInstall.setText(R.string.details_installing);
|
||||
} else {
|
||||
buttonInstall.setEnabled(true);
|
||||
buttonInstall.setText(R.string.details_install);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ public class DownloadState {
|
||||
public enum TriggeredBy {
|
||||
DOWNLOAD_BUTTON,
|
||||
UPDATE_ALL_BUTTON,
|
||||
SCHEDULED_UPDATE
|
||||
SCHEDULED_UPDATE,
|
||||
MANUAL_DOWNLOAD_BUTTON
|
||||
}
|
||||
|
||||
enum Status {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Intent;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
@@ -43,6 +44,7 @@ public class ManualDownloadActivity extends DetailsActivity {
|
||||
ManualDownloadTextWatcher textWatcher = new ManualDownloadTextWatcher(
|
||||
app,
|
||||
(Button) findViewById(R.id.download),
|
||||
(Button) findViewById(R.id.install),
|
||||
downloadOrInstallFragment
|
||||
);
|
||||
String versionCode = Integer.toString(app.getVersionCode());
|
||||
@@ -66,12 +68,14 @@ public class ManualDownloadActivity extends DetailsActivity {
|
||||
|
||||
private final App app;
|
||||
private final Button downloadButton;
|
||||
private final Button installButton;
|
||||
private DownloadOrInstall downloadOrInstallManager;
|
||||
private Timer timer;
|
||||
|
||||
public ManualDownloadTextWatcher(App app, Button downloadButton, DownloadOrInstall downloadOrInstallManager) {
|
||||
public ManualDownloadTextWatcher(App app, Button downloadButton, Button installButton, DownloadOrInstall downloadOrInstallManager) {
|
||||
this.app = app;
|
||||
this.downloadButton = downloadButton;
|
||||
this.installButton = installButton;
|
||||
this.downloadOrInstallManager = downloadOrInstallManager;
|
||||
}
|
||||
|
||||
@@ -84,8 +88,10 @@ public class ManualDownloadActivity extends DetailsActivity {
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
try {
|
||||
app.setVersionCode(Integer.parseInt(s.toString()));
|
||||
installButton.setVisibility(View.GONE);
|
||||
downloadButton.setText(R.string.details_download_checking);
|
||||
downloadButton.setEnabled(false);
|
||||
downloadButton.setVisibility(View.VISIBLE);
|
||||
restartTimer();
|
||||
} catch (NumberFormatException e) {
|
||||
Log.w(getClass().getName(), s.toString() + " is not a number");
|
||||
|
||||
@@ -19,6 +19,9 @@ import com.github.yeriomin.yalpstore.model.App;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static com.github.yeriomin.yalpstore.DownloadState.TriggeredBy.DOWNLOAD_BUTTON;
|
||||
import static com.github.yeriomin.yalpstore.DownloadState.TriggeredBy.MANUAL_DOWNLOAD_BUTTON;
|
||||
|
||||
public class ButtonDownload extends Button {
|
||||
|
||||
public ButtonDownload(DetailsActivity activity, App app) {
|
||||
@@ -96,6 +99,7 @@ public class ButtonDownload extends Button {
|
||||
purchaseTask.setOnDownloadProgressListener(new OnDownloadProgressListener(progressBar, DownloadState.get(app.getPackageName())));
|
||||
purchaseTask.setApp(app);
|
||||
purchaseTask.setContext(activity);
|
||||
purchaseTask.setTriggeredBy(activity instanceof ManualDownloadActivity ? MANUAL_DOWNLOAD_BUTTON : DOWNLOAD_BUTTON);
|
||||
purchaseTask.prepareDialog(
|
||||
R.string.dialog_message_purchasing_app,
|
||||
R.string.dialog_title_purchasing_app
|
||||
|
||||
Reference in New Issue
Block a user