Hide language icon for LocalSource

This commit is contained in:
Cuong-Tran 2024-08-29 01:18:48 +07:00
parent f4b8fdc59e
commit 454228e78f
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
2 changed files with 5 additions and 12 deletions

View file

@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Warning
import androidx.compose.material.icons.outlined.Folder
import androidx.compose.material.icons.outlined.Language
import androidx.compose.material.icons.outlined.LocalLibrary
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
@ -50,14 +49,8 @@ internal fun LanguageBadge(
useLangIcon: Boolean = true,
// KMK <--
) {
if (isLocal) {
Badge(
imageVector = Icons.Outlined.Language,
color = MaterialTheme.colorScheme.tertiary,
iconColor = MaterialTheme.colorScheme.onTertiary,
)
} else if (sourceLanguage.isNotEmpty()) {
// KMK -->
// KMK -->
if (!isLocal && sourceLanguage.isNotEmpty()) {
if (useLangIcon) {
val iconResId = getLanguageIconID(sourceLanguage) ?: R.drawable.globe
Badge(

View file

@ -26,7 +26,7 @@ fun Source.getNameForMangaInfo(
)
// SY <--
// KMK -->
this is StubSource -> toString()
isLocalOrStub() -> toString()
// KMK <--
// For edge cases where user disables a source they got manga of in their library.
hasOneActiveLanguages && !isInEnabledLanguages ->
@ -52,7 +52,7 @@ private fun getMergedSourcesString(
mergeSources.joinToString { source ->
when {
// KMK -->
source is StubSource -> source.toString()
source.isLocalOrStub() -> source.toString()
// KMK <--
source.lang !in enabledLangs ->
// KMK -->
@ -65,7 +65,7 @@ private fun getMergedSourcesString(
} else {
mergeSources.joinToString { source ->
// KMK -->
if (source is StubSource) {
if (source.isLocalOrStub()) {
source.toString()
} else {
"${source.name} (${FlagEmoji.getEmojiLangFlag(source.lang)})"