mirror of
https://github.com/owenlejeune/TVTime.git
synced 2025-11-15 00:02:48 -05:00
add more details to detail movie
This commit is contained in:
@@ -8,7 +8,7 @@ abstract class DetailedItem(
|
||||
@Transient open val genres: List<Genre>,
|
||||
@Transient open val overview: String?,
|
||||
@Transient open val productionCompanies: List<ProductionCompany>,
|
||||
@Transient open val status: String,
|
||||
@Transient open val status: Status,
|
||||
@Transient open val tagline: String?,
|
||||
@Transient open val voteAverage: Float
|
||||
): TmdbItem(id, posterPath, title)
|
||||
@@ -5,17 +5,24 @@ import com.google.gson.annotations.SerializedName
|
||||
class DetailedMovie(
|
||||
id: Int,
|
||||
posterPath: String?,
|
||||
@SerializedName("original_title") override val title: String,
|
||||
@SerializedName("title") override val title: String,
|
||||
@SerializedName("backdrop_path") override val backdropPath: String?,
|
||||
@SerializedName("genres") override val genres: List<Genre>,
|
||||
@SerializedName("overview") override val overview: String?,
|
||||
@SerializedName("production_companies") override val productionCompanies: List<ProductionCompany>,
|
||||
@SerializedName("status") override val status: String,
|
||||
@SerializedName("status") override val status: Status,
|
||||
@SerializedName("tagline") override val tagline: String?,
|
||||
@SerializedName("vote_average") override val voteAverage: Float,
|
||||
@SerializedName("adult") val isAdult: Boolean,
|
||||
@SerializedName("budget") val budget: Int,
|
||||
@SerializedName("release_date") val releaseDate: String,
|
||||
@SerializedName("revenue") val revenue: Int,
|
||||
@SerializedName("runtime") val runtime: Int?
|
||||
@SerializedName("runtime") val runtime: Int?,
|
||||
@SerializedName("imdb_id") val imdbId: String?,
|
||||
@SerializedName("original_language") val originalLanguage: String,
|
||||
@SerializedName("popularity") val popularity: Float,
|
||||
@SerializedName("production_countries") val productionCountries: List<ProductionCountry>,
|
||||
@SerializedName("spoken_languages") val spokenLanguages: List<SpokenLanguage>,
|
||||
@SerializedName("original_title") val originalTitle: String,
|
||||
@SerializedName("vote_count") val voteCount: Int
|
||||
): DetailedItem(id, title, posterPath, backdropPath, genres, overview, productionCompanies, status, tagline, voteAverage)
|
||||
|
||||
@@ -10,7 +10,7 @@ class DetailedTv(
|
||||
@SerializedName("genres") override val genres: List<Genre>,
|
||||
@SerializedName("overview") override val overview: String?,
|
||||
@SerializedName("production_companies") override val productionCompanies: List<ProductionCompany>,
|
||||
@SerializedName("status") override val status: String,
|
||||
@SerializedName("status") override val status: Status,
|
||||
@SerializedName("tagline") override val tagline: String?,
|
||||
@SerializedName("vote_average") override val voteAverage: Float,
|
||||
@SerializedName("created_by") val createdBy: List<Person>,
|
||||
|
||||
@@ -5,5 +5,6 @@ import com.google.gson.annotations.SerializedName
|
||||
data class ProductionCompany(
|
||||
@SerializedName("id") val id: Int,
|
||||
@SerializedName("name") val name: String,
|
||||
@SerializedName("logo_path") val logoPath: String?
|
||||
@SerializedName("logo_path") val logoPath: String?,
|
||||
@SerializedName("origin_country") val originCountry: String
|
||||
)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.owenlejeune.tvtime.api.tmdb.model
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class ProductionCountry(
|
||||
@SerializedName("iso_3166_1") val language: String,
|
||||
@SerializedName("name") val name: String
|
||||
)
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.owenlejeune.tvtime.api.tmdb.model
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class SpokenLanguage(
|
||||
@SerializedName("iso_639_1") val language: String,
|
||||
@SerializedName("name") val name: String
|
||||
)
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.owenlejeune.tvtime.api.tmdb.model
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
enum class Status {
|
||||
@SerializedName("Rumoured")
|
||||
RUMOURED,
|
||||
@SerializedName("Planned")
|
||||
PLANNED,
|
||||
@SerializedName("In Production")
|
||||
IN_PRODUCTION,
|
||||
@SerializedName("Post Production")
|
||||
POST_PRODUCTION,
|
||||
@SerializedName("Released")
|
||||
RELEASED,
|
||||
@SerializedName("Canceled")
|
||||
CANCELED,
|
||||
@SerializedName("Returning Series")
|
||||
RETURNING_SERIES,
|
||||
@SerializedName("Ended")
|
||||
ENDED,
|
||||
@SerializedName("Pilot")
|
||||
PILOT,
|
||||
@SerializedName("Active")
|
||||
ACTIVE
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.owenlejeune.tvtime.ui.navigation
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.NavHost
|
||||
import androidx.navigation.NavHostController
|
||||
import com.owenlejeune.tvtime.R
|
||||
import com.owenlejeune.tvtime.api.tmdb.model.RatedMedia
|
||||
|
||||
@@ -104,26 +104,14 @@ fun DetailView(
|
||||
title = mediaItem.value?.title ?: "",
|
||||
)
|
||||
|
||||
Box(
|
||||
Modifier
|
||||
.clip(CircleShape)
|
||||
.size(60.dp)
|
||||
.background(color = MaterialTheme.colorScheme.surfaceVariant)
|
||||
RatingView(
|
||||
modifier = Modifier
|
||||
.constrainAs(ratingsView) {
|
||||
bottom.linkTo(titleText.top)
|
||||
start.linkTo(posterImage.end, margin = 20.dp)
|
||||
}
|
||||
) {
|
||||
RatingRing(
|
||||
modifier = Modifier.padding(5.dp),
|
||||
textColor = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
progress = mediaItem.value?.voteAverage?.let { it / 10 } ?: 0f,
|
||||
textSize = 14.sp,
|
||||
ringColor = MaterialTheme.colorScheme.primary,
|
||||
ringStrokeWidth = 4.dp,
|
||||
size = 50.dp
|
||||
)
|
||||
}
|
||||
},
|
||||
progress = mediaItem.value?.voteAverage?.let { it / 10 } ?: 0f
|
||||
)
|
||||
|
||||
BackButton(
|
||||
modifier = Modifier.constrainAs(backButton) {
|
||||
@@ -379,6 +367,29 @@ private fun BackButton(modifier: Modifier, appNavController: NavController) {
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RatingView(
|
||||
progress: Float,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.clip(CircleShape)
|
||||
.size(60.dp)
|
||||
.background(color = MaterialTheme.colorScheme.surfaceVariant)
|
||||
) {
|
||||
RatingRing(
|
||||
modifier = Modifier.padding(5.dp),
|
||||
textColor = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
progress = progress,
|
||||
textSize = 14.sp,
|
||||
ringColor = MaterialTheme.colorScheme.primary,
|
||||
ringStrokeWidth = 4.dp,
|
||||
size = 50.dp
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ContentColumn(
|
||||
modifier: Modifier,
|
||||
|
||||
@@ -63,7 +63,7 @@ object TmdbUtils {
|
||||
|
||||
fun getSeriesRun(series: DetailedTv): String {
|
||||
val startYear = getTvStartYear(series)
|
||||
val endYear = if (series.status == "Active") {
|
||||
val endYear = if (series.status == Status.ACTIVE) {
|
||||
getTvEndYear(series)
|
||||
} else {
|
||||
""
|
||||
|
||||
Reference in New Issue
Block a user