mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 21:16:23 +02:00
Adds user's picture and background to LongForm posts without a default image
This commit is contained in:
@@ -394,7 +394,7 @@ fun NoteCompose(
|
|||||||
thickness = 0.25.dp
|
thickness = 0.25.dp
|
||||||
)
|
)
|
||||||
} else if (noteEvent is LongTextNoteEvent) {
|
} else if (noteEvent is LongTextNoteEvent) {
|
||||||
LongFormHeader(noteEvent)
|
LongFormHeader(noteEvent, note, account.userProfile())
|
||||||
|
|
||||||
ReactionsRow(note, accountViewModel)
|
ReactionsRow(note, accountViewModel)
|
||||||
|
|
||||||
@@ -584,7 +584,7 @@ fun BadgeDisplay(baseNote: Note) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun LongFormHeader(noteEvent: LongTextNoteEvent) {
|
private fun LongFormHeader(noteEvent: LongTextNoteEvent, note: Note, loggedIn: User) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(shape = RoundedCornerShape(15.dp))
|
.clip(shape = RoundedCornerShape(15.dp))
|
||||||
@@ -605,6 +605,28 @@ private fun LongFormHeader(noteEvent: LongTextNoteEvent) {
|
|||||||
contentScale = ContentScale.FillWidth,
|
contentScale = ContentScale.FillWidth,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
)
|
)
|
||||||
|
} ?: Box() {
|
||||||
|
note.author?.info?.banner?.let {
|
||||||
|
AsyncImage(
|
||||||
|
model = it,
|
||||||
|
contentDescription = stringResource(
|
||||||
|
R.string.preview_card_image_for,
|
||||||
|
it
|
||||||
|
),
|
||||||
|
contentScale = ContentScale.FillWidth,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Box(
|
||||||
|
Modifier
|
||||||
|
.width(75.dp)
|
||||||
|
.height(75.dp)
|
||||||
|
.padding(10.dp)
|
||||||
|
.align(Alignment.BottomStart)
|
||||||
|
) {
|
||||||
|
NoteAuthorPicture(baseNote = note, baseUserAccount = loggedIn, size = 55.dp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
noteEvent.title()?.let {
|
noteEvent.title()?.let {
|
||||||
@@ -629,6 +651,16 @@ private fun LongFormHeader(noteEvent: LongTextNoteEvent) {
|
|||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
?: Text(
|
||||||
|
text = noteEvent.content.take(200),
|
||||||
|
style = MaterialTheme.typography.caption,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(start = 10.dp, end = 10.dp, bottom = 10.dp),
|
||||||
|
color = Color.Gray,
|
||||||
|
maxLines = 3,
|
||||||
|
overflow = TextOverflow.Ellipsis
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user