mirror of
https://github.com/samsonjs/media.git
synced 2026-03-27 09:45:47 +00:00
Don't start download if user explicitly deselects all tracks
PiperOrigin-RevId: 244003817
This commit is contained in:
parent
a0fe7ace83
commit
d656782bd4
1 changed files with 14 additions and 2 deletions
|
|
@ -240,7 +240,12 @@ public class DownloadTracker {
|
|||
}
|
||||
}
|
||||
}
|
||||
startDownload();
|
||||
DownloadRequest downloadRequest = buildDownloadRequest();
|
||||
if (downloadRequest.streamKeys.isEmpty()) {
|
||||
// All tracks were deselected in the dialog. Don't start the download.
|
||||
return;
|
||||
}
|
||||
startDownload(downloadRequest);
|
||||
}
|
||||
|
||||
// DialogInterface.OnDismissListener implementation.
|
||||
|
|
@ -254,9 +259,16 @@ public class DownloadTracker {
|
|||
// Internal methods.
|
||||
|
||||
private void startDownload() {
|
||||
DownloadRequest downloadRequest = downloadHelper.getDownloadRequest(Util.getUtf8Bytes(name));
|
||||
startDownload(buildDownloadRequest());
|
||||
}
|
||||
|
||||
private void startDownload(DownloadRequest downloadRequest) {
|
||||
DownloadService.startWithNewDownload(
|
||||
context, DemoDownloadService.class, downloadRequest, /* foreground= */ false);
|
||||
}
|
||||
|
||||
private DownloadRequest buildDownloadRequest() {
|
||||
return downloadHelper.getDownloadRequest(Util.getUtf8Bytes(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue