add tagline to details

This commit is contained in:
Owen LeJeune
2022-03-03 14:38:18 -05:00
parent 70370c0600
commit 2605f6b3f4
3 changed files with 73 additions and 46 deletions

View File

@@ -1,26 +1,27 @@
package com.owenlejeune.tvtime.api.tmdb.model package com.owenlejeune.tvtime.api.tmdb.model
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.owenlejeune.tvtime.R
enum class Status { enum class Status(val stringRes: Int) {
@SerializedName("Rumoured") @SerializedName("Rumoured")
RUMOURED, RUMOURED(R.string.status_rumoured),
@SerializedName("Planned") @SerializedName("Planned")
PLANNED, PLANNED(R.string.status_planned),
@SerializedName("In Production") @SerializedName("In Production")
IN_PRODUCTION, IN_PRODUCTION(R.string.status_in_production),
@SerializedName("Post Production") @SerializedName("Post Production")
POST_PRODUCTION, POST_PRODUCTION(R.string.status_post_production),
@SerializedName("Released") @SerializedName("Released")
RELEASED, RELEASED(R.string.status_released),
@SerializedName("Canceled") @SerializedName("Canceled")
CANCELED, CANCELED(R.string.status_canceled),
@SerializedName("Returning Series") @SerializedName("Returning Series")
RETURNING_SERIES, RETURNING_SERIES(R.string.status_returning_series),
@SerializedName("Ended") @SerializedName("Ended")
ENDED, ENDED(R.string.status_ended),
@SerializedName("Pilot") @SerializedName("Pilot")
PILOT, PILOT(R.string.status_pilot),
@SerializedName("Active") @SerializedName("Active")
ACTIVE ACTIVE(R.string.status_active)
} }

View File

@@ -20,6 +20,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
@@ -412,8 +413,8 @@ private fun ContentColumn(
MiscTvDetails(mediaItem = mediaItem, service as TvService) MiscTvDetails(mediaItem = mediaItem, service as TvService)
} }
if (mediaItem.value?.overview?.isNotEmpty() == true) { if (itemId != null && mediaItem.value != null) {
OverviewCard(itemId = itemId!!, mediaItem.value!!.overview!!, service) OverviewCard(itemId = itemId, mediaItem.value!!, service)
} }
CastCard(itemId = itemId, service = service, appNavController = appNavController) CastCard(itemId = itemId, service = service, appNavController = appNavController)
@@ -664,13 +665,14 @@ private fun RatingDialog(showDialog: MutableState<Boolean>, onValueConfirmed: (F
} }
@Composable @Composable
private fun OverviewCard(itemId: Int, overview: String, service: DetailService, modifier: Modifier = Modifier) { private fun OverviewCard(itemId: Int, mediaItem: DetailedItem, service: DetailService, modifier: Modifier = Modifier) {
val keywordResponse = remember { mutableStateOf<KeywordsResponse?>(null) } val keywordResponse = remember { mutableStateOf<KeywordsResponse?>(null) }
if (keywordResponse.value == null) { if (keywordResponse.value == null) {
fetchKeywords(itemId, service, keywordResponse) fetchKeywords(itemId, service, keywordResponse)
} }
val context = LocalContext.current val context = LocalContext.current
mediaItem.overview?.let { overview ->
ContentCard( ContentCard(
modifier = modifier modifier = modifier
) { ) {
@@ -681,6 +683,14 @@ private fun OverviewCard(itemId: Int, overview: String, service: DetailService,
.padding(vertical = 12.dp, horizontal = 16.dp), .padding(vertical = 12.dp, horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(8.dp) verticalArrangement = Arrangement.spacedBy(8.dp)
) { ) {
mediaItem.tagline?.let { tagline ->
Text(
text = tagline,
color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodyLarge,
fontStyle = FontStyle.Italic
)
}
Text( Text(
text = overview, text = overview,
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
@@ -702,6 +712,7 @@ private fun OverviewCard(itemId: Int, overview: String, service: DetailService,
} }
} }
} }
}
} }
@Composable @Composable

View File

@@ -12,8 +12,13 @@
<string name="nav_upcoming_title">Upcoming</string> <string name="nav_upcoming_title">Upcoming</string>
<string name="nav_tv_airing_today_title">Airing Today</string> <string name="nav_tv_airing_today_title">Airing Today</string>
<string name="nav_tv_on_the_air">On The Air</string> <string name="nav_tv_on_the_air">On The Air</string>
<string name="nav_account_title">Account</string>
<string name="nav_rated_movies_title">Rated Movies</string>
<string name="nav_rated_shows_title">Rated TV Shows</string>
<string name="nav_rated_episodes_title">Rated TV Episodes</string>
<string name="nav_people_title">People</string>
<!-- --> <!-- Headings -->
<string name="cast_label">Cast</string> <string name="cast_label">Cast</string>
<string name="recommended_label">Recommended</string> <string name="recommended_label">Recommended</string>
<string name="videos_label">Videos</string> <string name="videos_label">Videos</string>
@@ -48,14 +53,24 @@
<string name="video_type_teaser">Teasers</string> <string name="video_type_teaser">Teasers</string>
<string name="video_type_behind_the_scenes">Behind the Scenes</string> <string name="video_type_behind_the_scenes">Behind the Scenes</string>
<string name="video_type_featureette">Featurettes</string> <string name="video_type_featureette">Featurettes</string>
<string name="content_description_back_button">Back</string> <string name="content_description_back_button">Back</string>
<string name="search_icon_content_descriptor">Search Icon</string> <string name="search_icon_content_descriptor">Search Icon</string>
<string name="rating_dialog_title">Add a Rating</string> <string name="rating_dialog_title">Add a Rating</string>
<string name="rating_dialog_confirm">Submit rating</string> <string name="rating_dialog_confirm">Submit rating</string>
<string name="action_cancel">Cancel</string> <string name="action_cancel">Cancel</string>
<string name="nav_account_title">Account</string>
<string name="nav_rated_movies_title">Rated Movies</string> <!-- status -->
<string name="nav_rated_shows_title">Rated TV Shows</string> <string name="status_rumoured">Rumoured</string>
<string name="nav_rated_episodes_title">Rated TV Episodes</string> <string name="status_planned">Planned</string>
<string name="nav_people_title">People</string> <string name="status_in_production">In Production</string>
<string name="status_post_production">Post Production</string>
<string name="status_released">Released</string>
<string name="status_canceled">Canceled</string>
<string name="status_returning_series">Returning Series</string>
<string name="status_ended">Ended</string>
<string name="status_pilot">Pilot</string>
<string name="status_active">Active</string>
</resources> </resources>