mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-24 22:45:20 +00:00
This reverts commit d73976537d.
This commit is contained in:
@@ -26,8 +26,6 @@ import androidx.compose.ui.text.font.FontWeight
|
|||||||
import androidx.compose.ui.text.input.ImeAction
|
import androidx.compose.ui.text.input.ImeAction
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
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 com.bitchat.android.core.ui.utils.singleOrTripleClickable
|
||||||
import androidx.compose.foundation.Canvas
|
import androidx.compose.foundation.Canvas
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
@@ -412,9 +410,7 @@ private fun PrivateChatHeader(
|
|||||||
Text(
|
Text(
|
||||||
text = titleText,
|
text = titleText,
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = Color(0xFFFF9500), // Orange
|
color = Color(0xFFFF9500) // Orange
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.width(4.dp))
|
Spacer(modifier = Modifier.width(4.dp))
|
||||||
@@ -517,12 +513,8 @@ private fun ChannelHeader(
|
|||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = Color(0xFFFF9500), // Orange to match input field
|
color = Color(0xFFFF9500), // Orange to match input field
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.align(Alignment.Center)
|
||||||
.padding(horizontal = 56.dp)
|
.clickable { onSidebarClick() }
|
||||||
.clickable { onSidebarClick() },
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Leave button - positioned on the right
|
// Leave button - positioned on the right
|
||||||
@@ -580,9 +572,7 @@ private fun MainHeader(
|
|||||||
modifier = Modifier.singleOrTripleClickable(
|
modifier = Modifier.singleOrTripleClickable(
|
||||||
onSingleClick = onTitleClick,
|
onSingleClick = onTitleClick,
|
||||||
onTripleClick = onTripleTitleClick
|
onTripleClick = onTripleTitleClick
|
||||||
),
|
)
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.width(2.dp))
|
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.text.input.TextFieldValue
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
|
|
||||||
import androidx.compose.ui.zIndex
|
import androidx.compose.ui.zIndex
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.bitchat.android.model.BitchatMessage
|
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
|
.background(colorScheme.background) // Extend background to fill entire screen including status bar
|
||||||
) {
|
) {
|
||||||
val headerHeight = 42.dp
|
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
|
// Main content area that responds to keyboard/window insets
|
||||||
Column(
|
Column(
|
||||||
@@ -127,10 +123,11 @@ fun ChatScreen(viewModel: ChatViewModel) {
|
|||||||
.windowInsetsPadding(WindowInsets.ime) // This handles keyboard insets
|
.windowInsetsPadding(WindowInsets.ime) // This handles keyboard insets
|
||||||
.windowInsetsPadding(WindowInsets.navigationBars) // Add bottom padding when keyboard is not expanded
|
.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(
|
Spacer(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.height(reservedHeaderHeight)
|
.windowInsetsPadding(WindowInsets.statusBars)
|
||||||
|
.height(headerHeight)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Messages area - takes up available space, will compress when keyboard appears
|
// Messages area - takes up available space, will compress when keyboard appears
|
||||||
@@ -259,7 +256,15 @@ fun ChatScreen(viewModel: ChatViewModel) {
|
|||||||
onLocationNotesClick = { showLocationNotesSheet = true }
|
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(
|
val alpha by animateFloatAsState(
|
||||||
targetValue = if (showSidebar) 0.5f else 0f,
|
targetValue = if (showSidebar) 0.5f else 0f,
|
||||||
@@ -464,46 +469,38 @@ private fun ChatFloatingHeader(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.zIndex(1f)
|
.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
|
color = colorScheme.background // Solid background color extending into status bar
|
||||||
) {
|
) {
|
||||||
Column {
|
TopAppBar(
|
||||||
TopAppBar(
|
title = {
|
||||||
title = {
|
ChatHeaderContent(
|
||||||
ChatHeaderContent(
|
selectedPrivatePeer = selectedPrivatePeer,
|
||||||
selectedPrivatePeer = selectedPrivatePeer,
|
currentChannel = currentChannel,
|
||||||
currentChannel = currentChannel,
|
nickname = nickname,
|
||||||
nickname = nickname,
|
viewModel = viewModel,
|
||||||
viewModel = viewModel,
|
onBackClick = {
|
||||||
onBackClick = {
|
when {
|
||||||
when {
|
selectedPrivatePeer != null -> viewModel.endPrivateChat()
|
||||||
selectedPrivatePeer != null -> viewModel.endPrivateChat()
|
currentChannel != null -> viewModel.switchToChannel(null)
|
||||||
currentChannel != null -> viewModel.switchToChannel(null)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onSidebarClick = onSidebarToggle,
|
|
||||||
onTripleClick = onPanicClear,
|
|
||||||
onShowAppInfo = onShowAppInfo,
|
|
||||||
onLocationChannelsClick = onLocationChannelsClick,
|
|
||||||
onLocationNotesClick = {
|
|
||||||
// Ensure location is loaded before showing sheet
|
|
||||||
locationManager.refreshChannels()
|
|
||||||
onLocationNotesClick()
|
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
},
|
onSidebarClick = onSidebarToggle,
|
||||||
colors = TopAppBarDefaults.topAppBarColors(
|
onTripleClick = onPanicClear,
|
||||||
containerColor = Color.Transparent
|
onShowAppInfo = onShowAppInfo,
|
||||||
),
|
onLocationChannelsClick = onLocationChannelsClick,
|
||||||
modifier = Modifier.heightIn(min = headerHeight) // Allow header to expand for accessibility font scales
|
onLocationNotesClick = {
|
||||||
)
|
// Ensure location is loaded before showing sheet
|
||||||
|
locationManager.refreshChannels()
|
||||||
// Divider under header - always aligned with header bottom
|
onLocationNotesClick()
|
||||||
Divider(
|
}
|
||||||
modifier = Modifier.fillMaxWidth(),
|
)
|
||||||
color = colorScheme.outline.copy(alpha = 0.3f)
|
},
|
||||||
)
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
}
|
containerColor = Color.Transparent
|
||||||
|
),
|
||||||
|
modifier = Modifier.height(headerHeight) // Ensure compact header height
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user