Skip to content

Commit

Permalink
display explicit tag
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed May 4, 2024
1 parent a7f2f28 commit c8f53d7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ fun MediumScreen(component: MediumComponent) {
episodesFlow = component.episodes,
durationFlow = component.duration,
statusFlow = component.status,
isAdultFlow = component.isAdult,
modifier = Modifier.fillParentMaxWidth().padding(horizontal = 16.dp)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dev.datlag.aniflow.ui.navigation.screen.medium.component
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.List
import androidx.compose.material.icons.filled.NoAdultContent
import androidx.compose.material.icons.filled.OndemandVideo
import androidx.compose.material.icons.filled.RssFeed
import androidx.compose.material.icons.filled.Timelapse
Expand All @@ -17,6 +18,7 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.unit.dp
import coil3.compose.AsyncImage
import coil3.compose.rememberAsyncImagePainter
import dev.datlag.aniflow.SharedRes
import dev.datlag.aniflow.anilist.model.Medium
import dev.datlag.aniflow.anilist.type.MediaFormat
import dev.datlag.aniflow.anilist.type.MediaStatus
Expand All @@ -35,6 +37,7 @@ fun CoverSection(
episodesFlow: Flow<Int>,
durationFlow: Flow<Int>,
statusFlow: Flow<MediaStatus>,
isAdultFlow: Flow<Boolean>,
modifier: Modifier = Modifier
) {
Row(
Expand Down Expand Up @@ -84,6 +87,7 @@ fun CoverSection(
val episodes by episodesFlow.collectAsStateWithLifecycle(initialMedium.episodes)
val duration by durationFlow.collectAsStateWithLifecycle(initialMedium.avgEpisodeDurationInMin)
val status by statusFlow.collectAsStateWithLifecycle(initialMedium.status)
val isAdult by isAdultFlow.collectAsStateWithLifecycle(initialMedium.isAdult)

Row(
modifier = Modifier.fillMaxWidth(),
Expand All @@ -96,6 +100,19 @@ fun CoverSection(
)
Text(text = stringResource(format.text()))
}
if (isAdult) {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Icon(
imageVector = Icons.Default.NoAdultContent,
contentDescription = null
)
Text(text = stringResource(SharedRes.strings.explicit))
}
}
if (episodes > -1) {
Row(
modifier = Modifier.fillMaxWidth(),
Expand Down
1 change: 1 addition & 0 deletions composeApp/src/commonMain/moko-resources/base/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@
<string name="char_romaji_western">Romaji (Western Order)</string>
<string name="char_romaji">Romaji</string>
<string name="char_native">Native</string>
<string name="explicit">Explicit</string>
</resources>

0 comments on commit c8f53d7

Please sign in to comment.