mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
Using the existing implementation
This commit is contained in:
parent
cb9554ab38
commit
8e80ab08a9
@ -43,8 +43,6 @@ internal fun StartConversationScreen(
|
|||||||
delegate: StartConversationDelegate
|
delegate: StartConversationDelegate
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val newMessageTitleTxt:String = context.resources.getQuantityString(R.plurals.messageNew, 1, 1)
|
|
||||||
|
|
||||||
|
|
||||||
Column(modifier = Modifier.background(
|
Column(modifier = Modifier.background(
|
||||||
LocalColors.current.backgroundSecondary,
|
LocalColors.current.backgroundSecondary,
|
||||||
@ -62,8 +60,9 @@ internal fun StartConversationScreen(
|
|||||||
Column(
|
Column(
|
||||||
modifier = Modifier.verticalScroll(rememberScrollState())
|
modifier = Modifier.verticalScroll(rememberScrollState())
|
||||||
) {
|
) {
|
||||||
|
val newMessageTitleTxt:String = context.resources.getQuantityString(R.plurals.messageNew, 1, 1)
|
||||||
ItemButton(
|
ItemButton(
|
||||||
textId = newMessageTitleTxt,
|
text = newMessageTitleTxt,
|
||||||
icon = R.drawable.ic_message,
|
icon = R.drawable.ic_message,
|
||||||
modifier = Modifier.contentDescription(R.string.AccessibilityId_messageNew),
|
modifier = Modifier.contentDescription(R.string.AccessibilityId_messageNew),
|
||||||
onClick = delegate::onNewMessageSelected)
|
onClick = delegate::onNewMessageSelected)
|
||||||
|
@ -76,14 +76,14 @@ internal fun NewMessage(
|
|||||||
) {
|
) {
|
||||||
val pagerState = rememberPagerState { TITLES.size }
|
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(
|
Column(modifier = Modifier.background(
|
||||||
LocalColors.current.backgroundSecondary,
|
LocalColors.current.backgroundSecondary,
|
||||||
shape = MaterialTheme.shapes.small
|
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(
|
BackAppBar(
|
||||||
title = newMessageTitleTxt,
|
title = newMessageTitleTxt,
|
||||||
backgroundColor = Color.Transparent, // transparent to show the rounded shape of the container
|
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.Box
|
||||||
import androidx.compose.foundation.layout.BoxScope
|
import androidx.compose.foundation.layout.BoxScope
|
||||||
import androidx.compose.foundation.layout.Column
|
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.RowScope
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
@ -189,7 +187,14 @@ fun LargeItemButton(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@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(
|
ItemButton(
|
||||||
text = text,
|
text = text,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
@ -211,20 +216,15 @@ fun ItemButton(text: String, icon: Int, modifier: Modifier, textStyle: TextStyle
|
|||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun ItemButton(
|
fun ItemButton(
|
||||||
@StringRes textId: Any, // Type was: Int - see comment below.
|
@StringRes textId: Int,
|
||||||
@DrawableRes icon: Int,
|
@DrawableRes icon: Int,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
textStyle: TextStyle = LocalType.current.xl,
|
textStyle: TextStyle = LocalType.current.xl,
|
||||||
colors: ButtonColors = transparentButtonColors(),
|
colors: ButtonColors = transparentButtonColors(),
|
||||||
onClick: () -> Unit
|
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(
|
ItemButton(
|
||||||
text = txtString,
|
text = stringResource(textId),
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
icon = {
|
icon = {
|
||||||
Icon(
|
Icon(
|
||||||
|
Loading…
Reference in New Issue
Block a user