Skip to content

Instantly share code, notes, and snippets.

@vishal2376
vishal2376 / Place.kt
Last active June 13, 2024 17:38
Image Reflection with cool animation using Jetpack Compose
data class Place(
val name: String,
val resId: Int
)
@vishal2376
vishal2376 / FlipAnimation.kt
Created April 25, 2024 17:16
Card Flip Animation using Jetpack Compose
package com.vishal2376.animations.ui.theme
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.EaseInOut
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@JunkFood02
JunkFood02 / Motion.kt
Last active May 24, 2024 21:31
A music player demo made with Jetpack Compose animation APIs, including shared element transition, list animations, animated content, etc.
package com.example.compose_debug
import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.Easing
import androidx.compose.animation.core.FastOutLinearInEasing
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.PathEasing
@JunkFood02
JunkFood02 / CardExpandContainerTransform.kt
Last active April 22, 2024 01:48
Container transform for cards (🐈 included)
@file:OptIn(
ExperimentalSharedTransitionApi::class,
ExperimentalMaterial3Api::class
)
package com.example.compose_debug
import android.util.Log
import androidx.activity.compose.BackHandler
import androidx.annotation.DrawableRes
@KlassenKonstantin
KlassenKonstantin / SharedTrans.kt
Last active May 24, 2024 21:32
Popup shared transition test
private val products = listOf(
Product("🍎", "Apples"),
Product("🍪", "Cookies"),
Product("🍉", "Watermelon"),
Product("🫐", "Blueberries"),
Product("🍊", "Oranges"),
Product("🍑", "Peaches"),
Product("🥦", "Broccoli"),
)
//settings.gradle.kts
dependencyResolutionManagement {
repositories {
maven { url = uri("https://androidx.dev/snapshots/builds/11670047/artifacts/repository/") }
google()
mavenCentral()
maven(url = "https://plugins.gradle.org/m2/")
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
@KlassenKonstantin
KlassenKonstantin / Pull2Refresh.kt
Created March 26, 2024 11:23
Fitbit style Pull 2 Refresh
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
setContent {
P2RTheme {
// A surface container using the 'background' color from the theme
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
CompositionLocalProvider(
LocalOverscrollConfiguration provides null // Disable overscroll otherwise it consumes the drag before we get the chance
@michalguspiel
michalguspiel / SwiftUIComponent.swift
Created March 15, 2024 11:59
Swift UI in Compose Multiplatform
class TheFactory: Factory {
func makeController() -> UIViewController {
MySwiftUIViewController()
}
}
// Create your SwiftUI view
struct MySwiftUIView: View {
var body: some View {
Text("Hello, SwiftUI!")
@halilozercan
halilozercan / DrawGlyphs.kt
Created October 1, 2023 20:30
A Set of helper functions and classes to draw each individual glyph separately
import androidx.compose.ui.draw.drawWithCache
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.ImageBitmap
@Josuhu
Josuhu / GoogleBilling
Created December 16, 2022 07:18
Google Billing and In app purchases
import android.app.Activity
import android.content.Context
import android.util.Log
import androidx.compose.runtime.mutableStateOf
import com.android.billingclient.api.*
import com.android.billingclient.api.Purchase
import com.holdtorun.serverdog.application.dataStore
import com.holdtorun.serverdog.secrets.BillingId
import com.holdtorun.serverdog.tools.MyLogging
import com.holdtorun.serverdog.tools.MyToasts