some fixes for Next MCU extra

This commit is contained in:
Owen LeJeune
2023-07-11 22:11:25 -04:00
parent 19f5ae426f
commit 8d74d6ee53
4 changed files with 116 additions and 96 deletions

View File

@@ -8,7 +8,7 @@ import org.koin.core.parameter.parametersOf
class NextMCUClient: KoinComponent { class NextMCUClient: KoinComponent {
companion object { companion object {
private const val BASE_URL = "https://www.whenisthenextmcufilm.com/" private const val BASE_URL = "https://dev.whenisthenextmcufilm.com/"
} }
private val client: Client by inject { parametersOf(BASE_URL) } private val client: Client by inject { parametersOf(BASE_URL) }

View File

@@ -7,6 +7,7 @@ import java.util.Date
class NextMCU( class NextMCU(
@SerializedName("days_until") val daysUntil: Int, @SerializedName("days_until") val daysUntil: Int,
@SerializedName("title") val title: String, @SerializedName("title") val title: String,
@SerializedName("id") val id: Int,
@SerializedName("overview") val overview: String, @SerializedName("overview") val overview: String,
@SerializedName("poster_url") val posterUrl: String?, @SerializedName("poster_url") val posterUrl: String?,
@SerializedName("release_date") val releaseDate: Date, @SerializedName("release_date") val releaseDate: Date,

View File

@@ -89,6 +89,7 @@ fun DetailHeader(
) )
rating?.let { rating?.let {
if (it > 0f) {
RatingView( RatingView(
progress = rating progress = rating
) )
@@ -96,6 +97,7 @@ fun DetailHeader(
} }
} }
} }
}
@Composable @Composable
private fun BackdropContainer( private fun BackdropContainer(

View File

@@ -377,7 +377,7 @@ private fun MediaViewContent(
mediaItem?.productionCompanies?.firstOrNull { it.name == "Marvel Studios" } != null mediaItem?.productionCompanies?.firstOrNull { it.name == "Marvel Studios" } != null
&& preferences.showNextMcuProduction && preferences.showNextMcuProduction
) { ) {
NextMcuProjectCard(appNavController = appNavController) NextMcuProjectCard(itemId = itemId, appNavController = appNavController)
} }
if (windowSize != WindowSizeClass.Expanded) { if (windowSize != WindowSizeClass.Expanded) {
@@ -472,11 +472,13 @@ private fun MiscDetails(
.wrapContentHeight() .wrapContentHeight()
) { ) {
Text(text = year, color = MaterialTheme.colorScheme.onBackground) Text(text = year, color = MaterialTheme.colorScheme.onBackground)
if (runtime != "0m") {
Text( Text(
text = runtime, text = runtime,
color = MaterialTheme.colorScheme.onBackground, color = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.padding(start = 12.dp) modifier = Modifier.padding(start = 12.dp)
) )
}
Text( Text(
text = contentRating, text = contentRating,
color = MaterialTheme.colorScheme.onBackground, color = MaterialTheme.colorScheme.onBackground,
@@ -870,6 +872,7 @@ fun SimilarContentCard(
val pagingItems = similarContent?.collectAsLazyPagingItems() val pagingItems = similarContent?.collectAsLazyPagingItems()
pagingItems?.let { pagingItems?.let {
if (it.itemCount > 0) {
ContentCard( ContentCard(
modifier = modifier, modifier = modifier,
title = stringResource(id = R.string.recommended_label) title = stringResource(id = R.string.recommended_label)
@@ -909,6 +912,7 @@ fun SimilarContentCard(
} }
} }
} }
}
@Composable @Composable
fun VideosCard( fun VideosCard(
@@ -1099,6 +1103,7 @@ private fun WatchProviderContainer(
@Composable @Composable
private fun NextMcuProjectCard( private fun NextMcuProjectCard(
itemId: Int,
appNavController: NavController, appNavController: NavController,
modifier: Modifier = Modifier modifier: Modifier = Modifier
) { ) {
@@ -1110,12 +1115,23 @@ private fun NextMcuProjectCard(
val nextMcuProject = remember { viewModel.nextMcuProject } val nextMcuProject = remember { viewModel.nextMcuProject }
if (nextMcuProject.value?.id != itemId) {
Card( Card(
shape = RoundedCornerShape(10.dp), shape = RoundedCornerShape(10.dp),
elevation = CardDefaults.cardElevation(defaultElevation = 10.dp), elevation = CardDefaults.cardElevation(defaultElevation = 10.dp),
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant),
modifier = modifier.then(Modifier modifier = modifier.then(Modifier
.fillMaxWidth() .fillMaxWidth()
.clickable {
nextMcuProject.value?.let {
appNavController.navigate(
AppNavItem.DetailView.withArgs(
it.type,
it.id
)
)
}
}
) )
) { ) {
Box( Box(
@@ -1180,6 +1196,7 @@ private fun NextMcuProjectCard(
} }
} }
} }
}
@Composable @Composable
private fun ReviewsCard( private fun ReviewsCard(