Remove gallery if it's downloaded

This commit is contained in:
seven332 committed 2019-06-20 19:32:08 +08:00
1 parent d00f6e6cc6
commit 04521dfeb6
1 file changed
+9 -1
@@ -1186,7 +1186,15 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
} else if (mDownload == v) {
GalleryInfo galleryInfo = getGalleryInfo();
if (galleryInfo != null) {
CommonOperations.startDownload(activity, galleryInfo, false);
if (EhApplication.getDownloadManager(context).getDownloadState(galleryInfo.gid) == DownloadInfo.STATE_INVALID) {
CommonOperations.startDownload(activity, galleryInfo, false);
} else {
new AlertDialog.Builder(context)
.setTitle(R.string.download_remove_dialog_title)
.setMessage(getString(R.string.download_remove_dialog_message, galleryInfo.title))
.setPositiveButton(android.R.string.ok, (dialog1, which1) -> EhApplication.getDownloadManager(context).deleteDownload(galleryInfo.gid))
.show();
}
}
} else if (mRead == v) {
GalleryInfo galleryInfo = null;