mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 19:11:50 +01:00
Make stub source icon part of SourceIcon
(#7337)
* Make stub source icon part of `SourceIcon` * Review Changes
This commit is contained in:
parent
9f66c85281
commit
82879a129e
@ -1,6 +1,5 @@
|
|||||||
package eu.kanade.presentation.browse
|
package eu.kanade.presentation.browse
|
||||||
|
|
||||||
import androidx.compose.foundation.Image
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@ -16,10 +15,8 @@ import androidx.compose.runtime.collectAsState
|
|||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.ColorFilter
|
|
||||||
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.res.painterResource
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@ -117,17 +114,7 @@ fun MigrateSourceItem(
|
|||||||
showLanguageInContent = source.lang != "",
|
showLanguageInContent = source.lang != "",
|
||||||
onClickItem = onClickItem,
|
onClickItem = onClickItem,
|
||||||
onLongClickItem = onLongClickItem,
|
onLongClickItem = onLongClickItem,
|
||||||
icon = {
|
icon = { SourceIcon(source = source) },
|
||||||
if (source.isStub) {
|
|
||||||
Image(
|
|
||||||
painter = painterResource(R.drawable.ic_warning_white_24dp),
|
|
||||||
contentDescription = "",
|
|
||||||
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.error),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
SourceIcon(source = source)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
action = { ItemBadges(primaryText = "$count") },
|
action = { ItemBadges(primaryText = "$count") },
|
||||||
content = { source, showLanguageInContent ->
|
content = { source, showLanguageInContent ->
|
||||||
Column(
|
Column(
|
||||||
|
@ -7,6 +7,9 @@ import androidx.compose.foundation.layout.Box
|
|||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Warning
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@ -14,6 +17,7 @@ import androidx.compose.runtime.produceState
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
import androidx.compose.ui.graphics.ImageBitmap
|
import androidx.compose.ui.graphics.ImageBitmap
|
||||||
import androidx.compose.ui.graphics.asImageBitmap
|
import androidx.compose.ui.graphics.asImageBitmap
|
||||||
import androidx.compose.ui.graphics.painter.ColorPainter
|
import androidx.compose.ui.graphics.painter.ColorPainter
|
||||||
@ -40,19 +44,30 @@ fun SourceIcon(
|
|||||||
) {
|
) {
|
||||||
val icon = source.icon
|
val icon = source.icon
|
||||||
|
|
||||||
if (icon != null) {
|
when {
|
||||||
|
source.isStub && icon == null -> {
|
||||||
|
Image(
|
||||||
|
imageVector = Icons.Default.Warning,
|
||||||
|
contentDescription = "",
|
||||||
|
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.error),
|
||||||
|
modifier = modifier.then(defaultModifier),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
icon != null -> {
|
||||||
Image(
|
Image(
|
||||||
bitmap = icon,
|
bitmap = icon,
|
||||||
contentDescription = "",
|
contentDescription = "",
|
||||||
modifier = modifier.then(defaultModifier),
|
modifier = modifier.then(defaultModifier),
|
||||||
)
|
)
|
||||||
} else {
|
}
|
||||||
|
else -> {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(id = R.mipmap.ic_local_source),
|
painter = painterResource(id = R.mipmap.ic_local_source),
|
||||||
contentDescription = "",
|
contentDescription = "",
|
||||||
modifier = modifier.then(defaultModifier),
|
modifier = modifier.then(defaultModifier),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
Loading…
Reference in New Issue
Block a user