Localize "Page list is empty" exception message
This commit is contained in:
parent
744a4f8f47
commit
2194c4ba28
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.download
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.hippo.unifile.UniFile
|
import com.hippo.unifile.UniFile
|
||||||
import com.jakewharton.rxrelay.BehaviorRelay
|
import com.jakewharton.rxrelay.BehaviorRelay
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
import eu.kanade.tachiyomi.data.download.model.Download
|
import eu.kanade.tachiyomi.data.download.model.Download
|
||||||
@ -152,7 +153,7 @@ class DownloadManager(private val context: Context) {
|
|||||||
.filter { "image" in it.type.orEmpty() }
|
.filter { "image" in it.type.orEmpty() }
|
||||||
|
|
||||||
if (files.isEmpty()) {
|
if (files.isEmpty()) {
|
||||||
throw Exception("Page list is empty")
|
throw Exception(context.getString(R.string.page_list_empty_error))
|
||||||
}
|
}
|
||||||
|
|
||||||
files.sortedBy { it.name }
|
files.sortedBy { it.name }
|
||||||
|
@ -5,6 +5,7 @@ import android.webkit.MimeTypeMap
|
|||||||
import com.hippo.unifile.UniFile
|
import com.hippo.unifile.UniFile
|
||||||
import com.jakewharton.rxrelay.BehaviorRelay
|
import com.jakewharton.rxrelay.BehaviorRelay
|
||||||
import com.jakewharton.rxrelay.PublishRelay
|
import com.jakewharton.rxrelay.PublishRelay
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.cache.ChapterCache
|
import eu.kanade.tachiyomi.data.cache.ChapterCache
|
||||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
@ -276,7 +277,7 @@ class Downloader(
|
|||||||
download.source.fetchPageList(download.chapter)
|
download.source.fetchPageList(download.chapter)
|
||||||
.doOnNext { pages ->
|
.doOnNext { pages ->
|
||||||
if (pages.isEmpty()) {
|
if (pages.isEmpty()) {
|
||||||
throw Exception("Page list is empty")
|
throw Exception(context.getString(R.string.page_list_empty_error))
|
||||||
}
|
}
|
||||||
download.pages = pages
|
download.pages = pages
|
||||||
}
|
}
|
||||||
|
@ -225,8 +225,9 @@ class ReaderPresenter(
|
|||||||
this.manga = manga
|
this.manga = manga
|
||||||
if (chapterId == -1L) chapterId = initialChapterId
|
if (chapterId == -1L) chapterId = initialChapterId
|
||||||
|
|
||||||
|
val context = Injekt.get<Application>()
|
||||||
val source = sourceManager.getOrStub(manga.source)
|
val source = sourceManager.getOrStub(manga.source)
|
||||||
loader = ChapterLoader(downloadManager, manga, source)
|
loader = ChapterLoader(context, downloadManager, manga, source)
|
||||||
|
|
||||||
Observable.just(manga).subscribeLatestCache(ReaderActivity::setManga)
|
Observable.just(manga).subscribeLatestCache(ReaderActivity::setManga)
|
||||||
viewerChaptersRelay.subscribeLatestCache(ReaderActivity::setChapters)
|
viewerChaptersRelay.subscribeLatestCache(ReaderActivity::setChapters)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.ui.reader.loader
|
package eu.kanade.tachiyomi.ui.reader.loader
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||||
import eu.kanade.tachiyomi.source.LocalSource
|
import eu.kanade.tachiyomi.source.LocalSource
|
||||||
@ -16,6 +18,7 @@ import timber.log.Timber
|
|||||||
* Loader used to retrieve the [PageLoader] for a given chapter.
|
* Loader used to retrieve the [PageLoader] for a given chapter.
|
||||||
*/
|
*/
|
||||||
class ChapterLoader(
|
class ChapterLoader(
|
||||||
|
private val context: Context,
|
||||||
private val downloadManager: DownloadManager,
|
private val downloadManager: DownloadManager,
|
||||||
private val manga: Manga,
|
private val manga: Manga,
|
||||||
private val source: Source
|
private val source: Source
|
||||||
@ -46,7 +49,7 @@ class ChapterLoader(
|
|||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.doOnNext { pages ->
|
.doOnNext { pages ->
|
||||||
if (pages.isEmpty()) {
|
if (pages.isEmpty()) {
|
||||||
throw Exception("Page list is empty")
|
throw Exception(context.getString(R.string.page_list_empty_error))
|
||||||
}
|
}
|
||||||
|
|
||||||
chapter.state = ReaderChapter.State.Loaded(pages)
|
chapter.state = ReaderChapter.State.Loaded(pages)
|
||||||
|
@ -559,6 +559,7 @@
|
|||||||
<string name="transition_no_previous">There\'s no previous chapter</string>
|
<string name="transition_no_previous">There\'s no previous chapter</string>
|
||||||
<string name="transition_pages_loading">Loading pages…</string>
|
<string name="transition_pages_loading">Loading pages…</string>
|
||||||
<string name="transition_pages_error">Failed to load pages: %1$s</string>
|
<string name="transition_pages_error">Failed to load pages: %1$s</string>
|
||||||
|
<string name="page_list_empty_error">No pages found</string>
|
||||||
|
|
||||||
<!-- Updates fragment -->
|
<!-- Updates fragment -->
|
||||||
<string name="updating_library">Updating library</string>
|
<string name="updating_library">Updating library</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user