mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-11 09:50:32 +00:00
Rm redundant Surface
This commit is contained in:
parent
5e7e14ee4d
commit
909d214002
@ -36,81 +36,79 @@ import org.schabi.newpipe.util.image.ImageStrategy
|
|||||||
fun CommentRepliesHeader(comment: CommentsInfoItem) {
|
fun CommentRepliesHeader(comment: CommentsInfoItem) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
Surface(color = MaterialTheme.colorScheme.background) {
|
Column(modifier = Modifier.padding(all = 8.dp)) {
|
||||||
Column(modifier = Modifier.padding(all = 8.dp)) {
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
.padding(top = 8.dp, bottom = 8.dp, end = 8.dp)
|
||||||
|
.clickable {
|
||||||
|
NavigationHelper.openCommentAuthorIfPresent(
|
||||||
|
context as FragmentActivity,
|
||||||
|
comment
|
||||||
|
)
|
||||||
|
},
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Row(
|
if (ImageStrategy.shouldLoadImages()) {
|
||||||
modifier = Modifier
|
AsyncImage(
|
||||||
.padding(top = 8.dp, bottom = 8.dp, end = 8.dp)
|
model = ImageStrategy.choosePreferredImage(comment.uploaderAvatars),
|
||||||
.clickable {
|
contentDescription = null,
|
||||||
NavigationHelper.openCommentAuthorIfPresent(
|
placeholder = painterResource(R.drawable.placeholder_person),
|
||||||
context as FragmentActivity,
|
error = painterResource(R.drawable.placeholder_person),
|
||||||
comment
|
modifier = Modifier
|
||||||
)
|
.size(42.dp)
|
||||||
},
|
.clip(CircleShape)
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
)
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
if (ImageStrategy.shouldLoadImages()) {
|
|
||||||
AsyncImage(
|
|
||||||
model = ImageStrategy.choosePreferredImage(comment.uploaderAvatars),
|
|
||||||
contentDescription = null,
|
|
||||||
placeholder = painterResource(R.drawable.placeholder_person),
|
|
||||||
error = painterResource(R.drawable.placeholder_person),
|
|
||||||
modifier = Modifier
|
|
||||||
.size(42.dp)
|
|
||||||
.clip(CircleShape)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
Text(text = comment.uploaderName)
|
|
||||||
|
|
||||||
Text(
|
|
||||||
color = MaterialTheme.colorScheme.secondary,
|
|
||||||
style = MaterialTheme.typography.bodySmall,
|
|
||||||
text = Localization.relativeTimeOrTextual(
|
|
||||||
context, comment.uploadDate, comment.textualUploadDate
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row(
|
Column {
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
Text(text = comment.uploaderName)
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
Text(
|
||||||
Image(
|
color = MaterialTheme.colorScheme.secondary,
|
||||||
painter = painterResource(R.drawable.ic_thumb_up),
|
style = MaterialTheme.typography.bodySmall,
|
||||||
contentDescription = stringResource(R.string.detail_likes_img_view_description)
|
text = Localization.relativeTimeOrTextual(
|
||||||
|
context, comment.uploadDate, comment.textualUploadDate
|
||||||
|
)
|
||||||
)
|
)
|
||||||
Text(text = Localization.likeCount(context, comment.likeCount))
|
|
||||||
|
|
||||||
if (comment.isHeartedByUploader) {
|
|
||||||
Image(
|
|
||||||
painter = painterResource(R.drawable.ic_heart),
|
|
||||||
contentDescription = stringResource(R.string.detail_heart_img_view_description)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (comment.isPinned) {
|
|
||||||
Image(
|
|
||||||
painter = painterResource(R.drawable.ic_pin),
|
|
||||||
contentDescription = stringResource(R.string.detail_pinned_comment_view_description)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text(
|
Row(
|
||||||
text = rememberParsedText(comment.commentText),
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
style = MaterialTheme.typography.bodyMedium
|
verticalAlignment = Alignment.CenterVertically
|
||||||
)
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(R.drawable.ic_thumb_up),
|
||||||
|
contentDescription = stringResource(R.string.detail_likes_img_view_description)
|
||||||
|
)
|
||||||
|
Text(text = Localization.likeCount(context, comment.likeCount))
|
||||||
|
|
||||||
|
if (comment.isHeartedByUploader) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(R.drawable.ic_heart),
|
||||||
|
contentDescription = stringResource(R.string.detail_heart_img_view_description)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (comment.isPinned) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(R.drawable.ic_pin),
|
||||||
|
contentDescription = stringResource(R.string.detail_pinned_comment_view_description)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = rememberParsedText(comment.commentText),
|
||||||
|
style = MaterialTheme.typography.bodyMedium
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +125,8 @@ fun CommentRepliesHeaderPreview() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
AppTheme {
|
AppTheme {
|
||||||
CommentRepliesHeader(comment)
|
Surface(color = MaterialTheme.colorScheme.background) {
|
||||||
|
CommentRepliesHeader(comment)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user