mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Using the existing implementation
This commit is contained in:
parent
cb9554ab38
commit
8e80ab08a9
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user