mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
Fix up compilation issues
This commit is contained in:
parent
952479a564
commit
cc64f461ef
@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||||
import androidx.compose.foundation.layout.FlowRow
|
import androidx.compose.foundation.layout.FlowRow
|
||||||
import androidx.compose.foundation.layout.IntrinsicSize
|
import androidx.compose.foundation.layout.IntrinsicSize
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
@ -61,8 +60,6 @@ import org.session.libsession.database.StorageProtocol
|
|||||||
import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment
|
import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment
|
||||||
import org.thoughtcrime.securesms.MediaPreviewActivity.getPreviewIntent
|
import org.thoughtcrime.securesms.MediaPreviewActivity.getPreviewIntent
|
||||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||||
import org.thoughtcrime.securesms.database.Storage
|
|
||||||
import org.thoughtcrime.securesms.database.model.MediaMmsMessageRecord
|
|
||||||
import org.thoughtcrime.securesms.ui.Avatar
|
import org.thoughtcrime.securesms.ui.Avatar
|
||||||
import org.thoughtcrime.securesms.ui.CarouselNextButton
|
import org.thoughtcrime.securesms.ui.CarouselNextButton
|
||||||
import org.thoughtcrime.securesms.ui.CarouselPrevButton
|
import org.thoughtcrime.securesms.ui.CarouselPrevButton
|
||||||
|
@ -138,7 +138,7 @@ fun RowScope.ContactPhoto(sessionId: String) {
|
|||||||
val recipient = remember(sessionId) {
|
val recipient = remember(sessionId) {
|
||||||
Recipient.from(context, Address.fromSerialized(sessionId), false)
|
Recipient.from(context, Address.fromSerialized(sessionId), false)
|
||||||
}
|
}
|
||||||
Avatar(recipient)
|
Avatar(recipient, modifier = Modifier.size(48.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@ -24,10 +25,9 @@ import org.session.libsession.messaging.contacts.Contact
|
|||||||
import org.thoughtcrime.securesms.groups.ContactItem
|
import org.thoughtcrime.securesms.groups.ContactItem
|
||||||
import org.thoughtcrime.securesms.groups.CreateGroupEvent
|
import org.thoughtcrime.securesms.groups.CreateGroupEvent
|
||||||
import org.thoughtcrime.securesms.groups.CreateGroupViewModel
|
import org.thoughtcrime.securesms.groups.CreateGroupViewModel
|
||||||
import org.thoughtcrime.securesms.ui.CloseIcon
|
|
||||||
import org.thoughtcrime.securesms.ui.LoadingArcOr
|
import org.thoughtcrime.securesms.ui.LoadingArcOr
|
||||||
import org.thoughtcrime.securesms.ui.NavigationBar
|
|
||||||
import org.thoughtcrime.securesms.ui.SearchBar
|
import org.thoughtcrime.securesms.ui.SearchBar
|
||||||
|
import org.thoughtcrime.securesms.ui.components.BackAppBar
|
||||||
import org.thoughtcrime.securesms.ui.components.PrimaryOutlineButton
|
import org.thoughtcrime.securesms.ui.components.PrimaryOutlineButton
|
||||||
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
||||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||||
@ -75,6 +75,7 @@ fun CreateGroupScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun CreateGroup(
|
fun CreateGroup(
|
||||||
groupName: String,
|
groupName: String,
|
||||||
@ -97,10 +98,9 @@ fun CreateGroup(
|
|||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
) {
|
) {
|
||||||
NavigationBar(
|
BackAppBar(
|
||||||
title = stringResource(id = R.string.groupCreate),
|
title = stringResource(id = R.string.groupCreate),
|
||||||
onBack = onBack,
|
onBack = onBack,
|
||||||
actionElement = { CloseIcon(onClose) }
|
|
||||||
)
|
)
|
||||||
|
|
||||||
SessionOutlinedTextField(
|
SessionOutlinedTextField(
|
||||||
|
@ -19,8 +19,6 @@ import androidx.compose.material3.ModalBottomSheet
|
|||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.SheetState
|
import androidx.compose.material3.SheetState
|
||||||
import androidx.compose.material3.Snackbar
|
import androidx.compose.material3.Snackbar
|
||||||
import androidx.compose.material3.SnackbarHost
|
|
||||||
import androidx.compose.material3.SnackbarHostState
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.material3.rememberModalBottomSheetState
|
import androidx.compose.material3.rememberModalBottomSheetState
|
||||||
@ -51,7 +49,8 @@ import org.thoughtcrime.securesms.groups.GroupMemberState
|
|||||||
import org.thoughtcrime.securesms.ui.AlertDialog
|
import org.thoughtcrime.securesms.ui.AlertDialog
|
||||||
import org.thoughtcrime.securesms.ui.DialogButtonModel
|
import org.thoughtcrime.securesms.ui.DialogButtonModel
|
||||||
import org.thoughtcrime.securesms.ui.GetString
|
import org.thoughtcrime.securesms.ui.GetString
|
||||||
import org.thoughtcrime.securesms.ui.NavigationBar
|
import org.thoughtcrime.securesms.ui.components.ActionAppBar
|
||||||
|
import org.thoughtcrime.securesms.ui.components.AppBarBackIcon
|
||||||
import org.thoughtcrime.securesms.ui.components.PrimaryOutlineButton
|
import org.thoughtcrime.securesms.ui.components.PrimaryOutlineButton
|
||||||
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
||||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||||
@ -142,10 +141,12 @@ fun EditGroup(
|
|||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
NavigationBar(
|
ActionAppBar(
|
||||||
title = stringResource(id = R.string.groupEdit),
|
title = stringResource(id = R.string.groupEdit),
|
||||||
onBack = onBackClick,
|
navigationIcon = {
|
||||||
actionElement = {
|
AppBarBackIcon(onBack = onBackClick)
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
TextButton(onClick = onBackClick) {
|
TextButton(onClick = onBackClick) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = R.string.done),
|
text = stringResource(id = R.string.done),
|
||||||
@ -153,7 +154,7 @@ fun EditGroup(
|
|||||||
style = LocalType.current.large.bold()
|
style = LocalType.current.large.bold()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
@ -319,7 +320,7 @@ private fun ConfirmRemovingMemberDialog(
|
|||||||
onClick = { onConfirmed(member.accountId, false) }
|
onClick = { onConfirmed(member.accountId, false) }
|
||||||
),
|
),
|
||||||
DialogButtonModel(
|
DialogButtonModel(
|
||||||
text = GetString(R.string.groupRemoveMessages),
|
text = GetString("Remove and delete messages"), //TODO: Copy
|
||||||
color = LocalColors.current.danger,
|
color = LocalColors.current.danger,
|
||||||
onClick = { onConfirmed(member.accountId, true) }
|
onClick = { onConfirmed(member.accountId, true) }
|
||||||
),
|
),
|
||||||
|
@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.defaultMinSize
|
|||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
@ -25,9 +26,8 @@ import network.loki.messenger.R
|
|||||||
import org.session.libsession.messaging.contacts.Contact
|
import org.session.libsession.messaging.contacts.Contact
|
||||||
import org.thoughtcrime.securesms.groups.ContactItem
|
import org.thoughtcrime.securesms.groups.ContactItem
|
||||||
import org.thoughtcrime.securesms.groups.SelectContactsViewModel
|
import org.thoughtcrime.securesms.groups.SelectContactsViewModel
|
||||||
import org.thoughtcrime.securesms.ui.CloseIcon
|
|
||||||
import org.thoughtcrime.securesms.ui.NavigationBar
|
|
||||||
import org.thoughtcrime.securesms.ui.SearchBar
|
import org.thoughtcrime.securesms.ui.SearchBar
|
||||||
|
import org.thoughtcrime.securesms.ui.components.BackAppBar
|
||||||
import org.thoughtcrime.securesms.ui.components.PrimaryOutlineButton
|
import org.thoughtcrime.securesms.ui.components.PrimaryOutlineButton
|
||||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||||
@ -56,6 +56,7 @@ fun SelectContactsScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun SelectContacts(
|
fun SelectContacts(
|
||||||
contacts: List<ContactItem>,
|
contacts: List<ContactItem>,
|
||||||
@ -64,18 +65,12 @@ fun SelectContacts(
|
|||||||
onSearchQueryChanged: (String) -> Unit,
|
onSearchQueryChanged: (String) -> Unit,
|
||||||
onDoneClicked: () -> Unit,
|
onDoneClicked: () -> Unit,
|
||||||
onBack: () -> Unit,
|
onBack: () -> Unit,
|
||||||
onClose: (() -> Unit)? = null,
|
|
||||||
@StringRes okButtonResId: Int = R.string.ok
|
@StringRes okButtonResId: Int = R.string.ok
|
||||||
) {
|
) {
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||||
NavigationBar(
|
BackAppBar(
|
||||||
title = stringResource(id = R.string.contactSelect),
|
title = stringResource(id = R.string.contactSelect),
|
||||||
onBack = onBack,
|
onBack = onBack,
|
||||||
actionElement = {
|
|
||||||
if (onClose != null) {
|
|
||||||
CloseIcon(onClose)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
GroupMinimumVersionBanner()
|
GroupMinimumVersionBanner()
|
||||||
@ -139,7 +134,6 @@ private fun PreviewSelectContacts() {
|
|||||||
onSearchQueryChanged = {},
|
onSearchQueryChanged = {},
|
||||||
onDoneClicked = {},
|
onDoneClicked = {},
|
||||||
onBack = {},
|
onBack = {},
|
||||||
onClose = null
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,6 @@ import androidx.compose.foundation.Canvas
|
|||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.ScrollState
|
import androidx.compose.foundation.ScrollState
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
||||||
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
|
||||||
@ -32,7 +30,6 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.text.BasicTextField
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
import androidx.compose.material.ripple.rememberRipple
|
|
||||||
import androidx.compose.material3.ButtonColors
|
import androidx.compose.material3.ButtonColors
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
@ -43,7 +40,6 @@ import androidx.compose.material3.Text
|
|||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -65,13 +61,9 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.semantics.contentDescription
|
import androidx.compose.ui.semantics.contentDescription
|
||||||
import androidx.compose.ui.semantics.semantics
|
import androidx.compose.ui.semantics.semantics
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
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.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import androidx.compose.ui.viewinterop.AndroidView
|
import androidx.compose.ui.viewinterop.AndroidView
|
||||||
import com.google.accompanist.drawablepainter.rememberDrawablePainter
|
import com.google.accompanist.drawablepainter.rememberDrawablePainter
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
@ -97,7 +89,7 @@ interface Callbacks<in T> {
|
|||||||
fun setValue(value: T)
|
fun setValue(value: T)
|
||||||
}
|
}
|
||||||
|
|
||||||
object NoOpCallbacks : Callbacks<Any> {
|
object NoOpCallbacks: Callbacks<Any> {
|
||||||
override fun onSetClick() {}
|
override fun onSetClick() {}
|
||||||
override fun setValue(value: Any) {}
|
override fun setValue(value: Any) {}
|
||||||
}
|
}
|
||||||
@ -166,12 +158,7 @@ fun ItemButtonWithDrawable(
|
|||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
icon = {
|
icon = {
|
||||||
Image(
|
Image(
|
||||||
painter = rememberDrawablePainter(
|
painter = rememberDrawablePainter(drawable = AppCompatResources.getDrawable(context, icon)),
|
||||||
drawable = AppCompatResources.getDrawable(
|
|
||||||
context,
|
|
||||||
icon
|
|
||||||
)
|
|
||||||
),
|
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.align(Alignment.Center)
|
modifier = Modifier.align(Alignment.Center)
|
||||||
)
|
)
|
||||||
@ -278,10 +265,10 @@ fun ItemButton(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base [ItemButton] implementation.
|
* Base [ItemButton] implementation.
|
||||||
*
|
*
|
||||||
* A button to be used in a list of buttons, usually in a [Cell] or [Card]
|
* A button to be used in a list of buttons, usually in a [Cell] or [Card]
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun ItemButton(
|
fun ItemButton(
|
||||||
text: String,
|
text: String,
|
||||||
@ -572,149 +559,4 @@ fun SearchBar(
|
|||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
cursorBrush = SolidColor(LocalColors.current.text)
|
cursorBrush = SolidColor(LocalColors.current.text)
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun NavigationBar(
|
|
||||||
title: String,
|
|
||||||
titleAlignment: Alignment = Alignment.Center,
|
|
||||||
onBack: (() -> Unit)? = null,
|
|
||||||
actionElement: (@Composable BoxScope.() -> Unit)? = null
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(64.dp)
|
|
||||||
) {
|
|
||||||
// Optional back button, layout should still take up space
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxHeight()
|
|
||||||
.aspectRatio(1.0f, true)
|
|
||||||
.padding(16.dp)
|
|
||||||
) {
|
|
||||||
if (onBack != null) {
|
|
||||||
Icon(
|
|
||||||
painter = painterResource(id = R.drawable.ic_arrow_back_24),
|
|
||||||
contentDescription = stringResource(
|
|
||||||
id = R.string.AccessibilityId_navigateBack
|
|
||||||
),
|
|
||||||
Modifier
|
|
||||||
.clickable(
|
|
||||||
interactionSource = remember { MutableInteractionSource() },
|
|
||||||
indication = rememberRipple(bounded = false, radius = 16.dp),
|
|
||||||
) { onBack() }
|
|
||||||
.align(Alignment.Center)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Main title
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxHeight()
|
|
||||||
.weight(1f)
|
|
||||||
.padding(8.dp)
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = title,
|
|
||||||
Modifier.align(titleAlignment),
|
|
||||||
overflow = TextOverflow.Ellipsis,
|
|
||||||
fontSize = 26.sp,
|
|
||||||
fontWeight = FontWeight.Bold
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// Optional action
|
|
||||||
if (actionElement != null) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxHeight()
|
|
||||||
.align(Alignment.CenterVertically)
|
|
||||||
.aspectRatio(1.0f, true),
|
|
||||||
contentAlignment = Alignment.Center
|
|
||||||
) {
|
|
||||||
actionElement(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun BoxScope.CloseIcon(onClose: () -> Unit) {
|
|
||||||
Icon(
|
|
||||||
painter = painterResource(id = R.drawable.ic_baseline_close_24),
|
|
||||||
contentDescription = stringResource(
|
|
||||||
id = R.string.close
|
|
||||||
),
|
|
||||||
Modifier
|
|
||||||
.clickable { onClose() }
|
|
||||||
.align(Alignment.Center)
|
|
||||||
.padding(16.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun RowScope.WeightedOptionButton(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
@StringRes label: Int,
|
|
||||||
destructive: Boolean = false,
|
|
||||||
weight: Float = 1f,
|
|
||||||
onClick: () -> Unit
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = stringResource(label),
|
|
||||||
modifier = modifier
|
|
||||||
.padding(16.dp)
|
|
||||||
.weight(weight)
|
|
||||||
.clickable {
|
|
||||||
onClick()
|
|
||||||
},
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
fontSize = 16.sp,
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
color = if (destructive) LocalColors.current.danger else Color.Unspecified
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview
|
|
||||||
@Composable
|
|
||||||
fun PreviewWeightedOptionButtons() {
|
|
||||||
Column(modifier = Modifier.fillMaxWidth()) {
|
|
||||||
// two equal sized
|
|
||||||
Row(modifier = Modifier.fillMaxWidth()) {
|
|
||||||
WeightedOptionButton(label = R.string.ok) {
|
|
||||||
|
|
||||||
}
|
|
||||||
WeightedOptionButton(label = R.string.cancel, destructive = true) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// single left justified
|
|
||||||
Row(modifier = Modifier.fillMaxWidth()) {
|
|
||||||
WeightedOptionButton(label = R.string.cancel, destructive = true, weight = 1f) {
|
|
||||||
|
|
||||||
}
|
|
||||||
// press F to pay respects to `android:weightSum`
|
|
||||||
Box(Modifier.weight(1f))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
@Preview
|
|
||||||
fun PreviewNavigationBar() {
|
|
||||||
NavigationBar(title = "Create Group", onBack = {}, actionElement = {
|
|
||||||
CloseIcon {}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
@Preview
|
|
||||||
fun PreviewSearchBar() {
|
|
||||||
PreviewTheme {
|
|
||||||
Column(Modifier.background(LocalColors.current.backgroundSecondary)) {
|
|
||||||
SearchBar("Search query", {})
|
|
||||||
SearchBar("", {}, placeholder = "Hint text")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -25,9 +25,6 @@ import org.session.libsession.utilities.StringSubstitutionConstants.GROUP_NAME_K
|
|||||||
import org.session.libsession.utilities.StringSubstitutionConstants.NAME_KEY
|
import org.session.libsession.utilities.StringSubstitutionConstants.NAME_KEY
|
||||||
import org.session.libsession.utilities.StringSubstitutionConstants.OTHER_NAME_KEY
|
import org.session.libsession.utilities.StringSubstitutionConstants.OTHER_NAME_KEY
|
||||||
import org.session.libsession.utilities.StringSubstitutionConstants.TIME_KEY
|
import org.session.libsession.utilities.StringSubstitutionConstants.TIME_KEY
|
||||||
import org.session.libsession.utilities.getExpirationTypeDisplayValue
|
|
||||||
import org.session.libsession.utilities.truncateIdForDisplay
|
|
||||||
import org.session.libsignal.utilities.Log
|
|
||||||
|
|
||||||
object UpdateMessageBuilder {
|
object UpdateMessageBuilder {
|
||||||
const val TAG = "UpdateMessageBuilder"
|
const val TAG = "UpdateMessageBuilder"
|
||||||
@ -42,9 +39,6 @@ object UpdateMessageBuilder {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun buildGroupUpdateMessage(context: Context, updateMessageData: UpdateMessageData, senderId: String? = null, isOutgoing: Boolean = false, isInConversation: Boolean): CharSequence {
|
fun buildGroupUpdateMessage(context: Context, updateMessageData: UpdateMessageData, senderId: String? = null, isOutgoing: Boolean = false, isInConversation: Boolean): CharSequence {
|
||||||
val updateData = updateMessageData.kind ?: return ""
|
val updateData = updateMessageData.kind ?: return ""
|
||||||
val senderName: String by lazy {
|
|
||||||
senderId?.let(this::getSenderName).orEmpty()
|
|
||||||
}
|
|
||||||
|
|
||||||
return when (updateData) {
|
return when (updateData) {
|
||||||
// --- Group created or joined ---
|
// --- Group created or joined ---
|
||||||
@ -194,20 +188,20 @@ object UpdateMessageBuilder {
|
|||||||
.put(NAME_KEY, context.youOrSender(updateData.sessionIds.first()))
|
.put(NAME_KEY, context.youOrSender(updateData.sessionIds.first()))
|
||||||
.format()
|
.format()
|
||||||
number == 2 && containsUser -> Phrase.from(context,
|
number == 2 && containsUser -> Phrase.from(context,
|
||||||
R.string.groupMemberYouAndOtherNew)
|
R.string.groupInviteYouAndOtherNew)
|
||||||
.put(OTHER_NAME_KEY, context.youOrSender(updateData.sessionIds.first { it != userPublicKey }))
|
.put(OTHER_NAME_KEY, context.youOrSender(updateData.sessionIds.first { it != userPublicKey }))
|
||||||
.format()
|
.format()
|
||||||
number == 2 -> Phrase.from(context,
|
number == 2 -> Phrase.from(context,
|
||||||
R.string.groupMemberTwoNew)
|
R.string.groupMemberNewMultiple)
|
||||||
.put(NAME_KEY, context.youOrSender(updateData.sessionIds.first()))
|
.put(NAME_KEY, context.youOrSender(updateData.sessionIds.first()))
|
||||||
.put(OTHER_NAME_KEY, context.youOrSender(updateData.sessionIds.last()))
|
.put(OTHER_NAME_KEY, context.youOrSender(updateData.sessionIds.last()))
|
||||||
.format()
|
.format()
|
||||||
containsUser -> Phrase.from(context,
|
containsUser -> Phrase.from(context,
|
||||||
R.string.groupMemberNewYouMultiple)
|
R.string.groupInviteYouAndMoreNew)
|
||||||
.put(COUNT_KEY, updateData.sessionIds.size - 1)
|
.put(COUNT_KEY, updateData.sessionIds.size - 1)
|
||||||
.format()
|
.format()
|
||||||
else -> Phrase.from(context,
|
else -> Phrase.from(context,
|
||||||
R.string.groupMemberMoreNew)
|
R.string.groupMemberNewMultiple)
|
||||||
.put(NAME_KEY, context.youOrSender(updateData.sessionIds.first()))
|
.put(NAME_KEY, context.youOrSender(updateData.sessionIds.first()))
|
||||||
.put(COUNT_KEY, updateData.sessionIds.size - 1)
|
.put(COUNT_KEY, updateData.sessionIds.size - 1)
|
||||||
.format()
|
.format()
|
||||||
|
Loading…
Reference in New Issue
Block a user