Skip to content

Commit

Permalink
added indicator if episode not available
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed Nov 13, 2023
1 parent 05e78b8 commit f7a2159
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
Expand All @@ -24,16 +25,18 @@ import androidx.compose.ui.unit.toSize
import com.vanniktech.blurhash.BlurHash
import dev.datlag.burningseries.common.*
import dev.datlag.burningseries.model.Series
import kotlinx.coroutines.delay
import kotlin.math.roundToInt

@Composable
fun EpisodeItem(content: Series.Episode) {
val blurHash = remember(content.href) { BlurHash.random() }
val enabled = content.hosters.isNotEmpty()

Row(
modifier = Modifier.padding(vertical = 4.dp).fillMaxWidth().height(100.dp).onClick {

}.bounceClick(0.95F),
modifier = Modifier.padding(vertical = 4.dp).fillMaxWidth().height(100.dp).onClick(enabled) {
// ToDo("play episode")
}.ifTrue(enabled) { bounceClick(0.95F) }.ifFalse(enabled) { alpha(0.5F) },
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) {
Expand All @@ -55,15 +58,13 @@ fun EpisodeItem(content: Series.Episode) {
bitmap = it,
contentDescription = content.title
)
Box(modifier = Modifier.fillMaxSize().background(Color.Black.copy(alpha = 0.5F)))
Icon(
imageVector = Icons.Default.PlayCircleFilled,
contentDescription = content.title,
tint = Color.White
)
} ?: run {
Box(Modifier.fillMaxSize().background(MaterialTheme.colorScheme.primaryContainer))
}
} ?: Box(Modifier.fillMaxSize().background(MaterialTheme.colorScheme.primaryContainer))
Box(modifier = Modifier.fillMaxSize().background(Color.Black.copy(alpha = 0.5F)))
Icon(
imageVector = Icons.Default.PlayCircleFilled,
contentDescription = content.title,
tint = Color.White
)
}
Text(
text = content.number,
Expand Down

0 comments on commit f7a2159

Please sign in to comment.