detekt: cleanup code

# Conflicts:
#	app/src/main/java/eu/kanade/presentation/browse/FeedScreen.kt
This commit is contained in:
Cuong Tran 2024-03-10 16:41:29 +07:00
parent 3ea1738838
commit 8888bfec9d
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
3 changed files with 27 additions and 15 deletions

View file

@ -211,10 +211,11 @@ fun FeedAddSearchDialog(
val savedSearchStrings = remember {
savedSearches.map {
// KMK -->
it?.name ?: if (source.supportsLatest)
it?.name ?: if (source.supportsLatest) {
context.stringResource(MR.strings.latest)
else
} else {
context.stringResource(MR.strings.popular)
}
// KMK <--
}.toImmutableList()
}
@ -228,7 +229,12 @@ fun FeedAddSearchDialog(
},
onDismissRequest = onDismiss,
confirmButton = {
TextButton(onClick = { onClickAdd(source, selected?.let { savedSearches[it] }) }, /* KMK --> */ enabled = selected != null /* KMK <-- */) {
TextButton(
onClick = { onClickAdd(source, selected?.let { savedSearches[it] }) },
// KMK -->
enabled = selected != null,
// KMK <--
) {
Text(text = stringResource(MR.strings.action_ok))
}
},
@ -240,7 +246,7 @@ fun <T> RadioSelector(
options: ImmutableList<T>,
selected: Int?,
optionStrings: ImmutableList<String> = remember { options.map { it.toString() }.toImmutableList() },
onSelectOption: (Int) -> Unit/* KMK --> */ = {},/* KMK <-- */
onSelectOption: (Int) -> Unit /* KMK --> */ = {} /* KMK <-- */,
) {
Column(Modifier.verticalScroll(rememberScrollState())) {
optionStrings.forEachIndexed { index, option ->

View file

@ -21,8 +21,8 @@ import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SourceFilter
import eu.kanade.tachiyomi.util.system.LocaleHelper
import kotlinx.collections.immutable.ImmutableMap
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.source.model.Source as DomainSource
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.domain.source.model.Source as DomainSource
@Composable
fun GlobalSearchScreen(
@ -109,20 +109,25 @@ internal fun GlobalSearchContent(
// KMK -->
val domainSource = DomainSource(
source.id,
"", "",
"",
"",
supportsLatest = false,
isStub = false
)
// KMK <--
GlobalSearchResultItem(
title = (fromSourceId?.let {
"${source.name}".takeIf { source.id == fromSourceId }
} ?: source.name) +
title = (
fromSourceId?.let {
"${source.name}".takeIf { source.id == fromSourceId }
} ?: source.name
) +
// KMK -->
(domainSource.installedExtension?.let { extension ->
" (${extension.name})".takeIf { extension.name != source.name }
} ?: ""),
(
domainSource.installedExtension?.let { extension ->
" (${extension.name})".takeIf { extension.name != source.name }
} ?: ""
),
// KMK <--
subtitle = LocaleHelper.getLocalizedDisplayName(source.lang),
onClick = { onClickSource(source) },

View file

@ -110,10 +110,11 @@ fun Screen.feedTab(
BrowseSourceScreen(
source.id,
// KMK -->
listingQuery = if (!source.supportsLatest)
listingQuery = if (!source.supportsLatest) {
GetRemoteManga.QUERY_POPULAR
else
GetRemoteManga.QUERY_LATEST,
} else {
GetRemoteManga.QUERY_LATEST
},
// KMK <--
),
)