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
class Version { | |
var major: Int? | |
var minor: Int? | |
var patch: Int? | |
fun String.toVersion(): Version? { | |
val split = this.split(".") | |
return Version(split[0].toInt(), split[1].toInt(), split[2].toInt()) | |
} | |
} |
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
class Ticker { | |
val lastClosePrice = ... | |
fun refreshRealTimePrice(price: Double) { | |
val displayColor = when { | |
price < lastClosePrice: Colors.GREE | |
price > lastClosePrice: Colors.RED | |
price = lastClosePrice: Colors.WHITE | |
} | |
} |
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
@Composable | |
fun MovieInfoWidget( | |
posterUrl: String? = null, | |
movieName: String? = null, | |
isBookmark: Boolean = false, | |
rating: Float = 0.0f, | |
ratingTotalCountText: String? = null, | |
genres: String? = null, | |
releaseDateText: String? = null, | |
runtimeText: String? = 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
@Composable | |
fun MovieRatingWidget( | |
rating: Float = 0.0f, | |
textRating: String? = null | |
) { | |
Row( | |
verticalAlignment = Alignment.CenterVertically, | |
modifier = Modifier.padding(top = 8.dp) | |
) { | |
RatingBar( |
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
@Composable | |
fun MovieInfoWidget( | |
posterUrl: String? = null, | |
movieName: String? = null, | |
isBookmark: Boolean = false, | |
rating: Float = 0.0f, | |
ratingTotalCountText: String? = null, | |
genres: String? = null, | |
releaseDateText: String? = null, | |
runtimeText: String? = 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
@Preview | |
@Composable | |
fun MovieInfoWidgetPreview() { | |
MovieInfoWidget( | |
posterUrl = "https://image.tmdb.org/t/p/w780//or06FN3Dka5tukK1e9sl16pB3iy.jpg", | |
movieName = "Star Wars", | |
isBookmark = false, | |
rating = 4.3f, | |
ratingTotalCountText = "10 k", | |
genres = "Action, Science Fictions, Adventure", |
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
@Composable | |
fun MovieInfoWidget( | |
posterUrl: String? = null, | |
movieName: String? = null, | |
isBookmark: Boolean = false, | |
rating: Float = 0.0f, | |
ratingTotalCountText: String? = null, | |
genres: String? = null, | |
releaseDateText: String? = null, | |
runtimeText: String? = 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
@Composable | |
fun MovieInfoWidget( | |
posterUrl: String? = null, | |
movieName: String? = null, | |
isBookmark: Boolean = false, | |
rating: Float = 0.0f, | |
ratingTotalCountText: String? = null, | |
genres: String? = null, | |
releaseDateText: String? = null, | |
runtimeText: String? = 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
@Preview | |
@Composable | |
fun MovieInfoWidgetPreview() { | |
MovieInfoWidget( | |
posterUrl = "https://image.tmdb.org/t/p/w780//or06FN3Dka5tukK1e9sl16pB3iy.jpg", | |
movieName = "Star Wars", | |
isBookmark = false, | |
rating = 4.3f, | |
ratingTotalCountText = "10 k", | |
genres = "Action, Science Fictions, Adventure", |
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
fun bindData(movie: MovieDetail) { | |
val textMovieName = findViewById(R.id.textMovieName) | |
textMovieName.text = movie.name | |
val ratingBar = findViewById(R.id.movieRatingBar) | |
ratingBar.rating = movie.rating | |
... | |
} |