mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-26 14:53:41 +03:00
refactor: Clean up some text alpha modifiers
This commit is contained in:
parent
77facc1d2c
commit
91dba13104
8 changed files with 20 additions and 19 deletions
|
@ -195,7 +195,7 @@ fun AnimeEpisodeListItem(
|
|||
text = watchProgress,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.alpha(ReadItemAlpha),
|
||||
color = LocalContentColor.current.copy(alpha = ReadItemAlpha),
|
||||
)
|
||||
if (scanlator != null) DotSeparatorText()
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ fun AnimeInfoBox(
|
|||
)
|
||||
}
|
||||
.blur(4.dp)
|
||||
.alpha(.2f),
|
||||
.alpha(0.2f),
|
||||
)
|
||||
|
||||
// Anime & source info
|
||||
|
|
|
@ -66,7 +66,7 @@ fun EntryToolbar(
|
|||
text = if (isActionMode) actionModeCounter.toString() else title,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.alpha(if (isActionMode) 1f else titleAlphaProvider()),
|
||||
color = LocalContentColor.current.copy(alpha = if (isActionMode) 1f else titleAlphaProvider()),
|
||||
)
|
||||
},
|
||||
navigationIcon = {
|
||||
|
|
|
@ -33,7 +33,6 @@ import androidx.compose.runtime.setValue
|
|||
import androidx.compose.runtime.snapshotFlow
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clipToBounds
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
|
@ -194,7 +193,7 @@ fun MangaChapterListItem(
|
|||
text = readProgress,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.alpha(ReadItemAlpha),
|
||||
color = LocalContentColor.current.copy(alpha = ReadItemAlpha),
|
||||
)
|
||||
}
|
||||
if (scanlator != null) {
|
||||
|
|
|
@ -126,7 +126,7 @@ fun MangaInfoBox(
|
|||
)
|
||||
}
|
||||
.blur(4.dp)
|
||||
.alpha(.2f),
|
||||
.alpha(0.2f),
|
||||
)
|
||||
|
||||
// Manga & source info
|
||||
|
|
|
@ -63,15 +63,15 @@ private const val GridSelectedCoverAlpha = 0.76f
|
|||
*/
|
||||
@Composable
|
||||
fun EntryCompactGridItem(
|
||||
coverData: EntryCover,
|
||||
onClick: () -> Unit,
|
||||
onLongClick: () -> Unit,
|
||||
isSelected: Boolean = false,
|
||||
title: String? = null,
|
||||
coverData: EntryCover,
|
||||
onClickContinueViewing: (() -> Unit)? = null,
|
||||
coverAlpha: Float = 1f,
|
||||
coverBadgeStart: @Composable (RowScope.() -> Unit)? = null,
|
||||
coverBadgeEnd: @Composable (RowScope.() -> Unit)? = null,
|
||||
onLongClick: () -> Unit,
|
||||
onClick: () -> Unit,
|
||||
onClickContinueViewing: (() -> Unit)? = null,
|
||||
) {
|
||||
GridItemSelectable(
|
||||
isSelected = isSelected,
|
||||
|
@ -166,13 +166,13 @@ private fun BoxScope.CoverTextOverlay(
|
|||
fun EntryComfortableGridItem(
|
||||
isSelected: Boolean = false,
|
||||
title: String,
|
||||
onClick: () -> Unit,
|
||||
onLongClick: () -> Unit,
|
||||
titleMaxLines: Int = 2,
|
||||
coverData: EntryCover,
|
||||
coverAlpha: Float = 1f,
|
||||
coverBadgeStart: (@Composable RowScope.() -> Unit)? = null,
|
||||
coverBadgeEnd: (@Composable RowScope.() -> Unit)? = null,
|
||||
onLongClick: () -> Unit,
|
||||
onClick: () -> Unit,
|
||||
onClickContinueViewing: (() -> Unit)? = null,
|
||||
) {
|
||||
GridItemSelectable(
|
||||
|
@ -254,10 +254,10 @@ private fun EntryGridCover(
|
|||
|
||||
@Composable
|
||||
private fun GridItemTitle(
|
||||
modifier: Modifier,
|
||||
title: String,
|
||||
style: TextStyle,
|
||||
minLines: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
maxLines: Int = 2,
|
||||
) {
|
||||
Text(
|
||||
|
@ -277,10 +277,10 @@ private fun GridItemTitle(
|
|||
*/
|
||||
@Composable
|
||||
private fun GridItemSelectable(
|
||||
modifier: Modifier = Modifier,
|
||||
isSelected: Boolean,
|
||||
onClick: () -> Unit,
|
||||
onLongClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
Box(
|
||||
|
@ -321,9 +321,9 @@ fun EntryListItem(
|
|||
title: String,
|
||||
coverData: EntryCover,
|
||||
coverAlpha: Float = 1f,
|
||||
badge: @Composable (RowScope.() -> Unit),
|
||||
onLongClick: () -> Unit,
|
||||
onClick: () -> Unit,
|
||||
badge: @Composable (RowScope.() -> Unit),
|
||||
onClickContinueViewing: (() -> Unit)? = null,
|
||||
) {
|
||||
Row(
|
||||
|
|
|
@ -251,7 +251,6 @@ fun TrackDetailsItem(
|
|||
Box(
|
||||
modifier = modifier
|
||||
.clickable(onClick = onClick)
|
||||
.alpha(if (text == null) UnsetStatusTextAlpha else 1f)
|
||||
.fillMaxHeight()
|
||||
.padding(12.dp),
|
||||
contentAlignment = Alignment.Center,
|
||||
|
@ -262,7 +261,7 @@ fun TrackDetailsItem(
|
|||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
textAlign = TextAlign.Center,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = if (text == null) UnsetStatusTextAlpha else 1f),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package tachiyomi.presentation.core.util
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
|
@ -16,6 +15,7 @@ import androidx.compose.runtime.setValue
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.composed
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
|
@ -28,7 +28,10 @@ import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
|
|||
fun Modifier.selectedBackground(isSelected: Boolean): Modifier = if (isSelected) {
|
||||
composed {
|
||||
val alpha = if (isSystemInDarkTheme()) 0.16f else 0.22f
|
||||
Modifier.background(MaterialTheme.colorScheme.secondary.copy(alpha = alpha))
|
||||
val color = MaterialTheme.colorScheme.secondary.copy(alpha = alpha)
|
||||
Modifier.drawBehind {
|
||||
drawRect(color)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this
|
||||
|
|
Loading…
Reference in a new issue