Skip to content

Instantly share code, notes, and snippets.

View mayojava's full-sized avatar

Mayowa Adegeye mayojava

View GitHub Profile
@vishal2376
vishal2376 / SweepGradientImage.kt
Created May 25, 2024 15:25
Sweep Line effect with some rotation and scale animation
@Composable
fun SweepGradientImage(
imgResId: Int,
maxImgSize: Dp = 250.dp,
maxImgRotation: Float = -10f
) {
var animationPlayed by remember { mutableStateOf(false) }
val lineOffset by animateFloatAsState(
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
setContent {
ColorPickerTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
@c5inco
c5inco / HeartRate.kt
Last active June 1, 2024 10:44
Jetpack Compose implementation of inspiration: https://twitter.com/amos_gyamfi/status/1494053914945236999
package des.c5inco.material3
import android.graphics.Matrix
import android.graphics.Path
import androidx.compose.animation.core.*
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
@JoseAlcerreca
JoseAlcerreca / EventObserver.kt
Created April 26, 2018 12:14
An Observer for Events, simplifying the pattern of checking if the Event's content has already been handled.
/**
* An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has
* already been handled.
*
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled.
*/
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
override fun onChanged(event: Event<T>?) {
event?.getContentIfNotHandled()?.let { value ->
onEventUnhandledContent(value)