wip: running download manager outside fdroid
This commit is contained in:
parent
dbd4c467f8
commit
5f989739bb
@ -554,7 +554,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
if (downloadHandler != null) {
|
if (downloadHandler != null) {
|
||||||
if (!inProcessOfChangingConfiguration) {
|
if (!inProcessOfChangingConfiguration) {
|
||||||
downloadHandler.cancel();
|
downloadHandler.cancel(false);
|
||||||
cleanUpFinishedDownload();
|
cleanUpFinishedDownload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1517,7 +1517,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
if (activity == null || activity.downloadHandler == null)
|
if (activity == null || activity.downloadHandler == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
activity.downloadHandler.cancel();
|
activity.downloadHandler.cancel(true);
|
||||||
activity.cleanUpFinishedDownload();
|
activity.cleanUpFinishedDownload();
|
||||||
setProgressVisible(false);
|
setProgressVisible(false);
|
||||||
updateViews();
|
updateViews();
|
||||||
|
@ -289,11 +289,13 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to cancel the download (if in progress) and also removes the progress
|
* Attempts to cancel the download (if in progress) and also removes the progress
|
||||||
* listener (to prevent
|
* listener
|
||||||
|
*
|
||||||
|
* @param userRequested - true if the user requested the cancel (via button click), otherwise false.
|
||||||
*/
|
*/
|
||||||
public void cancel() {
|
public void cancel(boolean userRequested) {
|
||||||
if (dlWrapper != null) {
|
if (dlWrapper != null) {
|
||||||
dlWrapper.attemptCancel();
|
dlWrapper.attemptCancel(userRequested);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class AsyncDownloadWrapper extends Handler {
|
|||||||
downloadThread.start();
|
downloadThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void attemptCancel() {
|
public void attemptCancel(boolean userRequested) {
|
||||||
if (downloadThread != null) {
|
if (downloadThread != null) {
|
||||||
downloadThread.interrupt();
|
downloadThread.interrupt();
|
||||||
}
|
}
|
||||||
|
@ -85,8 +85,12 @@ public class AsyncDownloader extends AsyncDownloadWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attemptCancel() {
|
public void attemptCancel(boolean userRequested) {
|
||||||
if (downloadId >= 0) dm.remove(downloadId);
|
if (userRequested && downloadId >= 0) {
|
||||||
|
dm.remove(downloadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
context.unregisterReceiver(downloadReceiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Broadcast receiver to receive broadcasts from the download manager
|
// Broadcast receiver to receive broadcasts from the download manager
|
||||||
|
Loading…
x
Reference in New Issue
Block a user