Fix composer options bottom sheet position (#1469)

This commit is contained in:
jonnyandrew
2023-09-29 17:29:57 +01:00
committed by GitHub
parent f10040f729
commit f84cd01e73
2 changed files with 22 additions and 31 deletions

View File

@@ -50,6 +50,7 @@ import io.element.android.features.messages.impl.actionlist.ActionListEvents
import io.element.android.features.messages.impl.actionlist.ActionListView
import io.element.android.features.messages.impl.actionlist.model.TimelineItemAction
import io.element.android.features.messages.impl.attachments.Attachment
import io.element.android.features.messages.impl.messagecomposer.AttachmentsBottomSheet
import io.element.android.features.messages.impl.messagecomposer.AttachmentsState
import io.element.android.features.messages.impl.messagecomposer.MessageComposerEvents
import io.element.android.features.messages.impl.messagecomposer.MessageComposerView
@@ -283,6 +284,13 @@ private fun MessagesViewContent(
.navigationBarsPadding()
.imePadding(),
) {
AttachmentsBottomSheet(
state = state.composerState,
onSendLocationClicked = onSendLocationClicked,
onCreatePollClicked = onCreatePollClicked,
enableTextFormatting = state.enableTextFormatting,
)
ExpandableBottomSheetScaffold(
sheetDragHandle = if (state.composerState.showTextFormatting) {
@Composable { BottomSheetDragHandle() }
@@ -310,8 +318,6 @@ private fun MessagesViewContent(
MessageComposerView(
state = state.composerState,
subcomposing = subcomposing,
onSendLocationClicked = onSendLocationClicked,
onCreatePollClicked = onCreatePollClicked,
enableTextFormatting = state.enableTextFormatting,
modifier = Modifier
.fillMaxWidth(),

View File

@@ -16,7 +16,6 @@
package io.element.android.features.messages.impl.messagecomposer
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.height
@@ -35,8 +34,6 @@ import kotlinx.coroutines.launch
fun MessageComposerView(
state: MessageComposerState,
subcomposing: Boolean,
onSendLocationClicked: () -> Unit,
onCreatePollClicked: () -> Unit,
enableTextFormatting: Boolean,
modifier: Modifier = Modifier,
) {
@@ -67,28 +64,20 @@ fun MessageComposerView(
}
}
Box(modifier = modifier) {
AttachmentsBottomSheet(
state = state,
onSendLocationClicked = onSendLocationClicked,
onCreatePollClicked = onCreatePollClicked,
enableTextFormatting = enableTextFormatting,
)
TextComposer(
state = state.richTextEditorState,
subcomposing = subcomposing,
onRequestFocus = ::onRequestFocus,
onSendMessage = ::sendMessage,
composerMode = state.mode,
showTextFormatting = state.showTextFormatting,
onResetComposerMode = ::onCloseSpecialMode,
onAddAttachment = ::onAddAttachment,
onDismissTextFormatting = ::onDismissTextFormatting,
enableTextFormatting = enableTextFormatting,
onError = ::onError,
)
}
TextComposer(
modifier = modifier,
state = state.richTextEditorState,
subcomposing = subcomposing,
onRequestFocus = ::onRequestFocus,
onSendMessage = ::sendMessage,
composerMode = state.mode,
showTextFormatting = state.showTextFormatting,
onResetComposerMode = ::onCloseSpecialMode,
onAddAttachment = ::onAddAttachment,
onDismissTextFormatting = ::onDismissTextFormatting,
enableTextFormatting = enableTextFormatting,
onError = ::onError,
)
}
@PreviewsDayNight
@@ -98,16 +87,12 @@ internal fun MessageComposerViewPreview(@PreviewParameter(MessageComposerStatePr
MessageComposerView(
modifier = Modifier.height(IntrinsicSize.Min),
state = state,
onSendLocationClicked = {},
onCreatePollClicked = {},
enableTextFormatting = true,
subcomposing = false,
)
MessageComposerView(
modifier = Modifier.height(200.dp),
state = state,
onSendLocationClicked = {},
onCreatePollClicked = {},
enableTextFormatting = true,
subcomposing = false,
)