include also known for on person page

This commit is contained in:
Owen LeJeune
2022-02-24 09:29:11 -05:00
parent 932fa0292b
commit 4f3f756d6b
5 changed files with 66 additions and 39 deletions

View File

@@ -7,12 +7,12 @@ class DetailCast(
@SerializedName("id") val id: Int,
@SerializedName("episode_count") val episodeCount: Int,
@SerializedName("overview") val overview: String,
@SerializedName("name") val name: String,
@SerializedName("name") val name: String?,
@SerializedName("media_type") val mediaType: MediaViewType,
@SerializedName("poster_path") val posterPath: String?,
@SerializedName("first_air_date") val firstAirDate: String,
@SerializedName("character") val character: String,
@SerializedName("title") val title: String,
@SerializedName("title") val title: String?,
@SerializedName("adult") val isAdult: Boolean,
@SerializedName("release_date") val releaseDate: String
)

View File

@@ -9,11 +9,11 @@ class DetailCrew(
@SerializedName("episode_count") val episodeCount: Int,
@SerializedName("job") val job: String,
@SerializedName("overview") val overview: String,
@SerializedName("name") val name: String,
@SerializedName("name") val name: String?,
@SerializedName("media_type") val mediaType: MediaViewType,
@SerializedName("first_air_date") val firstAirDate: String,
@SerializedName("poster_path") val posterPath: String,
@SerializedName("title") val title: String,
@SerializedName("title") val title: String?,
@SerializedName("adult") val isAdult: Boolean,
@SerializedName("release_date") val releaseDate: String
)

View File

@@ -1,11 +1,8 @@
package com.owenlejeune.tvtime.ui.screens
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.*
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.Icon
@@ -96,7 +93,7 @@ fun DetailView(
start.linkTo(posterImage.end, margin = 8.dp)
end.linkTo(parent.end, margin = 16.dp)
},
title = mediaItem.value?.title ?: ""
title = mediaItem.value?.title ?: "",
)
BackButton(
@@ -226,8 +223,13 @@ fun PersonDetailView(
items(credits.value?.cast?.size ?: 0) { i ->
val content = credits.value!!.cast[i]
val title = if (content.mediaType == MediaViewType.MOVIE) {
content.title ?: ""
} else {
content.name ?: ""
}
TwoLineImageTextCard(
title = content.title,
title = title,
subtitle = content.character,
modifier = Modifier
.width(124.dp)
@@ -244,6 +246,54 @@ fun PersonDetailView(
}
}
}
ContentCard(title = stringResource(R.string.also_known_for_label)) {
Column(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
val departments = credits.value?.crew?.map { it.department }?.toSet() ?: emptySet()
if (departments.isNotEmpty()) {
departments.forEach { department ->
Text(text = department, color = MaterialTheme.colorScheme.onSurface)
LazyRow(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight(),
horizontalArrangement = Arrangement.spacedBy(4.dp)
) {
val jobsInDepartment = credits.value!!.crew.filter { it.department == department }
items(jobsInDepartment.size) { i ->
val content = jobsInDepartment[i]
val title = if (content.mediaType == MediaViewType.MOVIE) {
content.title ?: ""
} else {
content.name ?: ""
}
TwoLineImageTextCard(
title = title,
subtitle = content.job,
modifier = Modifier
.width(124.dp)
.wrapContentHeight(),
imageUrl = TmdbUtils.getFullPosterPath(content.posterPath),
onItemClicked = {
personId?.let {
appNavController.navigate(
"${MainNavItem.DetailView.route}/${content.mediaType}/${content.id}"
)
}
}
)
}
}
}
}
}
}
}
}
}
@@ -275,17 +325,20 @@ private fun TitleText(modifier: Modifier, title: String) {
.fillMaxWidth(.6f),
style = MaterialTheme.typography.headlineMedium,
textAlign = TextAlign.Start,
softWrap = true
softWrap = true,
maxLines = 3,
overflow = TextOverflow.Ellipsis
)
}
@Composable
private fun BackButton(modifier: Modifier, appNavController: NavController) {
val start = if (isSystemInDarkTheme()) Color.Black else Color.White
IconButton(
onClick = { appNavController.popBackStack() },
modifier = modifier
.background(
brush = Brush.radialGradient(colors = listOf(Color.Black, Color.Transparent))
brush = Brush.radialGradient(colors = listOf(start, Color.Transparent))
)
.wrapContentSize()
) {

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">TVTime</string>
<!-- nav -->
<string name="nav_movies_title">Films</string>
<string name="nav_tv_title">Télé</string>
<string name="nav_favourites_title">Favoris</string>
<string name="nav_settings_title">Réglages</string>
<string name="nav_now_playing_title">Lecture en cours</string>
<string name="nav_popular_title">Populaire</string>
<string name="nav_top_rated_title">Les mieux notés</string>
<string name="nav_upcoming_title">A venir</string>
<string name="nav_tv_airing_today_title">Aujourd\'hui</string>
<string name="nav_tv_on_the_air">À l\'antenne</string>
<!-- -->
<string name="cast_label">Acteurs</string>
<!-- preferences -->
<string name="preference_heading_search">Rechercher</string>
<string name="preferences_persistent_search_title">Barre de recherche presistante</string>
<string name="preferences_persistent_search_subtitle">Gardez la barre de recherche visible à tout moment</string>
<string name="preferences_hide_heading_title">Barre de recherche étendue</string>
<string name="preferences_hide_heading_subtitle">Gardez la barre de recherche développée à tout moment</string>
<string name="preferences_debug_title">Options de développeur</string>
</resources>

View File

@@ -18,6 +18,7 @@
<string name="recommended_label">Recommended</string>
<string name="videos_label">Videos</string>
<string name="known_for_label">Known For</string>
<string name="also_known_for_label">Also Known For</string>
<string name="expandable_see_more">See more</string>
<string name="expandable_see_less">See less</string>