From a9160a2f03a5ff8da3c86b29e89450295e6c86fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= Date: Tue, 12 Sep 2023 13:23:36 +0200 Subject: [PATCH 1/4] fix: invisible buttons after WireButton size changes --- .../ui/authentication/devices/DeviceItem.kt | 19 ++++- .../android/ui/common/AddContactButton.kt | 10 +++ .../wire/android/ui/debug/DebugDataOptions.kt | 17 +++- .../conversations/MessageItemComponents.kt | 41 +++++++--- .../home/conversations/SystemMessageItem.kt | 4 +- .../messagetypes/audio/AudioMessageType.kt | 19 ++++- .../search/SearchAllPeopleScreen.kt | 10 +++ .../common/MutedConversationBadge.kt | 5 +- .../search/SearchConversationScreen.kt | 10 +++ .../recordaudio/RecordAudioButtons.kt | 82 +++++++++++++++++-- .../other/OtherUserProfileGroup.kt | 14 ++++ .../userprofile/self/SelfUserProfileScreen.kt | 10 +++ 12 files changed, 210 insertions(+), 31 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt index a6b422e9d94..4b392bd226b 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt @@ -68,6 +68,7 @@ import com.wire.android.ui.theme.wireTypography import com.wire.android.util.extension.formatAsFingerPrint import com.wire.android.util.extension.formatAsString import com.wire.android.util.formatMediumDateTime +import com.wire.android.util.ui.PreviewMultipleThemes import com.wire.android.util.ui.UIText @Composable @@ -260,7 +261,8 @@ fun VerifyLabel(isVerified: Boolean, modifier: Modifier = Modifier) { Text( text = stringResource(id = if (isVerified) R.string.label_client_verified else R.string.label_client_unverified), color = if (isVerified) MaterialTheme.wireColorScheme.primary else MaterialTheme.wireColorScheme.secondaryText, - style = MaterialTheme.wireTypography.label03.copy(textAlign = TextAlign.Center), + style = MaterialTheme.wireTypography.label03, + textAlign = TextAlign.Center, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier @@ -283,3 +285,18 @@ fun PreviewDeviceItem() { ) {} } } + +@PreviewMultipleThemes +@Composable +fun PreviewDeviceItemContent() { + DeviceItemContent( + device = Device(name = UIText.DynamicString("name")), + placeholder = false, + shouldShowVerifyLabel = true, + background = null, + isWholeItemClickable = false, + onRemoveDeviceClick = null, + leadingIcon = { Icon(painter = painterResource(id = R.drawable.ic_remove), contentDescription = "") }, + leadingIconBorder = 1.dp, + ) +} diff --git a/app/src/main/kotlin/com/wire/android/ui/common/AddContactButton.kt b/app/src/main/kotlin/com/wire/android/ui/common/AddContactButton.kt index 02499f97acc..f7be56aa94c 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/AddContactButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/AddContactButton.kt @@ -32,7 +32,9 @@ import androidx.compose.ui.unit.dp import com.wire.android.R import com.wire.android.ui.common.button.IconAlignment import com.wire.android.ui.common.button.WireSecondaryButton +import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireDimensions +import com.wire.android.util.ui.PreviewMultipleThemes @Composable fun AddContactButton( @@ -56,3 +58,11 @@ fun AddContactButton( modifier = modifier ) } + +@PreviewMultipleThemes +@Composable +fun PreviewAddContactButton() { + WireTheme { + AddContactButton(onIconClicked = {}) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt b/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt index fefb6a4e1e7..0a594a1f423 100644 --- a/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt +++ b/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt @@ -45,6 +45,7 @@ import com.wire.android.ui.common.button.WirePrimaryButton import com.wire.android.ui.common.dimensions import com.wire.android.ui.home.conversationslist.common.FolderHeader import com.wire.android.ui.home.settings.SettingsItem +import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireColorScheme import com.wire.android.ui.theme.wireDimensions import com.wire.android.ui.theme.wireTypography @@ -289,8 +290,8 @@ private fun ManualMigrationOptions( }, actions = { WirePrimaryButton( - minSize = MaterialTheme.wireDimensions.buttonMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, + minSize = MaterialTheme.wireDimensions.buttonMediumMinSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMediumMinClickableSize, onClick = onManualMigrationClicked, text = stringResource(R.string.start_manual_migration), fillMaxWidth = false @@ -425,7 +426,7 @@ private fun EnableEncryptedProteusStorageSwitch( enabled = !isEnabled, modifier = Modifier .padding(end = dimensions().spacing8x) - .size(dimensions().buttonSmallMinSize) + .size(width = dimensions().buttonSmallMinSize.width, height = dimensions().buttonSmallMinSize.height) ) } ) @@ -454,3 +455,13 @@ fun PreviewOtherDebugOptions() { onManualMigrationPressed = {} ) } + +@PreviewMultipleThemes +@Composable +fun PreviewDevelopmentApiVersioningOptions() { + WireTheme { + DevelopmentApiVersioningOptions( + onForceLatestDevelopmentApiChange = {} + ) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItemComponents.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItemComponents.kt index fe1585ce684..3f3e1281687 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItemComponents.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItemComponents.kt @@ -7,8 +7,6 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.MaterialTheme @@ -39,7 +37,10 @@ import com.wire.android.ui.theme.wireColorScheme import com.wire.android.util.CustomTabsHelper import com.wire.android.util.EMPTY import com.wire.android.util.ui.PreviewMultipleThemes +import com.wire.android.util.ui.UIText import com.wire.kalium.logic.data.user.UserId +import kotlinx.collections.immutable.persistentListOf +import kotlinx.collections.immutable.persistentMapOf @Composable internal fun MessageSendFailureWarning( @@ -54,7 +55,8 @@ internal fun MessageSendFailureWarning( VerticalSpace.x4() Text( text = messageStatus.errorText.asString(), - style = LocalTextStyle.current.copy(color = MaterialTheme.colorScheme.error) + style = LocalTextStyle.current, + color = MaterialTheme.colorScheme.error ) if (messageStatus is MessageFlowStatus.Failure.Send.Remotely) { OfflineBackendsLearnMoreLink() @@ -151,9 +153,6 @@ private fun MultiUserDeliveryFailure( minClickableSize = dimensions().buttonSmallMinClickableSize, shape = RoundedCornerShape(size = dimensions().corner12x), contentPadding = PaddingValues(horizontal = dimensions().spacing12x, vertical = dimensions().spacing8x), - modifier = Modifier - .padding(top = dimensions().spacing4x) - .height(height = dimensions().spacing32x) ) } } @@ -212,21 +211,22 @@ internal fun MessageDecryptionFailure( VerticalSpace.x4() Text( text = decryptionStatus.errorText.asString(), - style = LocalTextStyle.current.copy(color = MaterialTheme.colorScheme.error) + style = LocalTextStyle.current, + color = MaterialTheme.colorScheme.error ) Text( modifier = Modifier .clickable { CustomTabsHelper.launchUrl(context, learnMoreUrl) }, - style = LocalTextStyle.current.copy( - color = MaterialTheme.wireColorScheme.onTertiaryButtonSelected, - textDecoration = TextDecoration.Underline - ), + style = LocalTextStyle.current, + textDecoration = TextDecoration.Underline, + color = MaterialTheme.wireColorScheme.onTertiaryButtonSelected, text = stringResource(R.string.label_learn_more) ) VerticalSpace.x4() Text( text = stringResource(R.string.label_message_decryption_failure_informative_message), - style = LocalTextStyle.current.copy(color = MaterialTheme.colorScheme.error) + style = LocalTextStyle.current, + color = MaterialTheme.colorScheme.error ) if (!decryptionStatus.isDecryptionResolved) { Row { @@ -293,3 +293,20 @@ fun PreviewMessageDecryptionFailure() { MessageDecryptionFailure(mockHeader, MessageFlowStatus.Failure.Decryption(false)) { _, _ -> } } } + +@PreviewMultipleThemes +@Composable +fun PreviewMultiUserDeliveryFailure() { + WireTheme { + MultiUserDeliveryFailure( + DeliveryStatusContent.PartialDelivery( + failedRecipients = persistentListOf(UIText.DynamicString("username")), + noClients = persistentMapOf( + "iOS" to listOf(UIText.DynamicString("ios")), + "Android" to listOf(UIText.DynamicString("android")) + ), + ), + LocalContext.current.resources + ) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt index ea58c24d32e..6357c7f7280 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt @@ -61,6 +61,7 @@ import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.unit.DpSize import com.wire.android.R import com.wire.android.ui.common.button.WireSecondaryButton import com.wire.android.ui.common.colorsScheme @@ -183,9 +184,6 @@ fun SystemMessageItem( minClickableSize = dimensions().buttonSmallMinClickableSize, shape = RoundedCornerShape(size = dimensions().corner12x), contentPadding = PaddingValues(horizontal = dimensions().spacing12x, vertical = dimensions().spacing8x), - modifier = Modifier - .padding(top = dimensions().spacing4x) - .height(height = dimensions().spacing32x) ) } if (message.sendingFailed) { diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/audio/AudioMessageType.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/audio/AudioMessageType.kt index ad2a75092b3..9b7bb477697 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/audio/AudioMessageType.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/audio/AudioMessageType.kt @@ -41,7 +41,9 @@ import com.wire.android.ui.common.colorsScheme import com.wire.android.ui.common.dimensions import com.wire.android.ui.common.progress.WireCircularProgressIndicator import com.wire.android.ui.common.spacers.HorizontalSpace +import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireColorScheme +import com.wire.android.util.ui.PreviewMultipleThemes @Composable fun AudioMessage( @@ -159,7 +161,8 @@ private fun SuccessfulAudioMessage( } else { Text( text = audioDuration.formattedTimeLeft(), - style = MaterialTheme.typography.labelSmall.copy(color = MaterialTheme.wireColorScheme.secondaryText), + style = MaterialTheme.typography.labelSmall, + color = MaterialTheme.wireColorScheme.secondaryText, maxLines = 1 ) } @@ -249,3 +252,17 @@ private data class AudioDuration(val totalDurationInMs: AudioState.TotalTimeInMs return UNKNOWN_DURATION_LABEL } } + +@PreviewMultipleThemes +@Composable +private fun PreviewSuccessfulAudioMessage() { + WireTheme { + SuccessfulAudioMessage( + audioMediaPlayingState = AudioMediaPlayingState.Completed, + totalTimeInMs = AudioState.TotalTimeInMs.Known(10000), + currentPositionInMs = 5000, + onPlayButtonClick = {}, + onSliderPositionChange = {} + ) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchAllPeopleScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchAllPeopleScreen.kt index f0ae7127650..b1fab342b7b 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchAllPeopleScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchAllPeopleScreen.kt @@ -48,7 +48,9 @@ import com.wire.android.ui.common.dimensions import com.wire.android.ui.common.progress.WireCircularProgressIndicator import com.wire.android.ui.home.conversations.search.widget.SearchFailureBox import com.wire.android.ui.home.newconversation.model.Contact +import com.wire.android.ui.theme.WireTheme import com.wire.android.util.extension.folderWithElements +import com.wire.android.util.ui.PreviewMultipleThemes private const val DEFAULT_SEARCH_RESULT_ITEM_SIZE = 4 @@ -364,3 +366,11 @@ private fun ShowButton( } } } + +@PreviewMultipleThemes +@Composable +fun PreviewShowButton() { + WireTheme { + ShowButton(isShownAll = false, onShowButtonClicked = {}) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/MutedConversationBadge.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/MutedConversationBadge.kt index c4c030956ba..23dbefc08bb 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/MutedConversationBadge.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/MutedConversationBadge.kt @@ -32,6 +32,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp import com.wire.android.R import com.wire.android.ui.common.button.WireSecondaryButton @@ -54,8 +55,8 @@ fun MutedConversationBadge(onClick: () -> Unit) { ) }, fillMaxWidth = false, - minSize = dimensions().badgeSmallMinSize, - minClickableSize = dimensions().badgeSmallMinClickableSize, + minSize = DpSize(width = dimensions().spacing24x, height = dimensions().spacing18x), + minClickableSize = DpSize(width = dimensions().spacing24x, height = dimensions().spacing18x), shape = RoundedCornerShape(size = dimensions().spacing6x), contentPadding = PaddingValues(0.dp), ) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt index 56175a7075b..fac04755c1f 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt @@ -40,8 +40,10 @@ import com.wire.android.ui.common.spacers.VerticalSpace import com.wire.android.ui.home.conversationslist.common.ConversationList import com.wire.android.ui.home.conversationslist.model.ConversationFolder import com.wire.android.ui.home.conversationslist.model.ConversationItem +import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireColorScheme import com.wire.android.ui.theme.wireTypography +import com.wire.android.util.ui.PreviewMultipleThemes import com.wire.kalium.logic.data.id.ConversationId import com.wire.kalium.logic.data.user.UserId import kotlinx.collections.immutable.ImmutableMap @@ -112,3 +114,11 @@ private fun EmptySearchResult(onNewConversationCLick: () -> Unit) { ) } } + +@PreviewMultipleThemes +@Composable +fun PreviewEmptySearchResult() { + WireTheme { + EmptySearchResult(onNewConversationCLick = {}) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt index c2672c7e28c..554b4e4cb21 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt @@ -42,10 +42,12 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.sp import com.wire.android.R +import com.wire.android.media.audiomessage.AudioMediaPlayingState import com.wire.android.media.audiomessage.AudioState import com.wire.android.ui.common.button.WireButtonState import com.wire.android.ui.common.button.WireSecondaryButton @@ -54,8 +56,10 @@ import com.wire.android.ui.common.button.wireSecondaryButtonColors import com.wire.android.ui.common.colorsScheme import com.wire.android.ui.common.dimensions import com.wire.android.ui.home.conversations.model.messagetypes.audio.RecordedAudioMessage +import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireDimensions import com.wire.android.ui.theme.wireTypography +import com.wire.android.util.ui.PreviewMultipleThemes import kotlinx.coroutines.delay import java.io.File @@ -105,12 +109,14 @@ fun RecordAudioButtonRecording( seconds += 1 } } - val activity = LocalContext.current as Activity + if (!LocalInspectionMode.current) { + val activity = LocalContext.current as Activity - DisposableEffect(Unit) { - activity.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) - onDispose { - activity.window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + DisposableEffect(Unit) { + activity.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + onDispose { + activity.window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + } } } @@ -120,9 +126,8 @@ fun RecordAudioButtonRecording( topContent = { Text( text = DateUtils.formatElapsedTime(seconds.toLong()), - style = MaterialTheme.wireTypography.body01.copy( - fontSize = 32.sp - ), + style = MaterialTheme.wireTypography.body01, + fontSize = 32.sp, color = colorsScheme().secondaryText ) }, @@ -167,7 +172,7 @@ fun RecordAudioButtonSend( } @Composable -fun RecordAudioButton( +private fun RecordAudioButton( onClick: () -> Unit, modifier: Modifier, topContent: @Composable () -> Unit, @@ -210,3 +215,62 @@ fun RecordAudioButton( ) } } + +@PreviewMultipleThemes +@Composable +fun PreviewRecordAudioButtonClose() { + WireTheme { + RecordAudioButtonClose(onClick = {}, modifier = Modifier) + } +} + +@PreviewMultipleThemes +@Composable +fun PreviewRecordAudioButtonEnabled() { + WireTheme { + RecordAudioButtonEnabled(onClick = {}, modifier = Modifier) + } +} + +@PreviewMultipleThemes +@Composable +fun PreviewRecordAudioButtonRecording() { + WireTheme { + RecordAudioButtonRecording(onClick = {}, modifier = Modifier) + } +} + +@PreviewMultipleThemes +@Composable +fun PreviewRecordAudioButtonSend() { + WireTheme { + RecordAudioButtonSend( + audioState = AudioState( + audioMediaPlayingState = AudioMediaPlayingState.Paused, + totalTimeInMs = AudioState.TotalTimeInMs.Known(1000), + currentPositionInMs = 0 + ), + onClick = {}, + modifier = Modifier, + outputFile = null, + onPlayAudio = {}, + onSliderPositionChange = {} + ) + } +} + +@PreviewMultipleThemes +@Composable +fun PreviewRecordAudioButton() { + WireTheme { + RecordAudioButton( + onClick = {}, + modifier = Modifier, + topContent = {}, + iconResId = R.drawable.ic_microphone_on, + contentDescription = R.string.content_description_record_audio_button_start, + buttonColor = colorsScheme().recordAudioStartColor, + bottomText = R.string.record_audio_start_label + ) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileGroup.kt b/app/src/main/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileGroup.kt index 385719b4189..4b18a454320 100644 --- a/app/src/main/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileGroup.kt +++ b/app/src/main/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileGroup.kt @@ -44,10 +44,12 @@ import com.wire.android.ui.common.button.WireButton import com.wire.android.ui.common.button.WireSecondaryIconButton import com.wire.android.ui.common.dimensions import com.wire.android.ui.home.conversationslist.model.allowsRoleEdition +import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireColorScheme import com.wire.android.ui.theme.wireDimensions import com.wire.android.ui.theme.wireTypography import com.wire.android.ui.userprofile.group.RemoveConversationMemberState +import com.wire.android.util.ui.PreviewMultipleThemes import com.wire.android.util.ui.UIText import com.wire.android.util.ui.stringWithStyledArgs import com.wire.kalium.logic.data.conversation.Conversation.Member @@ -184,3 +186,15 @@ val Member.Role.name fun PreviewOtherUserProfileGroup() { OtherUserProfileGroup(OtherUserProfileState.PREVIEW, rememberLazyListState(), {}) {} } + +@Composable +@PreviewMultipleThemes +fun PreviewUserGroupDetailsInformation() { + WireTheme { + UserGroupDetailsInformation( + title = AnnotatedString("Group name"), + isSelfAdmin = true, + onRemoveFromConversation = {} + ) + } +} diff --git a/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt b/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt index 30feb214684..c1ef450a8a2 100644 --- a/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt @@ -82,6 +82,7 @@ import com.wire.android.ui.destinations.WelcomeScreenDestination import com.wire.android.ui.home.conversations.search.HighlightName import com.wire.android.ui.home.conversations.search.HighlightSubtitle import com.wire.android.ui.home.conversationslist.common.FolderHeader +import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireDimensions import com.wire.android.ui.userprofile.common.EditableState import com.wire.android.ui.userprofile.common.UserProfileInfo @@ -91,6 +92,7 @@ import com.wire.android.ui.userprofile.self.dialog.ChangeStatusDialogContent import com.wire.android.ui.userprofile.self.dialog.LogoutOptionsDialog import com.wire.android.ui.userprofile.self.dialog.LogoutOptionsDialogState import com.wire.android.ui.userprofile.self.model.OtherAccount +import com.wire.android.util.ui.PreviewMultipleThemes import com.wire.kalium.logic.data.user.UserAvailabilityStatus import com.wire.kalium.logic.data.user.UserId @@ -436,3 +438,11 @@ fun PreviewSelfUserProfileScreen() { fun PreviewCurrentSelfUserStatus() { CurrentSelfUserStatus(UserAvailabilityStatus.AVAILABLE, onStatusClicked = {}) } + +@Composable +@PreviewMultipleThemes +fun PreviewSelfUserProfileTopBar() { + WireTheme { + SelfUserProfileTopBar(onCloseClick = {}, onLogoutClick = {}) + } +} From a50e3d372dee9ef05daaba8caff2858d0da12a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= Date: Tue, 12 Sep 2023 13:24:22 +0200 Subject: [PATCH 2/4] remove unused import --- .../com/wire/android/ui/home/conversations/SystemMessageItem.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt index 6357c7f7280..aca4050d7c5 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt @@ -61,7 +61,6 @@ import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.style.TextDecoration -import androidx.compose.ui.unit.DpSize import com.wire.android.R import com.wire.android.ui.common.button.WireSecondaryButton import com.wire.android.ui.common.colorsScheme From b8df5ae31f08780a33bd5838cf49849da1fa5e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= Date: Tue, 12 Sep 2023 13:40:20 +0200 Subject: [PATCH 3/4] remove duplicated preview and detekt issue --- .../ui/authentication/devices/DeviceItem.kt | 21 +++---------------- .../search/SearchConversationScreen.kt | 1 - 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt index 4b392bd226b..5f13df8bd16 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt @@ -51,7 +51,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.wire.android.BuildConfig @@ -62,6 +61,7 @@ import com.wire.android.ui.common.button.WireSecondaryButton import com.wire.android.ui.common.button.getMinTouchMargins import com.wire.android.ui.common.button.wireSecondaryButtonColors import com.wire.android.ui.common.shimmerPlaceholder +import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireColorScheme import com.wire.android.ui.theme.wireDimensions import com.wire.android.ui.theme.wireTypography @@ -272,10 +272,10 @@ fun VerifyLabel(isVerified: Boolean, modifier: Modifier = Modifier) { } } -@Preview(showBackground = true) +@PreviewMultipleThemes @Composable fun PreviewDeviceItem() { - Box(modifier = Modifier.fillMaxWidth()) { + WireTheme { DeviceItem( device = Device(name = UIText.DynamicString("name")), placeholder = false, @@ -285,18 +285,3 @@ fun PreviewDeviceItem() { ) {} } } - -@PreviewMultipleThemes -@Composable -fun PreviewDeviceItemContent() { - DeviceItemContent( - device = Device(name = UIText.DynamicString("name")), - placeholder = false, - shouldShowVerifyLabel = true, - background = null, - isWholeItemClickable = false, - onRemoveDeviceClick = null, - leadingIcon = { Icon(painter = painterResource(id = R.drawable.ic_remove), contentDescription = "") }, - leadingIconBorder = 1.dp, - ) -} diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt index fac04755c1f..5e6cbd86eb8 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt @@ -48,7 +48,6 @@ import com.wire.kalium.logic.data.id.ConversationId import com.wire.kalium.logic.data.user.UserId import kotlinx.collections.immutable.ImmutableMap - @Composable fun SearchConversationScreen( searchQuery: String, From d07201e9d916b11e5b893232b8c122db1255e69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Saleniuk?= Date: Tue, 12 Sep 2023 16:17:06 +0200 Subject: [PATCH 4/4] calculate clickable size on layout phase, keep only one dimension type --- .../ui/authentication/devices/DeviceItem.kt | 2 +- .../ui/calling/controlbuttons/JoinButton.kt | 2 +- .../android/ui/common/AddContactButton.kt | 2 +- .../android/ui/common/button/WireButton.kt | 29 ++++++++++--------- .../ui/common/button/WirePrimaryButton.kt | 2 +- .../ui/common/button/WirePrimaryIconButton.kt | 2 +- .../ui/common/button/WireSecondaryButton.kt | 2 +- .../common/button/WireSecondaryIconButton.kt | 2 +- .../common/button/WireTertiaryIconButton.kt | 2 +- .../wire/android/ui/debug/DebugDataOptions.kt | 6 ++-- .../conversations/ConversationTopAppBar.kt | 4 +-- .../conversations/MessageItemComponents.kt | 8 ++--- .../home/conversations/SystemMessageItem.kt | 2 +- .../messagetypes/audio/AudioMessageType.kt | 2 +- .../search/SearchAllPeopleScreen.kt | 2 +- .../search/SearchConversationScreen.kt | 2 +- .../ui/home/messagecomposer/MessageActions.kt | 8 ++--- .../recordaudio/RecordAudioButtons.kt | 2 +- .../wire/android/ui/theme/WireDimensions.kt | 8 +---- .../other/OtherUserProfileGroup.kt | 2 +- .../userprofile/self/SelfUserProfileScreen.kt | 2 +- 21 files changed, 44 insertions(+), 49 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt index 5f13df8bd16..20d962fa787 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt @@ -147,7 +147,7 @@ private fun DeviceItemContent( leadingIcon = leadingIcon, fillMaxWidth = false, minSize = MaterialTheme.wireDimensions.buttonSmallMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonSmallMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, shape = RoundedCornerShape(size = MaterialTheme.wireDimensions.buttonSmallCornerSize), contentPadding = PaddingValues(0.dp), borderWidth = leadingIconBorder, diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/JoinButton.kt b/app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/JoinButton.kt index 357b43230b8..74a8d35e060 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/JoinButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/JoinButton.kt @@ -43,7 +43,7 @@ import com.wire.android.util.permission.rememberCallingRecordAudioBluetoothReque fun JoinButton( buttonClick: () -> Unit, minSize: DpSize = MaterialTheme.wireDimensions.buttonMediumMinSize, - minClickableSize: DpSize = MaterialTheme.wireDimensions.buttonMediumMinClickableSize, + minClickableSize: DpSize = MaterialTheme.wireDimensions.buttonMinClickableSize, horizontalPadding: Dp = MaterialTheme.wireDimensions.spacing8x, ) { val audioPermissionCheck = AudioBluetoothPermissionCheckFlow { buttonClick() } diff --git a/app/src/main/kotlin/com/wire/android/ui/common/AddContactButton.kt b/app/src/main/kotlin/com/wire/android/ui/common/AddContactButton.kt index f7be56aa94c..8dd4e2de6b2 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/AddContactButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/AddContactButton.kt @@ -52,7 +52,7 @@ fun AddContactButton( leadingIconAlignment = IconAlignment.Center, fillMaxWidth = false, minSize = MaterialTheme.wireDimensions.buttonSmallMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonSmallMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, shape = RoundedCornerShape(12.dp), contentPadding = PaddingValues(horizontal = 8.dp, vertical = 4.dp), modifier = modifier diff --git a/app/src/main/kotlin/com/wire/android/ui/common/button/WireButton.kt b/app/src/main/kotlin/com/wire/android/ui/common/button/WireButton.kt index d47f6b682b4..8bdf57d4665 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/button/WireButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/button/WireButton.kt @@ -41,7 +41,6 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider -import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -49,6 +48,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.layout.layout import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalViewConfiguration @@ -56,7 +56,6 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.max import com.wire.android.model.ClickBlockParams import com.wire.android.ui.common.Tint import com.wire.android.ui.common.progress.WireCircularProgressIndicator @@ -64,6 +63,7 @@ import com.wire.android.ui.common.rememberClickBlockAction import com.wire.android.ui.theme.wireDimensions import com.wire.android.ui.theme.wireTypography import java.lang.Integer.max +import kotlin.math.roundToInt @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -105,24 +105,25 @@ fun WireButton( disabledContentColor = colors.rippleColor(), ) val onClickWithSyncObserver = rememberClickBlockAction(clickBlockParams, onClick) - var currentSize by remember { mutableStateOf(minSize) } - val currentPadding by remember { - derivedStateOf { - PaddingValues( - horizontal = max(0.dp, (minClickableSize.width - currentSize.width) / 2), - vertical = max(0.dp, (minClickableSize.height - currentSize.height) / 2), - ) - } - } - val density = LocalDensity.current CompositionLocalProvider(LocalMinimumInteractiveComponentEnforcement provides false) { Button( onClick = onClickWithSyncObserver, modifier = modifier .let { if (fillMaxWidth) it.fillMaxWidth() else it.wrapContentWidth() } - .padding(currentPadding) .sizeIn(minHeight = minSize.height, minWidth = minSize.width) - .onGloballyPositioned { with(density) { currentSize = DpSize(it.size.width.toDp(), it.size.height.toDp()) } }, + .layout { measurable, constraints -> + val placeable = measurable.measure(constraints) + + // Be at least as big as the minimum dimension in both dimensions + val width = maxOf(placeable.width, minClickableSize.width.roundToPx()) + val height = maxOf(placeable.height, minClickableSize.height.roundToPx()) + + layout(width, height) { + val centerX = ((width - placeable.width) / 2f).roundToInt() + val centerY = ((height - placeable.height) / 2f).roundToInt() + placeable.place(centerX, centerY) + } + }, enabled = state != WireButtonState.Disabled, interactionSource = interactionSource, elevation = elevation, diff --git a/app/src/main/kotlin/com/wire/android/ui/common/button/WirePrimaryButton.kt b/app/src/main/kotlin/com/wire/android/ui/common/button/WirePrimaryButton.kt index 12a63ec210f..11635939a81 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/button/WirePrimaryButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/button/WirePrimaryButton.kt @@ -134,7 +134,7 @@ fun PreviewWirePrimaryButtonSmallOnlyIcons() { leadingIconAlignment = IconAlignment.Center, fillMaxWidth = false, minSize = MaterialTheme.wireDimensions.buttonSmallMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonSmallMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, shape = RoundedCornerShape(12.dp), contentPadding = PaddingValues(horizontal = 8.dp, vertical = 4.dp) ) diff --git a/app/src/main/kotlin/com/wire/android/ui/common/button/WirePrimaryIconButton.kt b/app/src/main/kotlin/com/wire/android/ui/common/button/WirePrimaryIconButton.kt index d75b3a29ad0..51e89454868 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/button/WirePrimaryIconButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/button/WirePrimaryIconButton.kt @@ -48,7 +48,7 @@ fun WirePrimaryIconButton( @StringRes contentDescription: Int, shape: Shape = RoundedCornerShape(MaterialTheme.wireDimensions.buttonCornerSize), minSize: DpSize = MaterialTheme.wireDimensions.buttonSmallMinSize, - minClickableSize: DpSize = MaterialTheme.wireDimensions.buttonSmallMinClickableSize, + minClickableSize: DpSize = MaterialTheme.wireDimensions.buttonMinClickableSize, state: WireButtonState = WireButtonState.Default, colors: WireButtonColors = wirePrimaryButtonColors(), clickBlockParams: ClickBlockParams = ClickBlockParams(), diff --git a/app/src/main/kotlin/com/wire/android/ui/common/button/WireSecondaryButton.kt b/app/src/main/kotlin/com/wire/android/ui/common/button/WireSecondaryButton.kt index 8db3bc1263c..38f1bbb99ad 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/button/WireSecondaryButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/button/WireSecondaryButton.kt @@ -133,7 +133,7 @@ fun PreviewWireSecondaryButtonSmallOnlyIcons() { leadingIconAlignment = IconAlignment.Center, fillMaxWidth = false, minSize = MaterialTheme.wireDimensions.buttonSmallMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonMediumMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, shape = RoundedCornerShape(12.dp), contentPadding = PaddingValues(horizontal = 8.dp, vertical = 4.dp) ) diff --git a/app/src/main/kotlin/com/wire/android/ui/common/button/WireSecondaryIconButton.kt b/app/src/main/kotlin/com/wire/android/ui/common/button/WireSecondaryIconButton.kt index e01427cdd34..3df09716aed 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/button/WireSecondaryIconButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/button/WireSecondaryIconButton.kt @@ -49,7 +49,7 @@ fun WireSecondaryIconButton( @StringRes contentDescription: Int, shape: Shape = RoundedCornerShape(MaterialTheme.wireDimensions.buttonCornerSize), minSize: DpSize = MaterialTheme.wireDimensions.buttonSmallMinSize, - minClickableSize: DpSize = MaterialTheme.wireDimensions.buttonSmallMinClickableSize, + minClickableSize: DpSize = MaterialTheme.wireDimensions.buttonMinClickableSize, iconSize: Dp = dimensions().wireIconButtonSize, state: WireButtonState = WireButtonState.Default, colors: WireButtonColors = wireSecondaryButtonColors(), diff --git a/app/src/main/kotlin/com/wire/android/ui/common/button/WireTertiaryIconButton.kt b/app/src/main/kotlin/com/wire/android/ui/common/button/WireTertiaryIconButton.kt index 2b72ae8f1e7..96da01fcf8f 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/button/WireTertiaryIconButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/button/WireTertiaryIconButton.kt @@ -48,7 +48,7 @@ fun WireTertiaryIconButton( @StringRes contentDescription: Int, shape: Shape = RoundedCornerShape(MaterialTheme.wireDimensions.buttonCornerSize), minSize: DpSize = MaterialTheme.wireDimensions.buttonSmallMinSize, - minClickableSize: DpSize = MaterialTheme.wireDimensions.buttonSmallMinClickableSize, + minClickableSize: DpSize = MaterialTheme.wireDimensions.buttonMinClickableSize, state: WireButtonState = WireButtonState.Default, colors: WireButtonColors = wireTertiaryButtonColors(), clickBlockParams: ClickBlockParams = ClickBlockParams(), diff --git a/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt b/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt index 0a594a1f423..8382a0b5e18 100644 --- a/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt +++ b/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt @@ -291,7 +291,7 @@ private fun ManualMigrationOptions( actions = { WirePrimaryButton( minSize = MaterialTheme.wireDimensions.buttonMediumMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonMediumMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, onClick = onManualMigrationClicked, text = stringResource(R.string.start_manual_migration), fillMaxWidth = false @@ -320,7 +320,7 @@ private fun DevelopmentApiVersioningOptions( actions = { WirePrimaryButton( minSize = MaterialTheme.wireDimensions.buttonMediumMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonMediumMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, onClick = onForceLatestDevelopmentApiChange, text = stringResource(R.string.debug_settings_force_api_versioning_update_button_text), fillMaxWidth = false @@ -381,7 +381,7 @@ private fun MLSOptions( actions = { WirePrimaryButton( minSize = MaterialTheme.wireDimensions.buttonMediumMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonMediumMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, onClick = restartSlowSyncForRecovery, text = stringResource(R.string.restart_slowsync_for_recovery_button), fillMaxWidth = false diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/ConversationTopAppBar.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/ConversationTopAppBar.kt index e8e5b144f2e..84a071f6d60 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/ConversationTopAppBar.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/ConversationTopAppBar.kt @@ -169,7 +169,7 @@ private fun ConversationScreenTopAppBarContent( minSize = dimensions().buttonSmallMinSize, minClickableSize = DpSize( dimensions().buttonSmallMinSize.width, - dimensions().buttonSmallMinClickableSize.height + dimensions().buttonMinClickableSize.height ), ) } @@ -237,7 +237,7 @@ private fun callControlButton( contentDescription = R.string.content_description_conversation_phone_icon, state = if (isCallingEnabled) WireButtonState.Default else WireButtonState.Disabled, minSize = dimensions().buttonSmallMinSize, - minClickableSize = DpSize(dimensions().buttonSmallMinSize.width, dimensions().buttonSmallMinClickableSize.height), + minClickableSize = DpSize(dimensions().buttonSmallMinSize.width, dimensions().buttonMinClickableSize.height), ) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItemComponents.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItemComponents.kt index 3f3e1281687..eeea3db6068 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItemComponents.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/MessageItemComponents.kt @@ -66,7 +66,7 @@ internal fun MessageSendFailureWarning( text = stringResource(R.string.label_retry), onClick = onRetryClick, minSize = dimensions().buttonSmallMinSize, - minClickableSize = dimensions().buttonSmallMinClickableSize, + minClickableSize = dimensions().buttonMinClickableSize, fillMaxWidth = false ) HorizontalSpace.x8() @@ -74,7 +74,7 @@ internal fun MessageSendFailureWarning( text = stringResource(R.string.label_cancel), onClick = onCancelClick, minSize = dimensions().buttonSmallMinSize, - minClickableSize = dimensions().buttonSmallMinClickableSize, + minClickableSize = dimensions().buttonMinClickableSize, fillMaxWidth = false ) } @@ -150,7 +150,7 @@ private fun MultiUserDeliveryFailure( text = stringResource(if (expanded) R.string.label_hide_details else R.string.label_show_details), fillMaxWidth = false, minSize = dimensions().buttonSmallMinSize, - minClickableSize = dimensions().buttonSmallMinClickableSize, + minClickableSize = dimensions().buttonMinClickableSize, shape = RoundedCornerShape(size = dimensions().corner12x), contentPadding = PaddingValues(horizontal = dimensions().spacing12x, vertical = dimensions().spacing8x), ) @@ -241,7 +241,7 @@ internal fun MessageDecryptionFailure( } }, minSize = dimensions().buttonSmallMinSize, - minClickableSize = dimensions().buttonSmallMinClickableSize, + minClickableSize = dimensions().buttonMinClickableSize, fillMaxWidth = false ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt index aca4050d7c5..fddd9e8feae 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/SystemMessageItem.kt @@ -180,7 +180,7 @@ fun SystemMessageItem( text = stringResource(if (expanded) R.string.label_show_less else R.string.label_show_all), fillMaxWidth = false, minSize = dimensions().buttonSmallMinSize, - minClickableSize = dimensions().buttonSmallMinClickableSize, + minClickableSize = dimensions().buttonMinClickableSize, shape = RoundedCornerShape(size = dimensions().corner12x), contentPadding = PaddingValues(horizontal = dimensions().spacing12x, vertical = dimensions().spacing8x), ) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/audio/AudioMessageType.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/audio/AudioMessageType.kt index 9b7bb477697..728b5767c01 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/audio/AudioMessageType.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/audio/AudioMessageType.kt @@ -135,7 +135,7 @@ private fun SuccessfulAudioMessage( ) { WireSecondaryIconButton( minSize = dimensions().buttonSmallMinSize, - minClickableSize = dimensions().buttonSmallMinClickableSize, + minClickableSize = dimensions().buttonMinClickableSize, iconSize = dimensions().spacing12x, iconResource = getPlayOrPauseIcon(audioMediaPlayingState), shape = CircleShape, diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchAllPeopleScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchAllPeopleScreen.kt index b1fab342b7b..91a8d1c481e 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchAllPeopleScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchAllPeopleScreen.kt @@ -360,7 +360,7 @@ private fun ShowButton( text = if (!showAll) stringResource(R.string.label_show_more) else stringResource(R.string.label_show_less), onClick = onShowButtonClicked, minSize = dimensions().buttonSmallMinSize, - minClickableSize = dimensions().buttonSmallMinClickableSize, + minClickableSize = dimensions().buttonMinClickableSize, fillMaxWidth = false, ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt index 5e6cbd86eb8..311e3ee096a 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/search/SearchConversationScreen.kt @@ -108,7 +108,7 @@ private fun EmptySearchResult(onNewConversationCLick: () -> Unit) { text = stringResource(R.string.label_new_conversation), fillMaxWidth = false, minSize = dimensions().buttonSmallMinSize, - minClickableSize = dimensions().buttonSmallMinClickableSize, + minClickableSize = dimensions().buttonMinClickableSize, onClick = onNewConversationCLick ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/MessageActions.kt b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/MessageActions.kt index 30861003133..a8996007906 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/MessageActions.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/MessageActions.kt @@ -93,7 +93,7 @@ fun SelfDeletingActions( colors = wireSendPrimaryButtonColors(), clickBlockParams = ClickBlockParams(blockWhenSyncing = true, blockWhenConnecting = false), minSize = MaterialTheme.wireDimensions.buttonCircleMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonCircleMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, ) } } @@ -121,7 +121,7 @@ fun MessageEditActions( contentDescription = R.string.content_description_close_button, shape = CircleShape, minSize = MaterialTheme.wireDimensions.buttonCircleMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonCircleMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, ) } Spacer(modifier = Modifier.weight(1f)) @@ -138,7 +138,7 @@ fun MessageEditActions( clickBlockParams = ClickBlockParams(blockWhenSyncing = true, blockWhenConnecting = false), shape = CircleShape, minSize = MaterialTheme.wireDimensions.buttonCircleMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonCircleMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, ) } } @@ -158,7 +158,7 @@ private fun SendButton( colors = wireSendPrimaryButtonColors(), clickBlockParams = ClickBlockParams(blockWhenSyncing = true, blockWhenConnecting = false), minSize = MaterialTheme.wireDimensions.buttonCircleMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonCircleMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt index 554b4e4cb21..50c43bde786 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt @@ -74,7 +74,7 @@ fun RecordAudioButtonClose( contentDescription = R.string.content_description_close_button, shape = CircleShape, minSize = MaterialTheme.wireDimensions.buttonCircleMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonCircleMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, modifier = modifier ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/theme/WireDimensions.kt b/app/src/main/kotlin/com/wire/android/ui/theme/WireDimensions.kt index f3ee927a287..9162db37502 100644 --- a/app/src/main/kotlin/com/wire/android/ui/theme/WireDimensions.kt +++ b/app/src/main/kotlin/com/wire/android/ui/theme/WireDimensions.kt @@ -96,9 +96,6 @@ data class WireDimensions( val buttonMediumMinSize: DpSize, val buttonCircleMinSize: DpSize, val buttonMinClickableSize: DpSize, - val buttonSmallMinClickableSize: DpSize, - val buttonMediumMinClickableSize: DpSize, - val buttonCircleMinClickableSize: DpSize, val buttonHorizontalContentPadding: Dp, val buttonVerticalContentPadding: Dp, val buttonCornerSize: Dp, @@ -249,10 +246,7 @@ private val DefaultPhonePortraitWireDimensions: WireDimensions = WireDimensions( buttonSmallMinSize = DpSize(40.dp, 32.dp), buttonMediumMinSize = DpSize(51.dp, 32.dp), buttonCircleMinSize = DpSize(40.dp, 40.dp), - buttonMinClickableSize = DpSize(60.dp, 48.dp), - buttonMediumMinClickableSize = DpSize(51.dp, 48.dp), - buttonSmallMinClickableSize = DpSize(48.dp, 48.dp), - buttonCircleMinClickableSize = DpSize(48.dp, 48.dp), + buttonMinClickableSize = DpSize(48.dp, 48.dp), buttonHorizontalContentPadding = 16.dp, buttonVerticalContentPadding = 8.dp, buttonCornerSize = 12.dp, diff --git a/app/src/main/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileGroup.kt b/app/src/main/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileGroup.kt index 4b18a454320..5fa3f6ca592 100644 --- a/app/src/main/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileGroup.kt +++ b/app/src/main/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileGroup.kt @@ -120,7 +120,7 @@ private fun UserGroupDetailsInformation( WireButton( text = stringResource(id = R.string.user_profile_group_remove_button), minSize = MaterialTheme.wireDimensions.buttonSmallMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonSmallMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, fillMaxWidth = false, onClick = onRemoveFromConversation ) diff --git a/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt b/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt index c1ef450a8a2..b0e3a827e3d 100644 --- a/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt @@ -282,7 +282,7 @@ private fun SelfUserProfileTopBar( text = stringResource(R.string.user_profile_logout), fillMaxWidth = false, minSize = MaterialTheme.wireDimensions.buttonSmallMinSize, - minClickableSize = MaterialTheme.wireDimensions.buttonSmallMinClickableSize, + minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize, state = WireButtonState.Error, clickBlockParams = ClickBlockParams(blockWhenSyncing = false, blockWhenConnecting = false), )