mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 17:11:51 +01:00
Remove source lang on migrate screen also seperate removed source on alphabetical sort (#7041)
* Remove source lang on migrate screen also seperate removed source on alphabetical sort * Review changes * Rename Variable
This commit is contained in:
parent
ccff333123
commit
6ef6eab994
@ -37,11 +37,14 @@ class GetSourcesWithFavoriteCount(
|
|||||||
val id2 = b.first.name.toLongOrNull()
|
val id2 = b.first.name.toLongOrNull()
|
||||||
when (sorting) {
|
when (sorting) {
|
||||||
SetMigrateSorting.Mode.ALPHABETICAL -> {
|
SetMigrateSorting.Mode.ALPHABETICAL -> {
|
||||||
collator.compare(a.first.name.lowercase(locale), b.first.name.lowercase(locale))
|
when {
|
||||||
|
id1 != null && id2 == null -> -1
|
||||||
|
id2 != null && id1 == null -> 1
|
||||||
|
else -> collator.compare(a.first.name.lowercase(locale), b.first.name.lowercase(locale))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SetMigrateSorting.Mode.TOTAL -> {
|
SetMigrateSorting.Mode.TOTAL -> {
|
||||||
when {
|
when {
|
||||||
id1 != null && id2 != null -> a.second.compareTo(b.second)
|
|
||||||
id1 != null && id2 == null -> -1
|
id1 != null && id2 == null -> -1
|
||||||
id2 != null && id1 == null -> 1
|
id2 != null && id1 == null -> 1
|
||||||
else -> a.second.compareTo(b.second)
|
else -> a.second.compareTo(b.second)
|
||||||
|
@ -99,6 +99,7 @@ fun MigrateSourceItem(
|
|||||||
BaseSourceItem(
|
BaseSourceItem(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
source = source,
|
source = source,
|
||||||
|
showLanguageInContent = source.lang != "",
|
||||||
onClickItem = onClickItem,
|
onClickItem = onClickItem,
|
||||||
onLongClickItem = onLongClickItem,
|
onLongClickItem = onLongClickItem,
|
||||||
action = {
|
action = {
|
||||||
|
@ -21,11 +21,12 @@ import eu.kanade.tachiyomi.util.system.LocaleHelper
|
|||||||
fun BaseSourceItem(
|
fun BaseSourceItem(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
source: Source,
|
source: Source,
|
||||||
|
showLanguageInContent: Boolean = true,
|
||||||
onClickItem: () -> Unit = {},
|
onClickItem: () -> Unit = {},
|
||||||
onLongClickItem: () -> Unit = {},
|
onLongClickItem: () -> Unit = {},
|
||||||
icon: @Composable RowScope.(Source) -> Unit = defaultIcon,
|
icon: @Composable RowScope.(Source) -> Unit = defaultIcon,
|
||||||
action: @Composable RowScope.(Source) -> Unit = {},
|
action: @Composable RowScope.(Source) -> Unit = {},
|
||||||
content: @Composable RowScope.(Source) -> Unit = defaultContent,
|
content: @Composable RowScope.(Source, Boolean) -> Unit = defaultContent,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
@ -37,7 +38,7 @@ fun BaseSourceItem(
|
|||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
icon.invoke(this, source)
|
icon.invoke(this, source)
|
||||||
content.invoke(this, source)
|
content.invoke(this, source, showLanguageInContent)
|
||||||
action.invoke(this, source)
|
action.invoke(this, source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,7 +47,7 @@ private val defaultIcon: @Composable RowScope.(Source) -> Unit = { source ->
|
|||||||
SourceIcon(source = source)
|
SourceIcon(source = source)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val defaultContent: @Composable RowScope.(Source) -> Unit = { source ->
|
private val defaultContent: @Composable RowScope.(Source, Boolean) -> Unit = { source, showLanguageInContent ->
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = horizontalPadding)
|
.padding(horizontal = horizontalPadding)
|
||||||
@ -58,6 +59,7 @@ private val defaultContent: @Composable RowScope.(Source) -> Unit = { source ->
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
style = MaterialTheme.typography.bodyMedium
|
style = MaterialTheme.typography.bodyMedium
|
||||||
)
|
)
|
||||||
|
if (showLanguageInContent) {
|
||||||
Text(
|
Text(
|
||||||
text = LocaleHelper.getDisplayName(source.lang),
|
text = LocaleHelper.getDisplayName(source.lang),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
@ -66,3 +68,4 @@ private val defaultContent: @Composable RowScope.(Source) -> Unit = { source ->
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user