feat: Update navigation bar color logic to match drawer background when open

This commit is contained in:
k1ngsterr1
2026-01-09 03:35:26 +05:00
parent ec70d1e216
commit b4be8fda11
2 changed files with 65 additions and 80 deletions

View File

@@ -278,28 +278,26 @@ fun UnlockScreen(
// Dropdown list with animation
AnimatedVisibility(
visible = isDropdownExpanded,
enter = fadeIn(tween(200)) + expandVertically(
enter = fadeIn(tween(150)) + expandVertically(
expandFrom = Alignment.Top,
animationSpec = spring(
dampingRatio = Spring.DampingRatioMediumBouncy,
stiffness = Spring.StiffnessMediumLow
)
animationSpec = tween(200, easing = FastOutSlowInEasing)
),
exit = fadeOut(tween(150)) + shrinkVertically(
exit = fadeOut(tween(100)) + shrinkVertically(
shrinkTowards = Alignment.Top,
animationSpec = tween(200)
animationSpec = tween(150)
)
) {
Card(
modifier = Modifier
.fillMaxWidth()
.padding(top = 8.dp)
.heightIn(max = 300.dp),
.heightIn(max = if (accounts.size > 5) 350.dp else ((accounts.size * 64 + 70).dp)),
colors = CardDefaults.cardColors(containerColor = cardBackground),
shape = RoundedCornerShape(16.dp)
) {
Column {
// Search field
// Search field - only show if more than 3 accounts
if (accounts.size > 3) {
OutlinedTextField(
value = searchQuery,
onValueChange = { searchQuery = it },
@@ -337,10 +335,13 @@ fun UnlockScreen(
color = if (isDarkTheme) Color(0xFF3A3A3A) else Color(0xFFE0E0E0),
thickness = 0.5.dp
)
}
// Account list
LazyColumn(
modifier = Modifier.fillMaxWidth()
modifier = Modifier
.fillMaxWidth()
.padding(vertical = if (accounts.size <= 3) 8.dp else 0.dp)
) {
items(filteredAccounts, key = { it.publicKey }) { account ->
val isSelected = account.publicKey == selectedAccount?.publicKey

View File

@@ -159,45 +159,27 @@ fun ChatsListScreen(
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
val scope = rememberCoroutineScope()
// Update status bar and navigation bar
// Update status bar and hide navigation bar completely
LaunchedEffect(isDarkTheme, drawerState.isOpen) {
if (!view.isInEditMode) {
val window = (view.context as android.app.Activity).window
val insetsController = androidx.core.view.WindowCompat.getInsetsController(window, view)
// Status bar
insetsController.isAppearanceLightStatusBars = !isDarkTheme
insetsController.isAppearanceLightNavigationBars = !isDarkTheme
window.statusBarColor = android.graphics.Color.TRANSPARENT
// When drawer is open, dim the navigation bar to match overlay
window.navigationBarColor = if (drawerState.isOpen) {
// Darker color to match scrim overlay
if (isDarkTheme) 0xFF0D0D0D.toInt() else 0xFF999999.toInt()
} else {
if (isDarkTheme) 0xFF1A1A1A.toInt() else 0xFFFFFFFF.toInt()
}
// Hide navigation bar completely
insetsController.hide(androidx.core.view.WindowInsetsCompat.Type.navigationBars())
insetsController.systemBarsBehavior = androidx.core.view.WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
}
}
val backgroundColor by animateColorAsState(
targetValue = if (isDarkTheme) Color(0xFF1A1A1A) else Color(0xFFFFFFFF),
animationSpec = if (!hasInitialized) snap() else tween(800, easing = FastOutSlowInEasing),
label = "backgroundColor"
)
// Colors - instant change, no animation (to keep sidebar and content in sync)
val backgroundColor = if (isDarkTheme) Color(0xFF1A1A1A) else Color(0xFFFFFFFF)
val drawerBackgroundColor = if (isDarkTheme) Color(0xFF212121) else Color(0xFFFFFFFF)
val textColor by animateColorAsState(
targetValue = if (isDarkTheme) Color.White else Color.Black,
animationSpec = if (!hasInitialized) snap() else tween(800, easing = FastOutSlowInEasing),
label = "textColor"
)
val secondaryTextColor by animateColorAsState(
targetValue = if (isDarkTheme) Color(0xFF8E8E93) else Color(0xFF666666),
animationSpec = if (!hasInitialized) snap() else tween(800, easing = FastOutSlowInEasing),
label = "secondaryTextColor"
)
val dividerColor by animateColorAsState(
targetValue = if (isDarkTheme) Color(0xFF3A3A3A) else Color(0xFFE8E8E8),
animationSpec = if (!hasInitialized) snap() else tween(800, easing = FastOutSlowInEasing),
label = "dividerColor"
)
val textColor = if (isDarkTheme) Color.White else Color.Black
val secondaryTextColor = if (isDarkTheme) Color(0xFF8E8E93) else Color(0xFF666666)
// Protocol connection state
val protocolState by ProtocolManager.state.collectAsState()
@@ -684,11 +666,13 @@ fun ChatsListScreen(
if (searchButtonScale > 0.01f) {
IconButton(
onClick = { isSearchExpanded = true },
onClick = { /* TODO: Search not implemented yet */ },
enabled = false,
modifier = Modifier.graphicsLayer {
scaleX = searchButtonScale
scaleY = searchButtonScale
rotationZ = searchButtonRotation
alpha = 0.5f
}
) {
Icon(
@@ -708,7 +692,7 @@ fun ChatsListScreen(
},
floatingActionButton = {
AnimatedVisibility(
visible = visible,
visible = false, // Hidden for now
enter = fadeIn(tween(500, delayMillis = 300)) + scaleIn(
initialScale = 0.5f,
animationSpec = tween(500, delayMillis = 300)
@@ -735,9 +719,9 @@ fun ChatsListScreen(
.fillMaxSize()
.padding(paddingValues)
) {
// Console button
// Console button - hidden for now
AnimatedVisibility(
visible = visible,
visible = false,
enter = fadeIn(tween(500, delayMillis = 400)) + slideInHorizontally(
initialOffsetX = { -it },
animationSpec = tween(500, delayMillis = 400)