Skip to content

Commit

Permalink
Remove gallery if it's downloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
seven332 committed Jun 20, 2019
1 parent d00f6e6 commit 04521df
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,15 @@ public void onClick(View v) {
} 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;
Expand Down

0 comments on commit 04521df

Please sign in to comment.