This file contains hidden or 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 ContinuousRipple( | |
| modifier: Modifier = Modifier, | |
| backgroundColor: Color = Color(0xFFF0F0F3), | |
| rings: Int = 3, | |
| durationMillis: Int = 10000 | |
| ) { | |
| val infinite = rememberInfiniteTransition() | |
| val clock = infinite.animateFloat( |
This file contains hidden or 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
| import androidx.compose.animation.AnimatedVisibility | |
| import androidx.compose.animation.core.* | |
| import androidx.compose.foundation.background | |
| import androidx.compose.foundation.layout.* | |
| import androidx.compose.foundation.shape.CircleShape | |
| import androidx.compose.foundation.shape.RoundedCornerShape | |
| import androidx.compose.material.* | |
| import androidx.compose.runtime.* | |
| import androidx.compose.ui.Alignment | |
| import androidx.compose.ui.ExperimentalComposeUiApi |
This file contains hidden or 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 TicketView() { | |
| Box( | |
| modifier = Modifier | |
| .size(400.dp) | |
| .padding(horizontal = 16.dp) | |
| .background( | |
| color = Color.White, | |
| shape = TicketShapeVertically(cornerRadius = 12.dp, cutoutRadius = 8.dp) | |
| ) |
This file contains hidden or 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
| // BAD: Direct dependency on Glide | |
| class ImageLoader { | |
| private val glide = Glide.with(context) | |
| fun load(url: String, imageView: ImageView) { | |
| glide.load(url).into(imageView) | |
| } | |
| } | |
| // GOOD: Depend on an abstraction |
This file contains hidden or 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 HeartBeatScreen( | |
| modifier: Modifier = Modifier | |
| ) { | |
| Box( | |
| modifier = modifier | |
| .fillMaxSize(), | |
| contentAlignment = Alignment.Center | |
| ) { | |
| AnimatedLayeredHearts(modifier) |
This file contains hidden or 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
| /** | |
| * Encapsulates the visual styling of a morphing blob. | |
| */ | |
| data class BlobStyle( | |
| val effect: BlobEffect = BlobEffect(), | |
| val shader: BlobShader = BlobShader.Radial(), | |
| val shape: BlobShape = BlobShape.Fill | |
| ) { | |
| companion object { | |
| fun default(): BlobStyle = BlobStyle() |