Revert "Fix small-screen header clipping (#519) (#532)" (#548)

This reverts commit d73976537d.
This commit is contained in:
callebtc
2026-01-04 21:08:52 +07:00
committed by GitHub
parent 55b2d68def
commit 123a24ce34
3 changed files with 47 additions and 60 deletions
@@ -26,8 +26,6 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.text.style.TextAlign
import com.bitchat.android.core.ui.utils.singleOrTripleClickable
import androidx.compose.foundation.Canvas
import androidx.compose.ui.geometry.Offset
@@ -412,9 +410,7 @@ private fun PrivateChatHeader(
Text(
text = titleText,
style = MaterialTheme.typography.titleMedium,
color = Color(0xFFFF9500), // Orange
maxLines = 1,
overflow = TextOverflow.Ellipsis
color = Color(0xFFFF9500) // Orange
)
Spacer(modifier = Modifier.width(4.dp))
@@ -517,12 +513,8 @@ private fun ChannelHeader(
style = MaterialTheme.typography.titleMedium,
color = Color(0xFFFF9500), // Orange to match input field
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 56.dp)
.clickable { onSidebarClick() },
textAlign = TextAlign.Center,
maxLines = 1,
overflow = TextOverflow.Ellipsis
.align(Alignment.Center)
.clickable { onSidebarClick() }
)
// Leave button - positioned on the right
@@ -580,9 +572,7 @@ private fun MainHeader(
modifier = Modifier.singleOrTripleClickable(
onSingleClick = onTitleClick,
onTripleClick = onTripleTitleClick
),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
)
Spacer(modifier = Modifier.width(2.dp))
@@ -23,7 +23,6 @@ import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.zIndex
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.bitchat.android.model.BitchatMessage
@@ -116,9 +115,6 @@ fun ChatScreen(viewModel: ChatViewModel) {
.background(colorScheme.background) // Extend background to fill entire screen including status bar
) {
val headerHeight = 42.dp
// Reserve exact height: header + status bar inset so content below won't be overlapped
val statusBarTop = WindowInsets.statusBars.asPaddingValues().calculateTopPadding()
val reservedHeaderHeight = headerHeight + statusBarTop
// Main content area that responds to keyboard/window insets
Column(
@@ -127,10 +123,11 @@ fun ChatScreen(viewModel: ChatViewModel) {
.windowInsetsPadding(WindowInsets.ime) // This handles keyboard insets
.windowInsetsPadding(WindowInsets.navigationBars) // Add bottom padding when keyboard is not expanded
) {
// Header spacer - reserve space equal to header + status bar inset
// Header spacer - creates exact space for the floating header (status bar + compact header)
Spacer(
modifier = Modifier
.height(reservedHeaderHeight)
.windowInsetsPadding(WindowInsets.statusBars)
.height(headerHeight)
)
// Messages area - takes up available space, will compress when keyboard appears
@@ -259,7 +256,15 @@ fun ChatScreen(viewModel: ChatViewModel) {
onLocationNotesClick = { showLocationNotesSheet = true }
)
// Divider under header - positioned after status bar + header height
HorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.windowInsetsPadding(WindowInsets.statusBars)
.offset(y = headerHeight)
.zIndex(1f),
color = colorScheme.outline.copy(alpha = 0.3f)
)
val alpha by animateFloatAsState(
targetValue = if (showSidebar) 0.5f else 0f,
@@ -464,10 +469,9 @@ private fun ChatFloatingHeader(
modifier = Modifier
.fillMaxWidth()
.zIndex(1f)
.statusBarsPadding(), // Respect status bar insets
.windowInsetsPadding(WindowInsets.statusBars), // Extend into status bar area
color = colorScheme.background // Solid background color extending into status bar
) {
Column {
TopAppBar(
title = {
ChatHeaderContent(
@@ -495,15 +499,8 @@ private fun ChatFloatingHeader(
colors = TopAppBarDefaults.topAppBarColors(
containerColor = Color.Transparent
),
modifier = Modifier.heightIn(min = headerHeight) // Allow header to expand for accessibility font scales
modifier = Modifier.height(headerHeight) // Ensure compact header height
)
// Divider under header - always aligned with header bottom
Divider(
modifier = Modifier.fillMaxWidth(),
color = colorScheme.outline.copy(alpha = 0.3f)
)
}
}
}