Localize "Page list is empty" exception message

This commit is contained in:
arkon 2020-05-31 11:26:36 -04:00
parent 744a4f8f47
commit 2194c4ba28
5 changed files with 11 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.download
import android.content.Context
import com.hippo.unifile.UniFile
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.Manga
import eu.kanade.tachiyomi.data.download.model.Download
@ -152,7 +153,7 @@ class DownloadManager(private val context: Context) {
.filter { "image" in it.type.orEmpty() }
if (files.isEmpty()) {
throw Exception("Page list is empty")
throw Exception(context.getString(R.string.page_list_empty_error))
}
files.sortedBy { it.name }

View File

@ -5,6 +5,7 @@ import android.webkit.MimeTypeMap
import com.hippo.unifile.UniFile
import com.jakewharton.rxrelay.BehaviorRelay
import com.jakewharton.rxrelay.PublishRelay
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.cache.ChapterCache
import eu.kanade.tachiyomi.data.database.models.Chapter
import eu.kanade.tachiyomi.data.database.models.Manga
@ -276,7 +277,7 @@ class Downloader(
download.source.fetchPageList(download.chapter)
.doOnNext { pages ->
if (pages.isEmpty()) {
throw Exception("Page list is empty")
throw Exception(context.getString(R.string.page_list_empty_error))
}
download.pages = pages
}

View File

@ -225,8 +225,9 @@ class ReaderPresenter(
this.manga = manga
if (chapterId == -1L) chapterId = initialChapterId
val context = Injekt.get<Application>()
val source = sourceManager.getOrStub(manga.source)
loader = ChapterLoader(downloadManager, manga, source)
loader = ChapterLoader(context, downloadManager, manga, source)
Observable.just(manga).subscribeLatestCache(ReaderActivity::setManga)
viewerChaptersRelay.subscribeLatestCache(ReaderActivity::setChapters)

View File

@ -1,5 +1,7 @@
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.download.DownloadManager
import eu.kanade.tachiyomi.source.LocalSource
@ -16,6 +18,7 @@ import timber.log.Timber
* Loader used to retrieve the [PageLoader] for a given chapter.
*/
class ChapterLoader(
private val context: Context,
private val downloadManager: DownloadManager,
private val manga: Manga,
private val source: Source
@ -46,7 +49,7 @@ class ChapterLoader(
.observeOn(AndroidSchedulers.mainThread())
.doOnNext { pages ->
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)

View File

@ -559,6 +559,7 @@
<string name="transition_no_previous">There\'s no previous chapter</string>
<string name="transition_pages_loading">Loading pages…</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 -->
<string name="updating_library">Updating library</string>