feat: Add reply panel visibility state and optimize dialog confirmation handling
This commit is contained in:
@@ -389,11 +389,23 @@ fun AnimatedRosettaLogo(
|
||||
)
|
||||
|
||||
Box(
|
||||
modifier = modifier,
|
||||
modifier = modifier
|
||||
.graphicsLayer {
|
||||
// Enable hardware acceleration
|
||||
compositingStrategy = androidx.compose.ui.graphics.CompositingStrategy.Offscreen
|
||||
},
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
// Pre-render all animations to avoid lag
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.graphicsLayer {
|
||||
// Hardware layer for better performance
|
||||
renderEffect = null
|
||||
},
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
// Rosetta icon (page 0) with pulse animation like splash screen
|
||||
if (currentPage == 0) {
|
||||
val pulseScale by rememberInfiniteTransition(label = "pulse").animateFloat(
|
||||
@@ -428,70 +440,108 @@ fun AnimatedRosettaLogo(
|
||||
}
|
||||
|
||||
// Fast page - idea animation (page 1)
|
||||
ideaComposition?.let { comp ->
|
||||
val lottieComp = comp as? com.airbnb.lottie.LottieComposition
|
||||
val progress by animateLottieCompositionAsState(
|
||||
composition = lottieComp,
|
||||
iterations = 1,
|
||||
isPlaying = currentPage == 1
|
||||
)
|
||||
if (currentPage == 1) {
|
||||
LottieAnimation(
|
||||
// Load adjacent pages for smooth swiping
|
||||
val shouldLoadIdea = currentPage in 0..2
|
||||
if (shouldLoadIdea) {
|
||||
ideaComposition?.let { comp ->
|
||||
val lottieComp = comp as? com.airbnb.lottie.LottieComposition
|
||||
val progress by animateLottieCompositionAsState(
|
||||
composition = lottieComp,
|
||||
progress = { progress },
|
||||
modifier = Modifier.fillMaxSize()
|
||||
iterations = 1,
|
||||
isPlaying = currentPage == 1,
|
||||
speed = 1.2f // Faster for smoother perception
|
||||
)
|
||||
if (currentPage == 1) {
|
||||
LottieAnimation(
|
||||
composition = lottieComp,
|
||||
progress = { progress },
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.graphicsLayer {
|
||||
// Hardware acceleration for smooth rendering
|
||||
compositingStrategy = androidx.compose.ui.graphics.CompositingStrategy.Offscreen
|
||||
},
|
||||
maintainOriginalImageBounds = true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Free page - money animation (page 2)
|
||||
moneyComposition?.let { comp ->
|
||||
val lottieComp = comp as? com.airbnb.lottie.LottieComposition
|
||||
val progress by animateLottieCompositionAsState(
|
||||
composition = lottieComp,
|
||||
iterations = 1,
|
||||
isPlaying = currentPage == 2
|
||||
)
|
||||
if (currentPage == 2) {
|
||||
LottieAnimation(
|
||||
val shouldLoadMoney = currentPage in 1..3
|
||||
if (shouldLoadMoney) {
|
||||
moneyComposition?.let { comp ->
|
||||
val lottieComp = comp as? com.airbnb.lottie.LottieComposition
|
||||
val progress by animateLottieCompositionAsState(
|
||||
composition = lottieComp,
|
||||
progress = { progress },
|
||||
modifier = Modifier.fillMaxSize()
|
||||
iterations = 1,
|
||||
isPlaying = currentPage == 2,
|
||||
speed = 1.2f
|
||||
)
|
||||
if (currentPage == 2) {
|
||||
LottieAnimation(
|
||||
composition = lottieComp,
|
||||
progress = { progress },
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.graphicsLayer {
|
||||
compositingStrategy = androidx.compose.ui.graphics.CompositingStrategy.Offscreen
|
||||
},
|
||||
maintainOriginalImageBounds = true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Secure page - lock animation (page 3)
|
||||
lockComposition?.let { comp ->
|
||||
val lottieComp = comp as? com.airbnb.lottie.LottieComposition
|
||||
val progress by animateLottieCompositionAsState(
|
||||
composition = lottieComp,
|
||||
iterations = 1,
|
||||
isPlaying = currentPage == 3
|
||||
)
|
||||
if (currentPage == 3) {
|
||||
LottieAnimation(
|
||||
val shouldLoadLock = currentPage in 2..4
|
||||
if (shouldLoadLock) {
|
||||
lockComposition?.let { comp ->
|
||||
val lottieComp = comp as? com.airbnb.lottie.LottieComposition
|
||||
val progress by animateLottieCompositionAsState(
|
||||
composition = lottieComp,
|
||||
progress = { progress },
|
||||
modifier = Modifier.fillMaxSize()
|
||||
iterations = 1,
|
||||
isPlaying = currentPage == 3,
|
||||
speed = 1.2f
|
||||
)
|
||||
if (currentPage == 3) {
|
||||
LottieAnimation(
|
||||
composition = lottieComp,
|
||||
progress = { progress },
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.graphicsLayer {
|
||||
compositingStrategy = androidx.compose.ui.graphics.CompositingStrategy.Offscreen
|
||||
},
|
||||
maintainOriginalImageBounds = true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Private page - book animation (page 4)
|
||||
bookComposition?.let { comp ->
|
||||
val lottieComp = comp as? com.airbnb.lottie.LottieComposition
|
||||
val progress by animateLottieCompositionAsState(
|
||||
composition = lottieComp,
|
||||
iterations = 1,
|
||||
isPlaying = currentPage == 4
|
||||
)
|
||||
if (currentPage == 4) {
|
||||
LottieAnimation(
|
||||
val shouldLoadBook = currentPage in 3..4
|
||||
if (shouldLoadBook) {
|
||||
bookComposition?.let { comp ->
|
||||
val lottieComp = comp as? com.airbnb.lottie.LottieComposition
|
||||
val progress by animateLottieCompositionAsState(
|
||||
composition = lottieComp,
|
||||
progress = { progress },
|
||||
modifier = Modifier.fillMaxSize()
|
||||
iterations = 1,
|
||||
isPlaying = currentPage == 4,
|
||||
speed = 1.2f
|
||||
)
|
||||
if (currentPage == 4) {
|
||||
LottieAnimation(
|
||||
composition = lottieComp,
|
||||
progress = { progress },
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.graphicsLayer {
|
||||
compositingStrategy = androidx.compose.ui.graphics.CompositingStrategy.Offscreen
|
||||
},
|
||||
maintainOriginalImageBounds = true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user