mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3044 Chats | Fix | Layouting fixes (#1833)
This commit is contained in:
parent
06c04df9ca
commit
a61f56e1c8
3 changed files with 44 additions and 26 deletions
|
@ -8,6 +8,7 @@ import androidx.activity.compose.BackHandler
|
|||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.systemBarsPadding
|
||||
import androidx.compose.foundation.pager.HorizontalPager
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
|
@ -139,7 +140,9 @@ class HomeScreenFragment : BaseComposeFragment(),
|
|||
onSpaceIconClicked = vm::onSpaceSettingsClicked
|
||||
)
|
||||
HorizontalPager(
|
||||
modifier = Modifier.padding(top = 64.dp),
|
||||
modifier = Modifier
|
||||
.systemBarsPadding()
|
||||
.padding(top = 64.dp),
|
||||
state = pagerState,
|
||||
userScrollEnabled = false
|
||||
) { page ->
|
||||
|
@ -503,6 +506,10 @@ class HomeScreenFragment : BaseComposeFragment(),
|
|||
componentManager().homeScreenComponent.release()
|
||||
}
|
||||
|
||||
override fun onApplyWindowRootInsets(view: View) {
|
||||
// Do not apply window insets on fragment container.
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val SHOW_MNEMONIC_KEY = "arg.home-screen.show-mnemonic"
|
||||
const val DEEP_LINK_KEY = "arg.home-screen.deep-link"
|
||||
|
|
|
@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.systemBarsPadding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
@ -31,6 +32,7 @@ fun HomeScreenToolbar(
|
|||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.systemBarsPadding()
|
||||
.fillMaxWidth()
|
||||
.height(64.dp)
|
||||
.padding(horizontal = 20.dp)
|
||||
|
|
|
@ -22,6 +22,8 @@ import androidx.compose.foundation.layout.fillMaxHeight
|
|||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
|
@ -229,14 +231,16 @@ fun DiscussionScreen(
|
|||
}
|
||||
}
|
||||
val scope = rememberCoroutineScope()
|
||||
Column(modifier = Modifier.fillMaxSize()) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
if (!isSpaceLevelChat) {
|
||||
TopDiscussionToolbar(
|
||||
title = title,
|
||||
isHeaderVisible = isHeaderVisible
|
||||
)
|
||||
}
|
||||
Box(modifier = Modifier.weight(1.0f)) {
|
||||
Box(modifier = Modifier.weight(1f)) {
|
||||
Messages(
|
||||
isSpaceLevelChat = isSpaceLevelChat,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
|
@ -331,6 +335,7 @@ fun DiscussionScreen(
|
|||
}
|
||||
|
||||
ChatBox(
|
||||
modifier = Modifier.imePadding().navigationBarsPadding(),
|
||||
chatBoxFocusRequester = chatBoxFocusRequester,
|
||||
textState = textState,
|
||||
onMessageSent = onMessageSent,
|
||||
|
@ -481,6 +486,7 @@ private fun OldChatBox(
|
|||
|
||||
@Composable
|
||||
private fun ChatBox(
|
||||
modifier: Modifier = Modifier,
|
||||
onBackButtonClicked: () -> Unit,
|
||||
chatBoxFocusRequester: FocusRequester,
|
||||
textState: TextFieldValue,
|
||||
|
@ -498,7 +504,7 @@ private fun ChatBox(
|
|||
val focus = LocalFocusManager.current
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.defaultMinSize(minHeight = 56.dp)
|
||||
.padding(
|
||||
|
@ -704,7 +710,6 @@ fun Messages(
|
|||
) {
|
||||
LazyColumn(
|
||||
modifier = modifier,
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
reverseLayout = true,
|
||||
state = scrollState,
|
||||
) {
|
||||
|
@ -716,7 +721,7 @@ fun Messages(
|
|||
Spacer(modifier = Modifier.height(36.dp))
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 8.dp)
|
||||
.padding(horizontal = 8.dp, vertical = 6.dp)
|
||||
.animateItem()
|
||||
) {
|
||||
if (!msg.isUserAuthor) {
|
||||
|
@ -769,30 +774,34 @@ fun Messages(
|
|||
}
|
||||
if (messages.isEmpty()) {
|
||||
item {
|
||||
Column(
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(top = 170.dp)
|
||||
.fillParentMaxSize()
|
||||
) {
|
||||
AlertIcon(
|
||||
icon = AlertConfig.Icon(
|
||||
gradient = GRADIENT_TYPE_BLUE,
|
||||
icon = R.drawable.ic_alert_message
|
||||
)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.chat_empty_state_message),
|
||||
style = Caption1Regular,
|
||||
color = colorResource(id = R.color.text_secondary),
|
||||
textAlign = TextAlign.Center,
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(
|
||||
start = 20.dp,
|
||||
end = 20.dp,
|
||||
top = 12.dp
|
||||
.align(Alignment.CenterStart)
|
||||
) {
|
||||
AlertIcon(
|
||||
icon = AlertConfig.Icon(
|
||||
gradient = GRADIENT_TYPE_BLUE,
|
||||
icon = R.drawable.ic_alert_message
|
||||
)
|
||||
)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.chat_empty_state_message),
|
||||
style = Caption1Regular,
|
||||
color = colorResource(id = R.color.text_secondary),
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(
|
||||
start = 20.dp,
|
||||
end = 20.dp,
|
||||
top = 12.dp
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue