feat: Enhance logging and debugging capabilities across Protocol and UI components
This commit is contained in:
@@ -98,13 +98,11 @@ fun OnboardingScreen(
|
||||
val elapsed = System.currentTimeMillis() - startTime
|
||||
transitionProgress = (elapsed / duration).coerceAtMost(1f)
|
||||
|
||||
// Update status bar when wave reaches top (around 15% progress)
|
||||
if (transitionProgress >= 0.15f && !shouldUpdateStatusBar) {
|
||||
shouldUpdateStatusBar = true
|
||||
}
|
||||
|
||||
delay(16) // ~60fps
|
||||
}
|
||||
// Update status bar icons after animation is completely finished
|
||||
shouldUpdateStatusBar = true
|
||||
delay(50) // Small delay to ensure UI updates
|
||||
isTransitioning = false
|
||||
transitionProgress = 0f
|
||||
shouldUpdateStatusBar = false
|
||||
@@ -112,9 +110,34 @@ fun OnboardingScreen(
|
||||
}
|
||||
}
|
||||
|
||||
// Update status bar and navigation bar icons when wave reaches the top
|
||||
// Animate navigation bar color starting at 80% of wave animation
|
||||
val view = LocalView.current
|
||||
LaunchedEffect(shouldUpdateStatusBar, isDarkTheme) {
|
||||
LaunchedEffect(isTransitioning, transitionProgress) {
|
||||
if (isTransitioning && transitionProgress >= 0.8f && !view.isInEditMode) {
|
||||
val window = (view.context as android.app.Activity).window
|
||||
// Map 0.8-1.0 to 0-1 for smooth interpolation
|
||||
val navProgress = ((transitionProgress - 0.8f) / 0.2f).coerceIn(0f, 1f)
|
||||
|
||||
val oldColor = if (previousTheme) 0xFF1E1E1E else 0xFFFFFFFF
|
||||
val newColor = if (targetTheme) 0xFF1E1E1E else 0xFFFFFFFF
|
||||
|
||||
val r1 = (oldColor shr 16 and 0xFF)
|
||||
val g1 = (oldColor shr 8 and 0xFF)
|
||||
val b1 = (oldColor and 0xFF)
|
||||
val r2 = (newColor shr 16 and 0xFF)
|
||||
val g2 = (newColor shr 8 and 0xFF)
|
||||
val b2 = (newColor and 0xFF)
|
||||
|
||||
val r = (r1 + (r2 - r1) * navProgress).toInt()
|
||||
val g = (g1 + (g2 - g1) * navProgress).toInt()
|
||||
val b = (b1 + (b2 - b1) * navProgress).toInt()
|
||||
|
||||
window.navigationBarColor = (0xFF000000 or (r.toLong() shl 16) or (g.toLong() shl 8) or b.toLong()).toInt()
|
||||
}
|
||||
}
|
||||
|
||||
// Update status bar icons when animation finishes
|
||||
LaunchedEffect(shouldUpdateStatusBar) {
|
||||
if (shouldUpdateStatusBar && !view.isInEditMode) {
|
||||
val window = (view.context as android.app.Activity).window
|
||||
val insetsController = WindowCompat.getInsetsController(window, view)
|
||||
@@ -124,32 +147,11 @@ fun OnboardingScreen(
|
||||
}
|
||||
}
|
||||
|
||||
// Animate navigation bar color with theme transition
|
||||
LaunchedEffect(isTransitioning, transitionProgress, isDarkTheme) {
|
||||
// Set initial navigation bar color only on first launch
|
||||
LaunchedEffect(Unit) {
|
||||
if (!view.isInEditMode) {
|
||||
val window = (view.context as android.app.Activity).window
|
||||
if (isTransitioning) {
|
||||
// Interpolate color during transition
|
||||
val oldColor = if (previousTheme) 0xFF1E1E1E else 0xFFFFFFFF
|
||||
val newColor = if (targetTheme) 0xFF1E1E1E else 0xFFFFFFFF
|
||||
|
||||
val r1 = (oldColor shr 16 and 0xFF)
|
||||
val g1 = (oldColor shr 8 and 0xFF)
|
||||
val b1 = (oldColor and 0xFF)
|
||||
|
||||
val r2 = (newColor shr 16 and 0xFF)
|
||||
val g2 = (newColor shr 8 and 0xFF)
|
||||
val b2 = (newColor and 0xFF)
|
||||
|
||||
val r = (r1 + (r2 - r1) * transitionProgress).toInt()
|
||||
val g = (g1 + (g2 - g1) * transitionProgress).toInt()
|
||||
val b = (b1 + (b2 - b1) * transitionProgress).toInt()
|
||||
|
||||
window.navigationBarColor = (0xFF000000 or (r.toLong() shl 16) or (g.toLong() shl 8) or b.toLong()).toInt()
|
||||
} else {
|
||||
// Set final color when not transitioning
|
||||
window.navigationBarColor = if (isDarkTheme) 0xFF1E1E1E.toInt() else 0xFFFFFFFF.toInt()
|
||||
}
|
||||
window.navigationBarColor = if (isDarkTheme) 0xFF1E1E1E.toInt() else 0xFFFFFFFF.toInt()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,42 +389,40 @@ fun AnimatedRosettaLogo(
|
||||
)
|
||||
|
||||
Box(
|
||||
modifier = modifier
|
||||
.scale(scale)
|
||||
.graphicsLayer { this.alpha = alpha },
|
||||
modifier = modifier,
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
// Pre-render all animations to avoid lag
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
// Rosetta icon (page 0) with pulse animation
|
||||
// Rosetta icon (page 0) with pulse animation like splash screen
|
||||
if (currentPage == 0) {
|
||||
val pulseScale by rememberInfiniteTransition(label = "pulse").animateFloat(
|
||||
initialValue = 1f,
|
||||
targetValue = 1.08f,
|
||||
targetValue = 1.1f,
|
||||
animationSpec = infiniteRepeatable(
|
||||
animation = tween(1000, easing = FastOutSlowInEasing),
|
||||
animation = tween(800, easing = FastOutSlowInEasing),
|
||||
repeatMode = RepeatMode.Reverse
|
||||
),
|
||||
label = "pulseScale"
|
||||
)
|
||||
|
||||
// Glow effect behind logo - separate Box without clipping
|
||||
// Glow effect behind logo - same style as splash screen
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(200.dp)
|
||||
.size(180.dp)
|
||||
.scale(pulseScale)
|
||||
.background(
|
||||
color = Color(0xFF54A9EB).copy(alpha = 0.15f),
|
||||
color = Color(0xFF54A9EB).copy(alpha = 0.2f),
|
||||
shape = CircleShape
|
||||
)
|
||||
)
|
||||
|
||||
// Main logo - circular like splash screen
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.rosetta_icon),
|
||||
contentDescription = "Rosetta Logo",
|
||||
modifier = Modifier
|
||||
.size(180.dp)
|
||||
.scale(pulseScale)
|
||||
.size(150.dp)
|
||||
.clip(CircleShape)
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user