Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright 2025 Kyriakos Georgiopoulos
*
* 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
@JunkFood02
JunkFood02 / Motion.kt
Last active July 19, 2024 11:57
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
@oleggreen
oleggreen / SwipeButton.kt
Created March 18, 2024 18:02
Swipable button example in Jetpack Compose
package com.oleg.green.swipe_button
import android.content.res.Configuration
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.Crossfade
import androidx.compose.animation.core.tween
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.AnchoredDraggableState
import androidx.compose.foundation.gestures.DraggableAnchors
@oguzhanaslann
oguzhanaslann / MarginState.kt
Last active April 17, 2025 10:10
WindowInsetsControllerCompat wrapper class to simplify the interface of it
/**
* Data class to hold margin states
*/
data class MarginState(
val left: Int,
val top: Int,
val right: Int,
val bottom: Int
)
@skaldebane
skaldebane / AngledSweepGradient.android.kt
Last active December 11, 2025 20:31
AngledSweepGradient - Sweep gradient implementation for Compose with a customizable start angle
import android.graphics.SweepGradient
import android.os.Build
import androidx.annotation.VisibleForTesting
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
import androidx.compose.ui.geometry.*
import androidx.compose.ui.graphics.*
import androidx.compose.ui.util.fastForEachIndexed
import androidx.core.graphics.transform
@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
@inidamleader
inidamleader / AutoSizeText.kt
Last active September 1, 2025 12:36
Composable function that automatically adjusts the text size to fit within given constraints with optimal performance by using a binary search algorithm. Compared to Google’s built-in solution, AutoSizeText offers greater precision, better multiline support, and improved control over layout behavior — all while remaining performance-friendly.
/*
MIT License
Copyright (c) 2024 Reda El Madini
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@tadfisher
tadfisher / AndroidUpdaterState.kt
Created June 1, 2022 18:00
In-app updates for Jetpack Compose
package com.mercury.app.updater
import android.app.Activity
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.IntentSenderRequest
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
@zach-klippenstein
zach-klippenstein / ComposableDumper.kt
Last active May 26, 2025 11:21
Simple utility to dump the current Composition tree to logcat.
import android.util.Log
import androidx.compose.runtime.Composable
import androidx.compose.runtime.currentComposer
import androidx.compose.runtime.remember
import androidx.compose.ui.unit.IntBounds
import androidx.ui.tooling.CallGroup
import androidx.ui.tooling.Group
import androidx.ui.tooling.NodeGroup
import androidx.ui.tooling.asTree
@bmaupin
bmaupin / free-database-hosting.md
Last active December 10, 2025 14:18
Free database hosting