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() { | ||||
|         if (downloadHandler != null) { | ||||
|             if (!inProcessOfChangingConfiguration) { | ||||
|                 downloadHandler.cancel(); | ||||
|                 downloadHandler.cancel(false); | ||||
|                 cleanUpFinishedDownload(); | ||||
|             } | ||||
|         } | ||||
| @ -1517,7 +1517,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A | ||||
|             if (activity == null || activity.downloadHandler == null) | ||||
|                 return; | ||||
| 
 | ||||
|             activity.downloadHandler.cancel(); | ||||
|             activity.downloadHandler.cancel(true); | ||||
|             activity.cleanUpFinishedDownload(); | ||||
|             setProgressVisible(false); | ||||
|             updateViews(); | ||||
|  | ||||
| @ -289,11 +289,13 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener { | ||||
| 
 | ||||
|     /** | ||||
|      * 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) { | ||||
|             dlWrapper.attemptCancel(); | ||||
|             dlWrapper.attemptCancel(userRequested); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -47,7 +47,7 @@ public class AsyncDownloadWrapper extends Handler { | ||||
|         downloadThread.start(); | ||||
|     } | ||||
| 
 | ||||
|     public void attemptCancel() { | ||||
|     public void attemptCancel(boolean userRequested) { | ||||
|         if (downloadThread != null) { | ||||
|             downloadThread.interrupt(); | ||||
|         } | ||||
|  | ||||
| @ -85,8 +85,12 @@ public class AsyncDownloader extends AsyncDownloadWrapper { | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void attemptCancel() { | ||||
|         if (downloadId >= 0) dm.remove(downloadId); | ||||
|     public void attemptCancel(boolean userRequested) { | ||||
|         if (userRequested && downloadId >= 0) { | ||||
|             dm.remove(downloadId); | ||||
|         } | ||||
| 
 | ||||
|         context.unregisterReceiver(downloadReceiver); | ||||
|     } | ||||
| 
 | ||||
|     // Broadcast receiver to receive broadcasts from the download manager | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Toby Kurien
						Toby Kurien