-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#108 Browse Movies and Shows by genre
- Loading branch information
Showing
44 changed files
with
607 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
core/ui/common/src/main/java/io/filmtime/core/ui/common/componnents/VideoThumbnailGrid.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package io.filmtime.core.ui.common.componnents | ||
|
||
import android.util.Log | ||
import androidx.compose.foundation.ExperimentalFoundationApi | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.aspectRatio | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.lazy.grid.GridCells | ||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import androidx.paging.compose.LazyPagingItems | ||
import io.filmtime.core.designsystem.plus | ||
import io.filmtime.data.model.VideoThumbnail | ||
import io.filmtime.data.model.VideoType | ||
|
||
@OptIn(ExperimentalFoundationApi::class) | ||
@Composable | ||
fun VideoThumbnailGrid( | ||
contentPadding: PaddingValues, | ||
pagedList: LazyPagingItems<VideoThumbnail>, | ||
onMovieClick: (tmdbId: Int) -> Unit, | ||
onShowClick: (tmdbId: Int) -> Unit, | ||
) { | ||
LazyVerticalGrid( | ||
columns = GridCells.Adaptive(100.dp), | ||
modifier = Modifier, | ||
contentPadding = contentPadding + PaddingValues(16.dp), | ||
horizontalArrangement = Arrangement.spacedBy(8.dp), | ||
verticalArrangement = Arrangement.spacedBy(8.dp), | ||
) { | ||
items( | ||
pagedList.itemCount, | ||
key = { index -> pagedList[index]?.ids?.tmdbId ?: index }, | ||
) { index -> | ||
val videoThumbnail = pagedList[index] | ||
if (videoThumbnail != null) { | ||
VideoThumbnailCard( | ||
modifier = Modifier | ||
.animateItemPlacement() | ||
.fillMaxWidth() | ||
.aspectRatio(2 / 3f), | ||
videoThumbnail = videoThumbnail, | ||
onClick = { | ||
videoThumbnail.ids.tmdbId?.let { | ||
when (videoThumbnail.type) { | ||
VideoType.Movie -> onMovieClick(it) | ||
VideoType.Show -> onShowClick(it) | ||
} | ||
} ?: run { | ||
Log.e("VideoThumbnailGrid", "tmdbId is null") | ||
} | ||
}, | ||
) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
data/model/src/main/java/io/filmtime/data/model/VideoGenre.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package io.filmtime.data.model | ||
|
||
data class VideoGenre( | ||
val id: Long, | ||
val name: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.