Skip to content

Instantly share code, notes, and snippets.

View es0329's full-sized avatar

Eric es0329

View GitHub Profile
@realsoc
realsoc / TheZebraSpacer.kt
Created November 20, 2023 21:20
Implementation of a Zebra Spacer on Android using Kotlin + Compose
private val backgroundColor = Color(0xFF593072)
private val primaryColor = Color(0xFFFFFF00)
@Composable
fun TheZebraSpacer(
color: Color,
modifier: Modifier = Modifier,
lineSpace: Dp = 10.dp,
strokeWidth: Dp = 3.dp
) {
@rodrigomartind
rodrigomartind / BasicInfiniteCompose.kt
Created June 6, 2023 21:35
The Art of Small Animations in Android with Jetpack Compose
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.detectDragGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.animation.core.EaseInOut
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource
import android.annotation.SuppressLint
import androidx.compose.animation.animateColor
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.tween
import androidx.compose.animation.core.updateTransition
import androidx.compose.foundation.Image
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.fillMaxSize
@Pasha831
Pasha831 / ModalBottomSheet.kt
Created January 25, 2023 13:17
ModalBottomSheetLayout for Material 3 Jetpack Compose
package com.hse.parkingapp.ui.beta.screens.components.material3
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@rodrigomartind
rodrigomartind / AnimationBlurEffect.kt
Created December 30, 2022 20:04
Animation Blur Effect in Jetpack Compose
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
@rodrigomartind
rodrigomartind / ImageVectorAnimationStepByStep.MD
Last active January 30, 2023 01:50
Animating ImageVector in JetpackCompose

Step by step of ImageVector animation in Jetpack Compose

Step 1

screen-recording-1671473917341.mp4

Step 1

screen-recording-1671473945880.mp4

Step 3

screen-recording-1671473974142.mp4
@vshivam
vshivam / AlphaPropertySerializer.kt
Last active November 15, 2022 02:08
When a mobile client interacts with backend, api contracts are subject to change heavily during the development phase. With this custom serializer we can ensure that it is "okay" to break contracts. Properties can be added, removed and updated without the fear of "older clients" breaking.
class AlphaPropertySerializer<T>(
private val valueSerializer: KSerializer<T>
) : KSerializer<AlphaProperty<T>> {
override val descriptor: SerialDescriptor = valueSerializer.descriptor
override fun deserialize(decoder: Decoder): AlphaProperty<T> {
decoder as JsonDecoder
val jsonElement: JsonElement = decoder.decodeJsonElement()
@Marlinski
Marlinski / BottomSheetScaffold.kt
Created October 23, 2022 21:48
port of BottomSheetScaffold for Material3
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software