diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/home/StartConversation.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/home/StartConversation.kt index 3acc1173f6..f00fbf44a9 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/home/StartConversation.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/home/StartConversation.kt @@ -43,8 +43,6 @@ internal fun StartConversationScreen( delegate: StartConversationDelegate ) { val context = LocalContext.current - val newMessageTitleTxt:String = context.resources.getQuantityString(R.plurals.messageNew, 1, 1) - Column(modifier = Modifier.background( LocalColors.current.backgroundSecondary, @@ -62,8 +60,9 @@ internal fun StartConversationScreen( Column( modifier = Modifier.verticalScroll(rememberScrollState()) ) { + val newMessageTitleTxt:String = context.resources.getQuantityString(R.plurals.messageNew, 1, 1) ItemButton( - textId = newMessageTitleTxt, + text = newMessageTitleTxt, icon = R.drawable.ic_message, modifier = Modifier.contentDescription(R.string.AccessibilityId_messageNew), onClick = delegate::onNewMessageSelected) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt index 7ce1a582b9..0a40c6ee39 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt @@ -76,14 +76,14 @@ internal fun NewMessage( ) { val pagerState = rememberPagerState { TITLES.size } - // `messageNew` is now a plurals string so get the singular version - val context = LocalContext.current - val newMessageTitleTxt:String = context.resources.getQuantityString(R.plurals.messageNew, 1, 1) - Column(modifier = Modifier.background( LocalColors.current.backgroundSecondary, shape = MaterialTheme.shapes.small )) { + // `messageNew` is now a plurals string so get the singular version + val context = LocalContext.current + val newMessageTitleTxt:String = context.resources.getQuantityString(R.plurals.messageNew, 1, 1) + BackAppBar( title = newMessageTitleTxt, backgroundColor = Color.Transparent, // transparent to show the rounded shape of the container diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt index 28d6d97eab..baf0c1f122 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/Components.kt @@ -11,8 +11,6 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.ColumnScope -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth @@ -189,7 +187,14 @@ fun LargeItemButton( } @Composable -fun ItemButton(text: String, icon: Int, modifier: Modifier, textStyle: TextStyle, colors: ButtonColors, onClick: () -> Unit) { +fun ItemButton( + text: String, + icon: Int, + modifier: Modifier, + textStyle: TextStyle = LocalType.current.xl, + colors: ButtonColors = transparentButtonColors(), + onClick: () -> Unit +) { ItemButton( text = text, modifier = modifier, @@ -211,20 +216,15 @@ fun ItemButton(text: String, icon: Int, modifier: Modifier, textStyle: TextStyle */ @Composable fun ItemButton( - @StringRes textId: Any, // Type was: Int - see comment below. + @StringRes textId: Int, @DrawableRes icon: Int, modifier: Modifier = Modifier, textStyle: TextStyle = LocalType.current.xl, colors: ButtonColors = transparentButtonColors(), onClick: () -> Unit ) { - // TODO: I don't know enough compose to fix this properly atm so I'm tweaking this - // ItemButton so I can send it an Int or a String and still get the right behavior. - // Sorry. -ACL 2024-08-29 - val txtString = if (textId is Int) stringResource(textId) else textId as String - ItemButton( - text = txtString, + text = stringResource(textId), modifier = modifier, icon = { Icon(