mirror of
https://github.com/owenlejeune/TVTime.git
synced 2025-11-19 18:21:19 -05:00
full size reviews card
This commit is contained in:
@@ -129,6 +129,37 @@ fun LazyListContentCard(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ListContentCard(
|
||||
modifier: Modifier = Modifier,
|
||||
header: @Composable (() -> Unit)? = null,
|
||||
footer: @Composable (() -> Unit)? = null,
|
||||
backgroundColor: Color = MaterialTheme.colorScheme.surfaceVariant,
|
||||
content: @Composable ColumnScope.() -> Unit
|
||||
) {
|
||||
Card(
|
||||
modifier = modifier,
|
||||
shape = RoundedCornerShape(10.dp),
|
||||
backgroundColor = backgroundColor,
|
||||
elevation = 8.dp
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(12.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
header?.invoke()
|
||||
Column(
|
||||
content = content,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
)
|
||||
footer?.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun TwoLineImageTextCard(
|
||||
title: String,
|
||||
|
||||
@@ -572,10 +572,11 @@ fun FullScreenThumbnailVideoPlayer(
|
||||
val context = LocalContext.current
|
||||
|
||||
Column(
|
||||
modifier = modifier,
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp)
|
||||
) {
|
||||
AsyncImage(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.clickable(
|
||||
onClick = {
|
||||
val intent = Intent(Intent.ACTION_VIEW).apply {
|
||||
|
||||
@@ -848,7 +848,6 @@ private fun VideoGroup(results: List<Video>, type: Video.Type, title: String) {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
private fun ReviewsCard(
|
||||
itemId: Int?,
|
||||
@@ -862,30 +861,24 @@ private fun ReviewsCard(
|
||||
}
|
||||
}
|
||||
|
||||
val hasReviews = reviewsResponse.value?.results?.size?.let { it > 0 }
|
||||
val m = if (hasReviews == true) {
|
||||
modifier.height(400.dp)
|
||||
} else {
|
||||
modifier.height(200.dp)
|
||||
}
|
||||
|
||||
LazyListContentCard(
|
||||
modifier = m
|
||||
.fillMaxWidth(),
|
||||
ListContentCard(
|
||||
modifier = modifier,
|
||||
header = {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(9.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Reviews",
|
||||
text = stringResource(R.string.reviews_title),
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
},
|
||||
footer = {
|
||||
|
||||
if (SessionManager.currentSession?.isAuthorized == true) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(50.dp)
|
||||
.padding(top = 4.dp),
|
||||
.padding(bottom = 4.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
var reviewTextState by remember { mutableStateOf("") }
|
||||
@@ -897,7 +890,7 @@ private fun ReviewsCard(
|
||||
.weight(1f),
|
||||
value = reviewTextState,
|
||||
onValueChange = { reviewTextState = it },
|
||||
placeHolder = "Add a review",
|
||||
placeHolder = stringResource(R.string.add_a_review_hint),
|
||||
backgroundColor = MaterialTheme.colorScheme.secondary,
|
||||
placeHolderTextColor = MaterialTheme.colorScheme.background,
|
||||
textColor = MaterialTheme.colorScheme.onSecondary
|
||||
@@ -921,12 +914,11 @@ private fun ReviewsCard(
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
) {
|
||||
val reviews = reviewsResponse.value?.results ?: emptyList()
|
||||
if (reviews.isNotEmpty()) {
|
||||
items(reviews.size) { i ->
|
||||
val review = reviews[i]
|
||||
|
||||
reviews.reversed().forEach { review ->
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -987,7 +979,6 @@ private fun ReviewsCard(
|
||||
)
|
||||
}
|
||||
} else {
|
||||
item {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -1001,7 +992,6 @@ private fun ReviewsCard(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetchMediaItem(id: Int, service: DetailService, mediaItem: MutableState<DetailedItem?>) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
|
||||
@@ -153,4 +153,6 @@
|
||||
<string name="popular_today_header">Popular Today</string>
|
||||
<string name="preference_show_poster_titles_title">Show Poster Titles</string>
|
||||
<string name="preference_show_poster_titles_subtitle">Show titles on home screen posters</string>
|
||||
<string name="reviews_title">Reviews</string>
|
||||
<string name="add_a_review_hint">Add a review</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user