Skip to content

Instantly share code, notes, and snippets.

View enginebai's full-sized avatar
📈
Focusing, Learning, Improving, Evolving

Engine Bai enginebai

📈
Focusing, Learning, Improving, Evolving
View GitHub Profile
class Ticker {
val lastClosePrice = ...
fun refreshRealTimePrice(price: Double) {
val displayColor = when {
price < lastClosePrice: Colors.GREE
price > lastClosePrice: Colors.RED
price = lastClosePrice: Colors.WHITE
}
}
@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,
@Composable
fun MovieRatingWidget(
rating: Float = 0.0f,
textRating: String? = null
) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(top = 8.dp)
) {
RatingBar(
@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,
@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",
@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,
@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,
@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",
fun bindData(movie: MovieDetail) {
val textMovieName = findViewById(R.id.textMovieName)
textMovieName.text = movie.name
val ratingBar = findViewById(R.id.movieRatingBar)
ratingBar.rating = movie.rating
...
}
.enginebai.moviehunt # Root Package
├── data # For data modeling layer
│ ├── local # Local persistence database
| │ ├── dao # Data Access Object for Room
| | ├── model # Model classes
│ ├── remote # Remote data source
│ └── repo # Repositories for single source of data
|
├── di # Dependency injection modules