Add download button to repo, close #99

This commit is contained in:
topjohnwu
2017-02-16 17:50:36 +08:00
parent 8c5acd1a0a
commit b58c7ba7c5
12 changed files with 42 additions and 26 deletions
@@ -21,17 +21,19 @@ public class ProcessRepoZip extends ParallelTask<Void, Void, Boolean> {
private Uri mUri;
private ProgressDialog progressDialog;
private boolean mInstall;
public ProcessRepoZip(Activity context, Uri uri) {
public ProcessRepoZip(Activity context, Uri uri, boolean install) {
super(context);
mUri = uri;
mInstall = install;
}
@Override
protected void onPreExecute() {
progressDialog = ProgressDialog.show(activity,
activity.getString(R.string.zip_install_progress_title),
activity.getString(R.string.zip_install_process_zip_msg));
activity.getString(R.string.zip_process_title),
activity.getString(R.string.zip_process_msg));
}
@Override
@@ -101,7 +103,7 @@ public class ProcessRepoZip extends ParallelTask<Void, Void, Boolean> {
protected void onPostExecute(Boolean result) {
progressDialog.dismiss();
if (result) {
if (Shell.rootAccess())
if (Shell.rootAccess() && mInstall)
new FlashZip(activity, mUri).exec();
else
Utils.showUriSnack(activity, mUri);