Replace remaining Android-specific strings
Also renaming the helper composables so it's a bit easier to find/replace everything in forks.
This commit is contained in:
@@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.merge
|
||||
import kotlinx.coroutines.flow.onStart
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import logcat.LogPriority
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.core.util.lang.launchIO
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import tachiyomi.domain.category.interactor.GetCategories
|
||||
@@ -159,7 +159,7 @@ class DownloadManager(
|
||||
.filter { "image" in it.type.orEmpty() }
|
||||
|
||||
if (files.isEmpty()) {
|
||||
throw Exception(context.localize(MR.strings.page_list_empty_error))
|
||||
throw Exception(context.stringResource(MR.strings.page_list_empty_error))
|
||||
}
|
||||
|
||||
return files.sortedBy { it.name }
|
||||
|
||||
@@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.util.lang.chop
|
||||
import eu.kanade.tachiyomi.util.system.cancelNotification
|
||||
import eu.kanade.tachiyomi.util.system.notificationBuilder
|
||||
import eu.kanade.tachiyomi.util.system.notify
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.i18n.MR
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.regex.Pattern
|
||||
@@ -80,12 +80,12 @@ internal class DownloadNotifier(private val context: Context) {
|
||||
// Pause action
|
||||
addAction(
|
||||
R.drawable.ic_pause_24dp,
|
||||
context.localize(MR.strings.action_pause),
|
||||
context.stringResource(MR.strings.action_pause),
|
||||
NotificationReceiver.pauseDownloadsPendingBroadcast(context),
|
||||
)
|
||||
}
|
||||
|
||||
val downloadingProgressText = context.localize(
|
||||
val downloadingProgressText = context.stringResource(
|
||||
MR.strings.chapter_downloading_progress,
|
||||
download.downloadedImages,
|
||||
download.pages!!.size,
|
||||
@@ -117,8 +117,8 @@ internal class DownloadNotifier(private val context: Context) {
|
||||
*/
|
||||
fun onPaused() {
|
||||
with(progressNotificationBuilder) {
|
||||
setContentTitle(context.localize(MR.strings.chapter_paused))
|
||||
setContentText(context.localize(MR.strings.download_notifier_download_paused))
|
||||
setContentTitle(context.stringResource(MR.strings.chapter_paused))
|
||||
setContentText(context.stringResource(MR.strings.download_notifier_download_paused))
|
||||
setSmallIcon(R.drawable.ic_pause_24dp)
|
||||
setProgress(0, 0, false)
|
||||
setOngoing(false)
|
||||
@@ -128,13 +128,13 @@ internal class DownloadNotifier(private val context: Context) {
|
||||
// Resume action
|
||||
addAction(
|
||||
R.drawable.ic_play_arrow_24dp,
|
||||
context.localize(MR.strings.action_resume),
|
||||
context.stringResource(MR.strings.action_resume),
|
||||
NotificationReceiver.resumeDownloadsPendingBroadcast(context),
|
||||
)
|
||||
// Clear action
|
||||
addAction(
|
||||
R.drawable.ic_close_24dp,
|
||||
context.localize(MR.strings.action_cancel_all),
|
||||
context.stringResource(MR.strings.action_cancel_all),
|
||||
NotificationReceiver.clearDownloadsPendingBroadcast(context),
|
||||
)
|
||||
|
||||
@@ -164,7 +164,7 @@ internal class DownloadNotifier(private val context: Context) {
|
||||
*/
|
||||
fun onWarning(reason: String, timeout: Long? = null, contentIntent: PendingIntent? = null) {
|
||||
with(errorNotificationBuilder) {
|
||||
setContentTitle(context.localize(MR.strings.download_notifier_downloader_title))
|
||||
setContentTitle(context.stringResource(MR.strings.download_notifier_downloader_title))
|
||||
setStyle(NotificationCompat.BigTextStyle().bigText(reason))
|
||||
setSmallIcon(R.drawable.ic_warning_white_24dp)
|
||||
setAutoCancel(true)
|
||||
@@ -192,9 +192,9 @@ internal class DownloadNotifier(private val context: Context) {
|
||||
// Create notification
|
||||
with(errorNotificationBuilder) {
|
||||
setContentTitle(
|
||||
mangaTitle?.plus(": $chapter") ?: context.localize(MR.strings.download_notifier_downloader_title),
|
||||
mangaTitle?.plus(": $chapter") ?: context.stringResource(MR.strings.download_notifier_downloader_title),
|
||||
)
|
||||
setContentText(error ?: context.localize(MR.strings.download_notifier_unknown_error))
|
||||
setContentText(error ?: context.stringResource(MR.strings.download_notifier_unknown_error))
|
||||
setSmallIcon(R.drawable.ic_warning_white_24dp)
|
||||
clearActions()
|
||||
setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context))
|
||||
|
||||
@@ -9,7 +9,7 @@ import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import logcat.LogPriority
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
import tachiyomi.domain.download.service.DownloadPreferences
|
||||
@@ -59,7 +59,7 @@ class DownloadProvider(
|
||||
.createDirectory(getMangaDirName(mangaTitle))
|
||||
} catch (e: Throwable) {
|
||||
logcat(LogPriority.ERROR, e) { "Invalid download directory" }
|
||||
throw Exception(context.localize(MR.strings.invalid_location, downloadsDir))
|
||||
throw Exception(context.stringResource(MR.strings.invalid_location, downloadsDir))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import logcat.LogPriority
|
||||
import ru.beryukhov.reactivenetwork.ReactiveNetwork
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.core.util.lang.withUIContext
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import tachiyomi.domain.download.service.DownloadPreferences
|
||||
@@ -113,7 +113,7 @@ class DownloadService : Service() {
|
||||
}
|
||||
|
||||
private fun downloaderStop(string: StringResource) {
|
||||
downloadManager.downloaderStop(localize(string))
|
||||
downloadManager.downloaderStop(stringResource(string))
|
||||
}
|
||||
|
||||
private fun listenNetworkChanges() {
|
||||
@@ -145,7 +145,7 @@ class DownloadService : Service() {
|
||||
|
||||
private fun getPlaceholderNotification(): Notification {
|
||||
return notificationBuilder(Notifications.CHANNEL_DOWNLOADER_PROGRESS) {
|
||||
setContentTitle(localize(MR.strings.download_notifier_downloader_title))
|
||||
setContentTitle(stringResource(MR.strings.download_notifier_downloader_title))
|
||||
}.build()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ import kotlinx.coroutines.supervisorScope
|
||||
import logcat.LogPriority
|
||||
import nl.adaptivity.xmlutil.serialization.XML
|
||||
import okhttp3.Response
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.core.metadata.comicinfo.COMIC_INFO_FILE
|
||||
import tachiyomi.core.metadata.comicinfo.ComicInfo
|
||||
import tachiyomi.core.util.lang.launchIO
|
||||
@@ -303,7 +303,7 @@ class Downloader(
|
||||
) {
|
||||
withUIContext {
|
||||
notifier.onWarning(
|
||||
context.localize(MR.strings.download_queue_size_warning),
|
||||
context.stringResource(MR.strings.download_queue_size_warning),
|
||||
WARNING_NOTIF_TIMEOUT_MS,
|
||||
NotificationHandler.openUrl(context, LibraryUpdateNotifier.HELP_WARNING_URL),
|
||||
)
|
||||
@@ -326,7 +326,7 @@ class Downloader(
|
||||
if (availSpace != -1L && availSpace < MIN_DISK_SPACE) {
|
||||
download.status = Download.State.ERROR
|
||||
notifier.onError(
|
||||
context.localize(MR.strings.download_insufficient_space),
|
||||
context.stringResource(MR.strings.download_insufficient_space),
|
||||
download.chapter.name,
|
||||
download.manga.title,
|
||||
)
|
||||
@@ -343,7 +343,7 @@ class Downloader(
|
||||
val pages = download.source.getPageList(download.chapter.toSChapter())
|
||||
|
||||
if (pages.isEmpty()) {
|
||||
throw Exception(context.localize(MR.strings.page_list_empty_error))
|
||||
throw Exception(context.stringResource(MR.strings.page_list_empty_error))
|
||||
}
|
||||
// Don't trust index from source
|
||||
val reIndexedPages = pages.mapIndexed { index, page -> Page(index, page.url, page.imageUrl, page.uri) }
|
||||
@@ -547,7 +547,7 @@ class Downloader(
|
||||
try {
|
||||
val filenamePrefix = String.format("%03d", page.number)
|
||||
val imageFile = tmpDir.listFiles()?.firstOrNull { it.name.orEmpty().startsWith(filenamePrefix) }
|
||||
?: error(context.localize(MR.strings.download_notifier_split_page_not_found, page.number))
|
||||
?: error(context.stringResource(MR.strings.download_notifier_split_page_not_found, page.number))
|
||||
|
||||
// If the original page was previously split, then skip
|
||||
if (imageFile.name.orEmpty().startsWith("${filenamePrefix}__")) return
|
||||
|
||||
Reference in New Issue
Block a user