diff --git a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt index b206bc9487..a2406a21be 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchAdapter.kt @@ -489,7 +489,7 @@ class AnimeWatchAdapter( val adapter = ArrayAdapter( fragment.requireContext(), R.layout.item_dropdown, - parser.extension.sources.map { LanguageMapper.getLanguageCode(it.lang) } + parser.extension.sources.map { LanguageMapper.getLanguageName(it.lang) } ) val items = adapter.count diff --git a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt index eb4d0b7472..4c155b48bf 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/AnimeWatchFragment.kt @@ -371,7 +371,7 @@ class AnimeWatchFragment : Fragment() { var selectedSetting = allSettings[0] if (allSettings.size > 1) { val names = - allSettings.map { LanguageMapper.getLanguageCode(it.lang) }.toTypedArray() + allSettings.map { LanguageMapper.getLanguageName(it.lang) }.toTypedArray() val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup) .setTitle("Select a Source") .setSingleChoiceItems(names, -1) { dialog, which -> diff --git a/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt b/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt index a44fecc18c..177d36845c 100644 --- a/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt +++ b/app/src/main/java/ani/dantotsu/media/manga/MangaReadAdapter.kt @@ -548,7 +548,7 @@ class MangaReadAdapter( val adapter = ArrayAdapter( fragment.requireContext(), R.layout.item_dropdown, - parser.extension.sources.map { LanguageMapper.getLanguageCode(it.lang) } + parser.extension.sources.map { LanguageMapper.getLanguageName(it.lang) } ) val items = adapter.count binding?.animeSourceLanguageContainer?.isVisible = items > 1 diff --git a/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt b/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt index 5ea50279ae..bce5f31283 100644 --- a/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt +++ b/app/src/main/java/ani/dantotsu/media/manga/MangaReadFragment.kt @@ -385,7 +385,7 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener { var selectedSetting = allSettings[0] if (allSettings.size > 1) { val names = - allSettings.map { LanguageMapper.getLanguageCode(it.lang) }.toTypedArray() + allSettings.map { LanguageMapper.getLanguageName(it.lang) }.toTypedArray() val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup) .setTitle("Select a Source") .setSingleChoiceItems(names, -1) { dialog, which -> diff --git a/app/src/main/java/ani/dantotsu/others/LanguageMapper.kt b/app/src/main/java/ani/dantotsu/others/LanguageMapper.kt index a1fc9fa14b..b12cc63377 100644 --- a/app/src/main/java/ani/dantotsu/others/LanguageMapper.kt +++ b/app/src/main/java/ani/dantotsu/others/LanguageMapper.kt @@ -119,7 +119,7 @@ class LanguageMapper { "zu" to "Zulu" ) - fun getLanguage(code: String): String { + fun getLanguageName(code: String): String { return if (code.contains("-")) { try { val parts = code.split("-") @@ -129,6 +129,9 @@ class LanguageMapper { } } else { try { + if (code == "all") { + return codeMap[code] ?: code + } Locale(code).displayName } catch (ignored: Exception) { code @@ -137,7 +140,8 @@ class LanguageMapper { } fun getLanguageCode(language: String): String { - return codeMap.filterValues { it.lowercase() == language.lowercase() }.keys.firstOrNull() ?: "all" + return codeMap.filterValues { it.lowercase() == language.lowercase() }.keys.firstOrNull() + ?: "all" } enum class Language(val code: String) { diff --git a/app/src/main/java/ani/dantotsu/settings/InstalledAnimeExtensionsFragment.kt b/app/src/main/java/ani/dantotsu/settings/InstalledAnimeExtensionsFragment.kt index a0ab20ad2b..2e6d650cac 100644 --- a/app/src/main/java/ani/dantotsu/settings/InstalledAnimeExtensionsFragment.kt +++ b/app/src/main/java/ani/dantotsu/settings/InstalledAnimeExtensionsFragment.kt @@ -72,7 +72,7 @@ class InstalledAnimeExtensionsFragment : Fragment(), SearchQueryHandler { if (allSettings.isNotEmpty()) { var selectedSetting = allSettings[0] if (allSettings.size > 1) { - val names = allSettings.map { LanguageMapper.getLanguageCode(it.lang) } + val names = allSettings.map { LanguageMapper.getLanguageName(it.lang) } .toTypedArray() var selectedIndex = 0 val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup) @@ -295,7 +295,7 @@ class InstalledAnimeExtensionsFragment : Fragment(), SearchQueryHandler { override fun onBindViewHolder(holder: ViewHolder, position: Int) { val extension = getItem(position) val nsfw = if (extension.isNsfw) "(18+)" else "" - val lang = LanguageMapper.getLanguageCode(extension.lang) + val lang = LanguageMapper.getLanguageName(extension.lang) holder.extensionNameTextView.text = extension.name val versionText = "$lang ${extension.versionName} $nsfw" holder.extensionVersionTextView.text = versionText diff --git a/app/src/main/java/ani/dantotsu/settings/InstalledMangaExtensionsFragment.kt b/app/src/main/java/ani/dantotsu/settings/InstalledMangaExtensionsFragment.kt index b4a00ea940..0a66c64886 100644 --- a/app/src/main/java/ani/dantotsu/settings/InstalledMangaExtensionsFragment.kt +++ b/app/src/main/java/ani/dantotsu/settings/InstalledMangaExtensionsFragment.kt @@ -71,7 +71,7 @@ class InstalledMangaExtensionsFragment : Fragment(), SearchQueryHandler { if (allSettings.isNotEmpty()) { var selectedSetting = allSettings[0] if (allSettings.size > 1) { - val names = allSettings.map { LanguageMapper.getLanguageCode(it.lang) } + val names = allSettings.map { LanguageMapper.getLanguageName(it.lang) } .toTypedArray() var selectedIndex = 0 val dialog = AlertDialog.Builder(requireContext(), R.style.MyPopup) @@ -293,7 +293,7 @@ class InstalledMangaExtensionsFragment : Fragment(), SearchQueryHandler { override fun onBindViewHolder(holder: ViewHolder, position: Int) { val extension = getItem(position) // Use getItem() from ListAdapter val nsfw = if (extension.isNsfw) "(18+)" else "" - val lang = LanguageMapper.getLanguageCode(extension.lang) + val lang = LanguageMapper.getLanguageName(extension.lang) holder.extensionNameTextView.text = extension.name val versionText = "$lang ${extension.versionName} $nsfw" holder.extensionVersionTextView.text = versionText diff --git a/app/src/main/java/ani/dantotsu/settings/InstalledNovelExtensionsFragment.kt b/app/src/main/java/ani/dantotsu/settings/InstalledNovelExtensionsFragment.kt index 66a2ffdb42..298924b6b7 100644 --- a/app/src/main/java/ani/dantotsu/settings/InstalledNovelExtensionsFragment.kt +++ b/app/src/main/java/ani/dantotsu/settings/InstalledNovelExtensionsFragment.kt @@ -222,7 +222,7 @@ class InstalledNovelExtensionsFragment : Fragment(), SearchQueryHandler { override fun onBindViewHolder(holder: ViewHolder, position: Int) { val extension = getItem(position) // Use getItem() from ListAdapter val nsfw = "" - val lang = LanguageMapper.getLanguageCode("all") + val lang = LanguageMapper.getLanguageName("all") holder.extensionNameTextView.text = extension.name val versionText = "$lang ${extension.versionName} $nsfw" holder.extensionVersionTextView.text = versionText diff --git a/app/src/main/java/ani/dantotsu/settings/paging/AnimePagingSource.kt b/app/src/main/java/ani/dantotsu/settings/paging/AnimePagingSource.kt index 19306c3cfa..447a43a7c1 100644 --- a/app/src/main/java/ani/dantotsu/settings/paging/AnimePagingSource.kt +++ b/app/src/main/java/ani/dantotsu/settings/paging/AnimePagingSource.kt @@ -203,7 +203,7 @@ class AnimeExtensionAdapter(private val clickListener: OnAnimeInstallClickListen fun bind(extension: AnimeExtension.Available) { val nsfw = if (extension.isNsfw) "(18+)" else "" - val lang = LanguageMapper.getLanguageCode(extension.lang) + val lang = LanguageMapper.getLanguageName(extension.lang) binding.extensionNameTextView.text = extension.name val versionText = "$lang ${extension.versionName} $nsfw" binding.extensionVersionTextView.text = versionText diff --git a/app/src/main/java/ani/dantotsu/settings/paging/MangaPagingSource.kt b/app/src/main/java/ani/dantotsu/settings/paging/MangaPagingSource.kt index 7af9caa269..492f2eb337 100644 --- a/app/src/main/java/ani/dantotsu/settings/paging/MangaPagingSource.kt +++ b/app/src/main/java/ani/dantotsu/settings/paging/MangaPagingSource.kt @@ -201,7 +201,7 @@ class MangaExtensionAdapter(private val clickListener: OnMangaInstallClickListen fun bind(extension: MangaExtension.Available) { val nsfw = if (extension.isNsfw) "(18+)" else "" - val lang = LanguageMapper.getLanguageCode(extension.lang) + val lang = LanguageMapper.getLanguageName(extension.lang) binding.extensionNameTextView.text = extension.name val versionText = "$lang ${extension.versionName} $nsfw" binding.extensionVersionTextView.text = versionText diff --git a/app/src/main/java/ani/dantotsu/settings/paging/NovelPagingSource.kt b/app/src/main/java/ani/dantotsu/settings/paging/NovelPagingSource.kt index 9875b820cc..a469256ae5 100644 --- a/app/src/main/java/ani/dantotsu/settings/paging/NovelPagingSource.kt +++ b/app/src/main/java/ani/dantotsu/settings/paging/NovelPagingSource.kt @@ -202,7 +202,7 @@ class NovelExtensionAdapter(private val clickListener: OnNovelInstallClickListen val extensionIconImageView: ImageView = binding.extensionIconImageView fun bind(extension: NovelExtension.Available) { val nsfw = "" - val lang = LanguageMapper.getLanguageCode("all") + val lang = LanguageMapper.getLanguageName("all") binding.extensionNameTextView.text = extension.name binding.extensionVersionTextView.text = "$lang ${extension.versionName} $nsfw" }