小调整
This commit is contained in:
1 parent
65519942fe
commit
c95c8e38f7
4 files changed
+66
-24
No files matched your search
@@ -3,12 +3,16 @@ package com.example.myapplication.screens
|
||||
import androidx.compose.animation.AnimatedContent
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.togetherWith
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.gestures.awaitEachGesture
|
||||
import androidx.compose.foundation.gestures.awaitFirstDown
|
||||
import androidx.compose.foundation.gestures.waitForUpOrCancellation
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
@@ -53,11 +57,14 @@ import androidx.compose.ui.geometry.Rect
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Shadow
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.graphics.painter.ColorPainter
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.layout.boundsInRoot
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.layout.positionInRoot
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -283,22 +290,39 @@ private fun FeaturedItemBanner(
|
||||
onClick: () -> Unit = {},
|
||||
) {
|
||||
val imageUrl = heroImageUrl(item, serverUrl)
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
// P2: Remember ImageRequest to avoid allocation on every recomposition
|
||||
val context = LocalContext.current
|
||||
val imageRequest = remember(imageUrl) {
|
||||
imageUrl?.let { ImageRequest.Builder(context).data(it).crossfade(true).build() }
|
||||
}
|
||||
|
||||
// Press feedback: pointer-based scale animation consistent with LumaMediaCard
|
||||
var isPressed by remember { mutableStateOf(false) }
|
||||
val scale by animateFloatAsState(
|
||||
targetValue = if (isPressed) 0.97f else 1f,
|
||||
animationSpec = tween(LumaMotion.fast),
|
||||
label = "heroPress",
|
||||
)
|
||||
|
||||
Box(
|
||||
modifier
|
||||
.fillMaxWidth()
|
||||
.height(heroHeight)
|
||||
.graphicsLayer { scaleX = scale; scaleY = scale }
|
||||
.clickable(
|
||||
interactionSource = interactionSource,
|
||||
indication = null,
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
role = Role.Button,
|
||||
onClick = onClick,
|
||||
)
|
||||
.pointerInput(Unit) {
|
||||
awaitEachGesture {
|
||||
awaitFirstDown(requireUnconsumed = false)
|
||||
isPressed = true
|
||||
val up = waitForUpOrCancellation()
|
||||
isPressed = up != null
|
||||
}
|
||||
}
|
||||
.background(immersive.pageTop),
|
||||
) {
|
||||
if (imageRequest != null) {
|
||||
@@ -625,13 +649,20 @@ private fun SectionTitle(
|
||||
) {
|
||||
Text(text = title, color = homeContentColor(), fontSize = 18.sp, fontWeight = FontWeight.ExtraBold)
|
||||
if (count > 0) {
|
||||
Text(
|
||||
text = stringResource(Res.string.more) + " >",
|
||||
color = homeAccentColor(),
|
||||
fontSize = 13.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
modifier = Modifier.clickable(onClick = { onMoreClick?.invoke() }),
|
||||
)
|
||||
Box(
|
||||
Modifier
|
||||
.heightIn(min = 48.dp)
|
||||
.clickable(onClick = { onMoreClick?.invoke() })
|
||||
.padding(horizontal = 8.dp),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(Res.string.more) + " >",
|
||||
color = homeAccentColor(),
|
||||
fontSize = 13.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ fun MediaDetailScreen(
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.height(42.dp)
|
||||
.heightIn(min = 48.dp)
|
||||
.clickable(enabled = episodes.isNotEmpty()) { showAllEpisodes = true },
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
@@ -294,6 +295,7 @@ private fun FavoriteSectionHeader(
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(min = 48.dp)
|
||||
.clickable(
|
||||
indication = null,
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
@@ -622,18 +624,22 @@ private fun WeekCalendarHeader(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
text = "←",
|
||||
color = GlassTokens.subtext,
|
||||
fontSize = 18.sp,
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(48.dp)
|
||||
.clickable(
|
||||
indication = null,
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
onClick = onPrevWeek,
|
||||
)
|
||||
.padding(4.dp),
|
||||
)
|
||||
),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Text(
|
||||
text = "←",
|
||||
color = GlassTokens.subtext,
|
||||
fontSize = 18.sp,
|
||||
)
|
||||
}
|
||||
Spacer(Modifier.width(8.dp))
|
||||
Text(
|
||||
text = monthTitle,
|
||||
@@ -642,18 +648,22 @@ private fun WeekCalendarHeader(
|
||||
fontWeight = FontWeight.Bold,
|
||||
)
|
||||
Spacer(Modifier.weight(1f))
|
||||
Text(
|
||||
text = "→",
|
||||
color = GlassTokens.subtext,
|
||||
fontSize = 18.sp,
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(48.dp)
|
||||
.clickable(
|
||||
indication = null,
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
onClick = onNextWeek,
|
||||
)
|
||||
.padding(4.dp),
|
||||
)
|
||||
),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Text(
|
||||
text = "→",
|
||||
color = GlassTokens.subtext,
|
||||
fontSize = 18.sp,
|
||||
)
|
||||
}
|
||||
}
|
||||
Spacer(Modifier.height(12.dp))
|
||||
// Weekday headers
|
||||
|
||||
@@ -451,6 +451,7 @@ private fun SearchHistoryList(
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(min = 48.dp)
|
||||
.clickable(
|
||||
indication = null,
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
|
||||
Reference in new issue
Block a user