mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Cleanup
This commit is contained in:
parent
6209ae68a8
commit
7cd2bd0e0d
@ -43,6 +43,10 @@ class ProfilePictureView @JvmOverloads constructor(
|
|||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
constructor(context: Context, sender: Recipient): this(context) {
|
||||||
|
update(sender)
|
||||||
|
}
|
||||||
|
|
||||||
// region Updating
|
// region Updating
|
||||||
fun update(recipient: Recipient) {
|
fun update(recipient: Recipient) {
|
||||||
fun getUserDisplayName(publicKey: String): String {
|
fun getUserDisplayName(publicKey: String): String {
|
||||||
|
@ -10,6 +10,7 @@ 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.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.RowScope
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@ -266,38 +267,17 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
fun MetaDataCell(
|
fun MetaDataCell(
|
||||||
messageDetails: MessageDetails,
|
messageDetails: MessageDetails,
|
||||||
) {
|
) {
|
||||||
if (messageDetails.sent != null || messageDetails.received != null || messageDetails.senderInfo != null) CellWithPaddingAndMargin {
|
messageDetails.apply {
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
if (sent != null || received != null || senderInfo != null) CellWithPaddingAndMargin {
|
||||||
messageDetails.sent?.let { TitledText(it) }
|
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||||
messageDetails.received?.let { TitledText(it) }
|
sent?.let { TitledText(it) }
|
||||||
messageDetails.error?.let {
|
received?.let { TitledText(it) }
|
||||||
TitledText(
|
error?.let { TitledErrorText(it) }
|
||||||
it,
|
senderInfo?.let {
|
||||||
valueStyle = LocalTextStyle.current.copy(color = colorDestructive)
|
TitledView("From:") {
|
||||||
)
|
Row {
|
||||||
}
|
sender?.let { Avatar(it) }
|
||||||
messageDetails.senderInfo?.let {
|
TitledMonospaceText(it)
|
||||||
TitledView("From:") {
|
|
||||||
Row {
|
|
||||||
messageDetails.sender?.let { sender ->
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.width(60.dp)
|
|
||||||
.align(Alignment.CenterVertically)
|
|
||||||
) {
|
|
||||||
AndroidView(
|
|
||||||
factory = {
|
|
||||||
ProfilePictureView(it).apply { update(sender) }
|
|
||||||
},
|
|
||||||
modifier = Modifier.width(46.dp).height(46.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Column {
|
|
||||||
TitledText(
|
|
||||||
it,
|
|
||||||
valueStyle = LocalTextStyle.current.copy(fontFamily = FontFamily.Monospace)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,6 +286,22 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun RowScope.Avatar(sender: Recipient) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(60.dp)
|
||||||
|
.align(Alignment.CenterVertically)
|
||||||
|
) {
|
||||||
|
AndroidView(
|
||||||
|
factory = {
|
||||||
|
ProfilePictureView(it).apply { update(sender) }
|
||||||
|
},
|
||||||
|
modifier = Modifier.width(46.dp).height(46.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Buttons(
|
fun Buttons(
|
||||||
hasError: Boolean,
|
hasError: Boolean,
|
||||||
@ -417,6 +413,22 @@ class MessageDetailActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TitledErrorText(titledText: TitledText, modifier: Modifier = Modifier) {
|
||||||
|
TitledText(
|
||||||
|
titledText,
|
||||||
|
modifier = modifier,
|
||||||
|
valueStyle = LocalTextStyle.current.copy(color = colorDestructive))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TitledMonospaceText(titledText: TitledText, modifier: Modifier = Modifier) {
|
||||||
|
TitledText(
|
||||||
|
titledText,
|
||||||
|
modifier = modifier,
|
||||||
|
valueStyle = LocalTextStyle.current.copy(fontFamily = FontFamily.Monospace))
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TitledText(
|
fun TitledText(
|
||||||
titledText: TitledText,
|
titledText: TitledText,
|
||||||
|
Loading…
Reference in New Issue
Block a user