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:
@@ -84,7 +84,7 @@ import kotlinx.coroutines.flow.sample
|
||||
import kotlinx.coroutines.launch
|
||||
import logcat.LogPriority
|
||||
import tachiyomi.core.Constants
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.core.util.lang.launchIO
|
||||
import tachiyomi.core.util.lang.launchNonCancellable
|
||||
import tachiyomi.core.util.lang.withUIContext
|
||||
@@ -400,7 +400,7 @@ class ReaderActivity : BaseActivity() {
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
CircularProgressIndicator()
|
||||
Text(localize(MR.strings.loading))
|
||||
Text(stringResource(MR.strings.loading))
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -537,7 +537,7 @@ class ReaderActivity : BaseActivity() {
|
||||
private fun shareChapter() {
|
||||
assistUrl?.let {
|
||||
val intent = it.toUri().toShareIntent(this, type = "text/plain")
|
||||
startActivity(Intent.createChooser(intent, localize(MR.strings.action_share)))
|
||||
startActivity(Intent.createChooser(intent, stringResource(MR.strings.action_share)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,9 +684,9 @@ class ReaderActivity : BaseActivity() {
|
||||
|
||||
val intent = uri.toShareIntent(
|
||||
context = applicationContext,
|
||||
message = localize(MR.strings.share_page_info, manga.title, chapter.name, page.number),
|
||||
message = stringResource(MR.strings.share_page_info, manga.title, chapter.name, page.number),
|
||||
)
|
||||
startActivity(Intent.createChooser(intent, localize(MR.strings.action_share)))
|
||||
startActivity(Intent.createChooser(intent, stringResource(MR.strings.action_share)))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ import androidx.core.graphics.withTranslation
|
||||
import androidx.core.view.isVisible
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.ViewerNavigation
|
||||
import eu.kanade.tachiyomi.ui.reader.viewer.navigation.DisabledNavigation
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import kotlin.math.abs
|
||||
|
||||
class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet) : View(context, attributeSet) {
|
||||
@@ -80,8 +80,8 @@ class ReaderNavigationOverlayView(context: Context, attributeSet: AttributeSet)
|
||||
// Calculate center of rect height on screen
|
||||
val y = height * (abs(rect.top - rect.bottom) / 2)
|
||||
|
||||
drawText(context.localize(region.type.nameRes), x, y, textBorderPaint)
|
||||
drawText(context.localize(region.type.nameRes), x, y, textPaint)
|
||||
drawText(context.stringResource(region.type.nameRes), x, y, textBorderPaint)
|
||||
drawText(context.stringResource(region.type.nameRes), x, y, textPaint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.util.system.cancelNotification
|
||||
import eu.kanade.tachiyomi.util.system.getBitmapOrNull
|
||||
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
|
||||
|
||||
/**
|
||||
@@ -58,8 +58,8 @@ class SaveImageNotifier(private val context: Context) {
|
||||
fun onError(error: String?) {
|
||||
// Create notification
|
||||
with(notificationBuilder) {
|
||||
setContentTitle(context.localize(MR.strings.download_notifier_title_error))
|
||||
setContentText(error ?: context.localize(MR.strings.unknown_error))
|
||||
setContentTitle(context.stringResource(MR.strings.download_notifier_title_error))
|
||||
setContentText(error ?: context.stringResource(MR.strings.unknown_error))
|
||||
setSmallIcon(android.R.drawable.ic_menu_report_image)
|
||||
}
|
||||
updateNotification()
|
||||
@@ -67,7 +67,7 @@ class SaveImageNotifier(private val context: Context) {
|
||||
|
||||
private fun showCompleteNotification(uri: Uri, image: Bitmap?) {
|
||||
with(notificationBuilder) {
|
||||
setContentTitle(context.localize(MR.strings.picture_saved))
|
||||
setContentTitle(context.stringResource(MR.strings.picture_saved))
|
||||
setSmallIcon(R.drawable.ic_photo_24dp)
|
||||
image?.let { setStyle(NotificationCompat.BigPictureStyle().bigPicture(it)) }
|
||||
setLargeIcon(image)
|
||||
@@ -80,13 +80,13 @@ class SaveImageNotifier(private val context: Context) {
|
||||
// Share action
|
||||
addAction(
|
||||
R.drawable.ic_share_24dp,
|
||||
context.localize(MR.strings.action_share),
|
||||
context.stringResource(MR.strings.action_share),
|
||||
NotificationReceiver.shareImagePendingBroadcast(context, uri.path!!, notificationId),
|
||||
)
|
||||
// Delete action
|
||||
addAction(
|
||||
R.drawable.ic_delete_24dp,
|
||||
context.localize(MR.strings.action_delete),
|
||||
context.stringResource(MR.strings.action_delete),
|
||||
NotificationReceiver.deleteImagePendingBroadcast(context, uri.path!!, notificationId),
|
||||
)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import eu.kanade.tachiyomi.data.download.DownloadProvider
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.core.util.lang.withIOContext
|
||||
import tachiyomi.core.util.system.logcat
|
||||
import tachiyomi.domain.manga.model.Manga
|
||||
@@ -47,7 +47,7 @@ class ChapterLoader(
|
||||
.onEach { it.chapter = chapter }
|
||||
|
||||
if (pages.isEmpty()) {
|
||||
throw Exception(context.localize(MR.strings.page_list_empty_error))
|
||||
throw Exception(context.stringResource(MR.strings.page_list_empty_error))
|
||||
}
|
||||
|
||||
// If the chapter is partially read, set the starting page to the last the user read
|
||||
@@ -92,14 +92,14 @@ class ChapterLoader(
|
||||
is Format.Rar -> try {
|
||||
RarPageLoader(format.file)
|
||||
} catch (e: UnsupportedRarV5Exception) {
|
||||
error(context.localize(MR.strings.loader_rar5_error))
|
||||
error(context.stringResource(MR.strings.loader_rar5_error))
|
||||
}
|
||||
is Format.Epub -> EpubPageLoader(format.file)
|
||||
}
|
||||
}
|
||||
source is HttpSource -> HttpPageLoader(chapter, source)
|
||||
source is StubSource -> error(context.localize(MR.strings.source_not_installed, source.toString()))
|
||||
else -> error(context.localize(MR.strings.loader_not_implemented_error))
|
||||
source is StubSource -> error(context.stringResource(MR.strings.source_not_installed, source.toString()))
|
||||
else -> error(context.stringResource(MR.strings.loader_not_implemented_error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -20,7 +20,7 @@ import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.i18n.MR
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,7 @@ class PagerTransitionHolder(
|
||||
|
||||
val textView = AppCompatTextView(context).apply {
|
||||
wrapContent()
|
||||
text = context.localize(MR.strings.transition_pages_loading)
|
||||
text = context.stringResource(MR.strings.transition_pages_loading)
|
||||
}
|
||||
|
||||
pagesContainer.addView(progress)
|
||||
@@ -118,13 +118,13 @@ class PagerTransitionHolder(
|
||||
private fun setError(error: Throwable) {
|
||||
val textView = AppCompatTextView(context).apply {
|
||||
wrapContent()
|
||||
text = context.localize(MR.strings.transition_pages_error, error.message ?: "")
|
||||
text = context.stringResource(MR.strings.transition_pages_error, error.message ?: "")
|
||||
}
|
||||
|
||||
val retryBtn = ReaderButton(context).apply {
|
||||
viewer = this@PagerTransitionHolder.viewer
|
||||
wrapContent()
|
||||
text = context.localize(MR.strings.action_retry)
|
||||
text = context.stringResource(MR.strings.action_retry)
|
||||
setOnClickListener {
|
||||
val toChapter = transition.to
|
||||
if (toChapter != null) {
|
||||
|
||||
+4
-4
@@ -17,7 +17,7 @@ import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import tachiyomi.core.i18n.localize
|
||||
import tachiyomi.core.i18n.stringResource
|
||||
import tachiyomi.i18n.MR
|
||||
|
||||
/**
|
||||
@@ -107,7 +107,7 @@ class WebtoonTransitionHolder(
|
||||
|
||||
val textView = AppCompatTextView(context).apply {
|
||||
wrapContent()
|
||||
text = context.localize(MR.strings.transition_pages_loading)
|
||||
text = context.stringResource(MR.strings.transition_pages_loading)
|
||||
}
|
||||
|
||||
pagesContainer.addView(progress)
|
||||
@@ -120,12 +120,12 @@ class WebtoonTransitionHolder(
|
||||
private fun setError(error: Throwable, transition: ChapterTransition) {
|
||||
val textView = AppCompatTextView(context).apply {
|
||||
wrapContent()
|
||||
text = context.localize(MR.strings.transition_pages_error, error.message ?: "")
|
||||
text = context.stringResource(MR.strings.transition_pages_error, error.message ?: "")
|
||||
}
|
||||
|
||||
val retryBtn = AppCompatButton(context).apply {
|
||||
wrapContent()
|
||||
text = context.localize(MR.strings.action_retry)
|
||||
text = context.stringResource(MR.strings.action_retry)
|
||||
setOnClickListener {
|
||||
val toChapter = transition.to
|
||||
if (toChapter != null) {
|
||||
|
||||
Reference in New Issue
Block a user