chore: resolve manga SetTextI18n

This commit is contained in:
TwistedUmbrellaX
2024-03-20 16:46:35 -04:00
parent 9f0bba2137
commit 01cde82316
8 changed files with 17 additions and 18 deletions

View File

@@ -1013,6 +1013,10 @@ fun toast(string: String?) {
}
}
fun toast(res: Int) {
toast(getAppString(res))
}
fun snackString(s: String?, activity: Activity? = null, clipboard: String? = null): Snackbar? {
try { //I have no idea why this sometimes crashes for some people...
if (s != null) {

View File

@@ -253,7 +253,7 @@ class AnimeWatchAdapter(
}
dialogBinding.animeWebviewContainer.setOnClickListener {
if (!WebViewUtil.supportsWebView(fragment.requireContext())) {
toast("WebView not installed")
toast(R.string.webview_not_installed)
}
//start CookieCatcher activity
if (watchSources.names.isNotEmpty() && source in 0 until watchSources.names.size) {

View File

@@ -262,7 +262,6 @@ class MangaChapterAdapter(
}
}
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) {
is ChapterCompactViewHolder -> {

View File

@@ -58,7 +58,6 @@ class MangaReadAdapter(
private var nestedDialog: AlertDialog? = null
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val binding = holder.binding
_binding = binding
@@ -188,8 +187,8 @@ class MangaReadAdapter(
else -> dialogBinding.animeSourceList
}
when (style) {
0 -> dialogBinding.layoutText.text = "List"
1 -> dialogBinding.layoutText.text = "Compact"
0 -> dialogBinding.layoutText.setText(R.string.list)
1 -> dialogBinding.layoutText.setText(R.string.compact)
else -> dialogBinding.animeSourceList
}
selected.alpha = 1f
@@ -201,18 +200,18 @@ class MangaReadAdapter(
dialogBinding.animeSourceList.setOnClickListener {
selected(it as ImageButton)
style = 0
dialogBinding.layoutText.text = "List"
dialogBinding.layoutText.setText(R.string.list)
run = true
}
dialogBinding.animeSourceCompact.setOnClickListener {
selected(it as ImageButton)
style = 1
dialogBinding.layoutText.text = "Compact"
dialogBinding.layoutText.setText(R.string.compact)
run = true
}
dialogBinding.animeWebviewContainer.setOnClickListener {
if (!WebViewUtil.supportsWebView(fragment.requireContext())) {
toast("WebView not installed")
toast(R.string.webview_not_installed)
}
//start CookieCatcher activity
if (mangaReadSources.names.isNotEmpty() && source in 0 until mangaReadSources.names.size) {
@@ -359,7 +358,6 @@ class MangaReadAdapter(
}
//Chips
@SuppressLint("SetTextI18n")
fun updateChips(limit: Int, names: Array<String>, arr: Array<Int>, selected: Int = 0) {
val binding = _binding
if (binding != null) {
@@ -395,7 +393,8 @@ class MangaReadAdapter(
names[last - 1]
}
//chip.text = "${names[limit * (position)]} - ${names[last - 1]}"
chip.text = "$startChapterString - $endChapterString"
val chipText = "$startChapterString - $endChapterString"
chip.text = chipText
chip.setTextColor(
ContextCompat.getColorStateList(
fragment.requireContext(),
@@ -429,7 +428,6 @@ class MangaReadAdapter(
_binding?.animeSourceChipGroup?.removeAllViews()
}
@SuppressLint("SetTextI18n")
fun handleChapters() {
val binding = _binding
@@ -466,7 +464,7 @@ class MangaReadAdapter(
val ep = media.manga.chapters!![continueEp]!!
binding.itemEpisodeImage.loadImage(media.banner ?: media.cover)
binding.animeSourceContinueText.text =
currActivity()!!.getString(R.string.continue_chapter) + "${ep.number}${if (!ep.title.isNullOrEmpty()) "\n${ep.title}" else ""}"
currActivity()!!.getString(R.string.continue_chapter, ep.number, if (!ep.title.isNullOrEmpty()) ep.title else "")
binding.animeSourceContinue.setOnClickListener {
fragment.onMangaChapterClick(continueEp)
}

View File

@@ -69,7 +69,6 @@ import java.util.*
import kotlin.math.min
import kotlin.properties.Delegates
@SuppressLint("SetTextI18n")
class MangaReaderActivity : AppCompatActivity() {
private val mangaCache = Injekt.get<MangaCache>()

View File

@@ -31,7 +31,6 @@ class UrlAdapter(
)
}
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: UrlViewHolder, position: Int) {
val binding = holder.binding
val url = urls[position]

View File

@@ -33,7 +33,6 @@ class ListActivity : AppCompatActivity() {
private val scope = lifecycleScope
private var selectedTabIdx = 0
@SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -83,8 +82,8 @@ class ListActivity : AppCompatActivity() {
setContentView(binding.root)
val anime = intent.getBooleanExtra("anime", true)
binding.listTitle.text =
intent.getStringExtra("username") + "'s " + (if (anime) "Anime" else "Manga") + " List"
binding.listTitle.text = getString(R.string.user_list, intent.getStringExtra("username"),
if (anime) getString(R.string.anime) else getString(R.string.manga))
binding.listTabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) {
this@ListActivity.selectedTabIdx = tab?.position ?: 0

View File

@@ -493,13 +493,14 @@
<string name="view_profile_in_dantotsu">View Profile in Dantotsu</string>
<string name="continue_episode">Continue : Episode %1$s%2$s\n%3$s</string>
<string name="filler_tag"> - Filler</string>
<string name="continue_chapter">Continue : </string>
<string name="continue_chapter">Continue : %1$s\n%2$s</string>
<string name="episode">"Episode "</string>
<string name="episode_num">"Episode %1$s"</string>
<string name="chapter">"Chapter "</string>
<string name="chapter_num">"Chapter %1$s"</string>
<string name="just_released">- just got released!</string>
<string name="checking_subscriptions_title">Checking Subscriptions</string>
<string name="user_list">%1$s\'s %2$s List</string>
<string name="speed">Speed</string>
<string name="auto_update">Auto Update progress for %1$s?</string>