mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-13 12:38:58 +01:00
add start download now (#5386)
* add start download now download now for selected chapter from j2k Co-Authored-By: Jays2Kings <jays@outlook.com> * change string to action * move to bottom * oopsie Co-authored-by: Jays2Kings <jays@outlook.com>
This commit is contained in:
@@ -1057,6 +1057,11 @@ class MangaController :
|
||||
Timber.e(error)
|
||||
}
|
||||
|
||||
override fun startDownloadNow(position: Int) {
|
||||
val chapter = chaptersAdapter?.getItem(position) ?: return
|
||||
presenter.startDownloadingNow(chapter)
|
||||
}
|
||||
|
||||
// OVERFLOW MENU DIALOGS
|
||||
|
||||
private fun downloadChapters(choice: Int) {
|
||||
|
||||
@@ -517,6 +517,10 @@ class MangaPresenter(
|
||||
}
|
||||
}
|
||||
|
||||
fun startDownloadingNow(chapter: Chapter) {
|
||||
downloadManager.startDownloadNow(chapter)
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the selected chapter list as read/unread.
|
||||
* @param selectedChapters the list of selected chapters.
|
||||
|
||||
@@ -26,9 +26,16 @@ open class BaseChapterHolder(
|
||||
|
||||
// Download.State.DOWNLOADING, Download.State.QUEUE
|
||||
findItem(R.id.cancel_download).isVisible = item.status != Download.State.DOWNLOADED
|
||||
|
||||
// Download.State.QUEUE
|
||||
findItem(R.id.start_download).isVisible = item.status == Download.State.QUEUE
|
||||
},
|
||||
onMenuItemClick = {
|
||||
adapter.clickListener.deleteChapter(position)
|
||||
if (itemId == R.id.start_download) {
|
||||
adapter.clickListener.startDownloadNow(position)
|
||||
} else {
|
||||
adapter.clickListener.deleteChapter(position)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -18,5 +18,6 @@ abstract class BaseChaptersAdapter<T : IFlexible<*>>(
|
||||
interface OnChapterClickListener {
|
||||
fun downloadChapter(position: Int)
|
||||
fun deleteChapter(position: Int)
|
||||
fun startDownloadNow(position: Int)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,6 +318,11 @@ class UpdatesController :
|
||||
adapter?.updateItem(item)
|
||||
}
|
||||
|
||||
override fun startDownloadNow(position: Int) {
|
||||
val chapter = adapter?.getItem(position) as? UpdatesItem ?: return
|
||||
presenter.startDownloadingNow(chapter)
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when ActionMode created.
|
||||
* @param mode the ActionMode object
|
||||
|
||||
@@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.recent.updates
|
||||
|
||||
import android.os.Bundle
|
||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||
import eu.kanade.tachiyomi.data.database.models.MangaChapter
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.download.model.Download
|
||||
@@ -134,6 +135,10 @@ class UpdatesPresenter(
|
||||
}
|
||||
}
|
||||
|
||||
fun startDownloadingNow(chapter: Chapter) {
|
||||
downloadManager.startDownloadNow(chapter)
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark selected chapter as read
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user