From 91c41c3567bbdc4fdb6527ef271724d745462f9f Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Fri, 19 Apr 2024 16:20:08 +0200 Subject: [PATCH 1/4] fix: issues found in playtest --- .../ui/home/messagecomposer/EnabledMessageComposer.kt | 5 ++++- .../wire/android/feature/sketch/DrawingCanvasBottomSheet.kt | 3 ++- .../wire/android/feature/sketch/DrawingCanvasComponent.kt | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/EnabledMessageComposer.kt b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/EnabledMessageComposer.kt index d59e07fe469..a8d0c86933b 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/EnabledMessageComposer.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/EnabledMessageComposer.kt @@ -261,7 +261,10 @@ fun EnabledMessageComposer( additionalOptionStateHolder.toRichTextEditing() }, onCloseRichEditingButtonClicked = additionalOptionStateHolder::toAttachmentAndAdditionalOptionsMenu, - onDrawingModeClicked = additionalOptionStateHolder::toDrawingMode + onDrawingModeClicked = { + showAdditionalOptionsMenu() + additionalOptionStateHolder.toDrawingMode() + } ) } Box( diff --git a/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasBottomSheet.kt b/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasBottomSheet.kt index 15d60f7361a..c63e003dfb1 100644 --- a/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasBottomSheet.kt +++ b/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasBottomSheet.kt @@ -104,7 +104,7 @@ fun DrawingCanvasBottomSheet( onDismissRequest = onDismissEvent, properties = ModalBottomSheetProperties( isFocusable = true, - securePolicy = SecureFlagPolicy.SecureOn, + securePolicy = SecureFlagPolicy.Inherit, shouldDismissOnBackPress = false ) ) { @@ -162,6 +162,7 @@ internal fun DrawingTopBar( Text( text = conversationTitle, style = MaterialTheme.wireTypography.title01, + color = colorsScheme().onBackground, modifier = Modifier.align(Alignment.CenterVertically), maxLines = MAX_LINES_TOPBAR, overflow = TextOverflow.Ellipsis diff --git a/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasComponent.kt b/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasComponent.kt index 9e2251014b6..dee1d0bfcc8 100644 --- a/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasComponent.kt +++ b/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasComponent.kt @@ -36,7 +36,7 @@ import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.nativeCanvas import androidx.compose.ui.input.pointer.AwaitPointerEventScope import androidx.compose.ui.input.pointer.pointerInput -import androidx.compose.ui.input.pointer.positionChangedIgnoreConsumed +import androidx.compose.ui.input.pointer.positionChanged import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.res.imageResource import androidx.compose.ui.res.stringResource @@ -172,7 +172,7 @@ private suspend fun AwaitPointerEventScope.handleGestures( do { val event = awaitPointerEvent() onDraw(event.changes.first().position) - val hasNewLineDraw = event.changes.first().positionChangedIgnoreConsumed() + val hasNewLineDraw = event.changes.first().positionChanged() if (hasNewLineDraw) { event.changes.first().consume() } From 48464a866408487b53edc6b95de99e490ac8baeb Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Fri, 19 Apr 2024 16:22:56 +0200 Subject: [PATCH 2/4] fix: issues found in playtest --- .../wire/android/feature/sketch/DrawingCanvasBottomSheet.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasBottomSheet.kt b/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasBottomSheet.kt index c63e003dfb1..30319cb6f06 100644 --- a/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasBottomSheet.kt +++ b/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingCanvasBottomSheet.kt @@ -62,6 +62,7 @@ import com.wire.android.ui.common.button.WireTertiaryIconButton import com.wire.android.ui.common.button.wireSendPrimaryButtonColors import com.wire.android.ui.common.colorsScheme import com.wire.android.ui.common.dimensions +import com.wire.android.ui.theme.wireColorScheme import com.wire.android.ui.theme.wireDimensions import com.wire.android.ui.theme.wireTypography import kotlinx.coroutines.launch @@ -162,7 +163,7 @@ internal fun DrawingTopBar( Text( text = conversationTitle, style = MaterialTheme.wireTypography.title01, - color = colorsScheme().onBackground, + color = MaterialTheme.wireColorScheme.onBackground, modifier = Modifier.align(Alignment.CenterVertically), maxLines = MAX_LINES_TOPBAR, overflow = TextOverflow.Ellipsis From 4264455f7868a9dbe49e42cb311447921a9ceda5 Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Mon, 22 Apr 2024 13:30:51 +0200 Subject: [PATCH 3/4] chore: fix padding of bottom sheet --- .../ui/common/bottomsheet/WireModalSheetLayout.kt | 11 +++++++++++ .../wire/android/feature/sketch/DrawingToolPicker.kt | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/WireModalSheetLayout.kt b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/WireModalSheetLayout.kt index e8de411621f..304fd85cb17 100644 --- a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/WireModalSheetLayout.kt +++ b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/WireModalSheetLayout.kt @@ -21,7 +21,12 @@ package com.wire.android.ui.common.bottomsheet import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope +import androidx.compose.foundation.layout.ExperimentalLayoutApi +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.absoluteOffset +import androidx.compose.foundation.layout.navigationBarsIgnoringVisibility +import androidx.compose.foundation.layout.windowInsetsBottomHeight import androidx.compose.material3.BottomSheetDefaults import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ModalBottomSheet @@ -83,6 +88,7 @@ fun MenuModalSheetLayout( ) } +@OptIn(ExperimentalLayoutApi::class) @Composable fun MenuModalSheetContent( header: MenuModalSheetHeader = MenuModalSheetHeader.Gone, @@ -91,5 +97,10 @@ fun MenuModalSheetContent( Column { ModalSheetHeaderItem(header = header) buildMenuSheetItems(items = menuItems) + Spacer( + Modifier.windowInsetsBottomHeight( + WindowInsets.navigationBarsIgnoringVisibility + ) + ) } } diff --git a/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingToolPicker.kt b/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingToolPicker.kt index 0182f0f1b5d..9d6059a7594 100644 --- a/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingToolPicker.kt +++ b/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingToolPicker.kt @@ -47,6 +47,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Devices import androidx.compose.ui.tooling.preview.Preview import com.wire.android.ui.common.bottomsheet.MenuModalSheetContent import com.wire.android.ui.common.bottomsheet.MenuModalSheetHeader @@ -179,7 +180,7 @@ private const val GRID_CELLS = 6 private fun Color.isWhite() = this == Color.White @OptIn(ExperimentalMaterial3Api::class) -@Preview +@Preview(showSystemUi = true, device = Devices.NEXUS_5) @Composable fun PreviewDrawingToolPickerSelectedNonWhite() { WireTheme { From f1630f23332f8887b3a2bedea0401302a24866b9 Mon Sep 17 00:00:00 2001 From: yamilmedina Date: Mon, 22 Apr 2024 13:52:39 +0200 Subject: [PATCH 4/4] chore: fix padding of bottom sheet --- .../ui/common/bottomsheet/WireModalSheetLayout.kt | 11 ----------- .../android/feature/sketch/DrawingToolPicker.kt | 13 +++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/WireModalSheetLayout.kt b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/WireModalSheetLayout.kt index 304fd85cb17..e8de411621f 100644 --- a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/WireModalSheetLayout.kt +++ b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/WireModalSheetLayout.kt @@ -21,12 +21,7 @@ package com.wire.android.ui.common.bottomsheet import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope -import androidx.compose.foundation.layout.ExperimentalLayoutApi -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.absoluteOffset -import androidx.compose.foundation.layout.navigationBarsIgnoringVisibility -import androidx.compose.foundation.layout.windowInsetsBottomHeight import androidx.compose.material3.BottomSheetDefaults import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ModalBottomSheet @@ -88,7 +83,6 @@ fun MenuModalSheetLayout( ) } -@OptIn(ExperimentalLayoutApi::class) @Composable fun MenuModalSheetContent( header: MenuModalSheetHeader = MenuModalSheetHeader.Gone, @@ -97,10 +91,5 @@ fun MenuModalSheetContent( Column { ModalSheetHeaderItem(header = header) buildMenuSheetItems(items = menuItems) - Spacer( - Modifier.windowInsetsBottomHeight( - WindowInsets.navigationBarsIgnoringVisibility - ) - ) } } diff --git a/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingToolPicker.kt b/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingToolPicker.kt index 9d6059a7594..d27a86381af 100644 --- a/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingToolPicker.kt +++ b/features/sketch/src/main/java/com/wire/android/feature/sketch/DrawingToolPicker.kt @@ -24,11 +24,16 @@ import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.navigationBarsIgnoringVisibility import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.windowInsetsBottomHeight import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid @@ -58,6 +63,7 @@ import com.wire.android.ui.common.dimensions import com.wire.android.ui.theme.WireColorPalette import com.wire.android.ui.theme.WireTheme +@OptIn(ExperimentalLayoutApi::class) @Composable fun DrawingToolPicker( sheetState: WireModalSheetState, @@ -107,6 +113,13 @@ fun DrawingToolPicker( } ) } + Spacer( + Modifier + .background(colorsScheme().background) + .windowInsetsBottomHeight( + WindowInsets.navigationBarsIgnoringVisibility + ) + ) } }