mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 19:27:25 +01:00
Add property to get the number of a page
This commit is contained in:
parent
d30c019b89
commit
3e1dc9f400
@ -302,7 +302,7 @@ class Downloader(private val context: Context, private val provider: DownloadPro
|
|||||||
if (page.imageUrl == null)
|
if (page.imageUrl == null)
|
||||||
return Observable.just(page)
|
return Observable.just(page)
|
||||||
|
|
||||||
val filename = String.format("%03d", page.index + 1)
|
val filename = String.format("%03d", page.number)
|
||||||
val tmpFile = tmpDir.findFile("$filename.tmp")
|
val tmpFile = tmpDir.findFile("$filename.tmp")
|
||||||
|
|
||||||
// Delete temp file if it exists.
|
// Delete temp file if it exists.
|
||||||
|
@ -12,6 +12,9 @@ class Page(
|
|||||||
@Transient var uri: Uri? = null
|
@Transient var uri: Uri? = null
|
||||||
) : ProgressListener {
|
) : ProgressListener {
|
||||||
|
|
||||||
|
val number: Int
|
||||||
|
get() = index + 1
|
||||||
|
|
||||||
@Transient lateinit var chapter: ReaderChapter
|
@Transient lateinit var chapter: ReaderChapter
|
||||||
|
|
||||||
@Transient @Volatile var status: Int = 0
|
@Transient @Volatile var status: Int = 0
|
||||||
|
@ -331,7 +331,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
|||||||
fun onPageChanged(page: Page) {
|
fun onPageChanged(page: Page) {
|
||||||
presenter.onPageChanged(page)
|
presenter.onPageChanged(page)
|
||||||
|
|
||||||
val pageNumber = page.index + 1
|
val pageNumber = page.number
|
||||||
val pageCount = page.chapter.pages!!.size
|
val pageCount = page.chapter.pages!!.size
|
||||||
page_number.text = "$pageNumber/$pageCount"
|
page_number.text = "$pageNumber/$pageCount"
|
||||||
if (page_seekbar.rotation != 180f) {
|
if (page_seekbar.rotation != 180f) {
|
||||||
|
@ -579,7 +579,7 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|||||||
// Build destination file.
|
// Build destination file.
|
||||||
val ext = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime) ?: "jpg"
|
val ext = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime) ?: "jpg"
|
||||||
val filename = DiskUtil.buildValidFilename(
|
val filename = DiskUtil.buildValidFilename(
|
||||||
"${manga.title} - ${chapter.name}") + " - ${page.index + 1}.$ext"
|
"${manga.title} - ${chapter.name}") + " - ${page.number}.$ext"
|
||||||
val destFile = File(destDir, filename)
|
val destFile = File(destDir, filename)
|
||||||
|
|
||||||
context.contentResolver.openInputStream(page.uri).use { input ->
|
context.contentResolver.openInputStream(page.uri).use { input ->
|
||||||
|
Loading…
Reference in New Issue
Block a user