detekt: cleanup code
This commit is contained in:
parent
58797677ae
commit
9e8b9f84fd
4 changed files with 28 additions and 19 deletions
|
|
@ -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,10 @@ 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] }) },
|
||||
enabled = selected != null,
|
||||
) {
|
||||
Text(text = stringResource(MR.strings.action_ok))
|
||||
}
|
||||
},
|
||||
|
|
@ -240,7 +244,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 = {},
|
||||
) {
|
||||
Column(Modifier.verticalScroll(rememberScrollState())) {
|
||||
optionStrings.forEachIndexed { index, option ->
|
||||
|
|
|
|||
|
|
@ -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) },
|
||||
|
|
|
|||
|
|
@ -17,14 +17,13 @@ import tachiyomi.i18n.MR
|
|||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
import tachiyomi.source.local.LocalSource
|
||||
|
||||
// KMK -->
|
||||
@Composable
|
||||
fun SourceSettingsButton(
|
||||
id: Long,
|
||||
@Suppress("UNUSED_PARAMETER") modifier: Modifier = Modifier
|
||||
) {
|
||||
// Create a fake source
|
||||
val source = Source(id,"", "", supportsLatest = false, isStub = false)
|
||||
val source = Source(id, "", "", supportsLatest = false, isStub = false)
|
||||
SourceSettingsButton(source = source)
|
||||
}
|
||||
|
||||
|
|
@ -38,8 +37,9 @@ fun SourceSettingsButton(
|
|||
|
||||
val navigator = LocalNavigator.currentOrThrow
|
||||
IconButton(onClick = {
|
||||
if (source.installedExtension !== null)
|
||||
if (source.installedExtension !== null) {
|
||||
navigator.push(ExtensionDetailsScreen(source.installedExtension!!.pkgName))
|
||||
}
|
||||
}) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Settings,
|
||||
|
|
@ -47,4 +47,3 @@ fun SourceSettingsButton(
|
|||
)
|
||||
}
|
||||
}
|
||||
// KMK <--
|
||||
|
|
|
|||
|
|
@ -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 <--
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue