-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # app/src/main/java/com/sample/tmdb/ui/TMDbApp.kt # common/src/main/java/com/sample/tmdb/common/MainDestinations.kt # core/data/src/main/java/com/sample/tmdb/data/network/MovieService.kt # core/data/src/main/java/com/sample/tmdb/data/network/TVShowService.kt # core/data/src/main/java/com/sample/tmdb/data/repository/MovieDetailRepository.kt # core/data/src/main/java/com/sample/tmdb/data/repository/TVShowDetailRepository.kt # core/domain/src/main/java/com/sample/tmdb/domain/model/DetailWrapper.kt # core/domain/src/main/java/com/sample/tmdb/domain/repository/BaseDetailRepository.kt # features/feature-detail/src/main/java/com/sample/tmdb/detail/DetailScreen.kt # features/feature-detail/src/main/res/values/strings.xml
- Loading branch information
Showing
12 changed files
with
185 additions
and
60 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
58 changes: 58 additions & 0 deletions
58
common/src/main/java/com/sample/tmdb/common/ui/component/TMDbCard.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,58 @@ | ||
package com.sample.tmdb.common.ui.component | ||
|
||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.wrapContentHeight | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.Card | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import coil.compose.AsyncImage | ||
import com.sample.tmdb.common.model.TMDbItem | ||
import com.sample.tmdb.common.ui.Dimens | ||
import com.sample.tmdb.common.ui.theme.TmdbPagingComposeTheme | ||
|
||
@Composable | ||
fun TMDbCard( | ||
tmdbItem: TMDbItem, | ||
onFeedClick: (TMDbItem) -> Unit, | ||
imageUrl: String? = tmdbItem.posterUrl, | ||
itemWidth: Dp = 120.dp | ||
) { | ||
Card( | ||
modifier = Modifier | ||
.padding(Dimens.PaddingSmall) | ||
.clickable(onClick = { onFeedClick(tmdbItem) }), | ||
shape = RoundedCornerShape(10.dp) | ||
) { | ||
Column { | ||
AsyncImage( | ||
model = imageUrl, | ||
contentDescription = null, | ||
modifier = Modifier | ||
.size(width = itemWidth, height = 180.dp), | ||
contentScale = ContentScale.Crop | ||
) | ||
Text( | ||
text = tmdbItem.name, | ||
fontSize = TmdbPagingComposeTheme.fontSizes.sp_11, | ||
color = MaterialTheme.colors.onSurface, | ||
textAlign = TextAlign.Center, | ||
maxLines = 2, | ||
overflow = TextOverflow.Ellipsis, | ||
modifier = Modifier | ||
.size(width = itemWidth, height = 36.dp) | ||
.wrapContentHeight() | ||
) | ||
} | ||
} | ||
} |
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
5 changes: 4 additions & 1 deletion
5
core/domain/src/main/java/com/sample/tmdb/domain/model/DetailWrapper.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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
package com.sample.tmdb.domain.model | ||
|
||
import com.sample.tmdb.common.model.TMDbItem | ||
|
||
class DetailWrapper<T : TMDbItemDetails>( | ||
val cast: List<Cast>, | ||
val crew: List<Crew>, | ||
val details: T, | ||
val images: List<TMDbImage> | ||
val images: List<TMDbImage>, | ||
val similarItems: List<TMDbItem> | ||
) |
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.