mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 12:08:56 +01:00
Added option to download page or set page as cover (#481)
* Added option to download page or set page as cover * Removed network call now copies from page image * Format fix + notification feedback * Added code to prevent OutOfMemory error. Made notification optional. Can now save image on long press. Bug fixes * Now uses glide for notification * Fixed webtoon page * Fixes + API 16 support * fixes * Fixed API 24 FileProvider error * Added page.ready check * Indention
This commit is contained in:
@@ -297,7 +297,7 @@ class DownloadManager(
|
||||
}
|
||||
|
||||
// Get the filename for an image given the page
|
||||
private fun getImageFilename(page: Page): String {
|
||||
fun getImageFilename(page: Page): String {
|
||||
val url = page.imageUrl
|
||||
val number = String.format("%03d", page.pageNumber + 1)
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.download.model.Download
|
||||
import eu.kanade.tachiyomi.data.download.model.DownloadQueue
|
||||
import eu.kanade.tachiyomi.util.notificationManager
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
|
||||
/**
|
||||
* DownloadNotifier is used to show notifications when downloading one or multiple chapters.
|
||||
@@ -47,9 +48,8 @@ class DownloadNotifier(private val context: Context) {
|
||||
* @param queue the queue containing downloads.
|
||||
*/
|
||||
internal fun onProgressChange(queue: DownloadQueue) {
|
||||
if (multipleDownloadThreads) {
|
||||
if (multipleDownloadThreads)
|
||||
doOnProgressChange(null, queue)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,9 +60,8 @@ class DownloadNotifier(private val context: Context) {
|
||||
* @param queue the queue containing downloads
|
||||
*/
|
||||
internal fun onProgressChange(download: Download, queue: DownloadQueue) {
|
||||
if (!multipleDownloadThreads) {
|
||||
if (!multipleDownloadThreads)
|
||||
doOnProgressChange(download, queue)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +85,7 @@ class DownloadNotifier(private val context: Context) {
|
||||
}
|
||||
|
||||
// Create notification
|
||||
with (notificationBuilder) {
|
||||
with(notificationBuilder) {
|
||||
// Check if icon needs refresh
|
||||
if (!isDownloading) {
|
||||
setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
@@ -165,7 +164,6 @@ class DownloadNotifier(private val context: Context) {
|
||||
setProgress(0, 0, false)
|
||||
}
|
||||
context.notificationManager.notify(Constants.NOTIFICATION_DOWNLOAD_CHAPTER_ERROR_ID, notificationBuilder.build())
|
||||
|
||||
// Reset download information
|
||||
onClear()
|
||||
isDownloading = false
|
||||
|
||||
Reference in New Issue
Block a user