Skip to content

Instantly share code, notes, and snippets.

View ShivamKumarJha's full-sized avatar

Shivam Kumar Jha ShivamKumarJha

View GitHub Profile
@alexjlockwood
alexjlockwood / SegmentedControl.kt
Last active September 23, 2024 02:10
A simple animated segmented control component written with Jetpack Compose
package com.example.segmentedcontrol
import androidx.compose.animation.ExperimentalSharedTransitionApi
import androidx.compose.animation.animateBounds
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
@KlassenKonstantin
KlassenKonstantin / ListSections.kt
Last active August 13, 2024 02:47
List sections
@file:OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
package de.kuno.listsections
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateRectAsState
import androidx.compose.foundation.ExperimentalFoundationApi
@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
@file:OptIn(ExperimentalFoundationApi::class)
package de.apuri.springytabs
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.spring
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
@bentrengrove
bentrengrove / MatrixText.kt
Last active December 5, 2024 22:24
MatrixText.kt - A Composeable that displays text Matrix style down the screen
private const val MAX_SPEED = 25
private const val MIN_SPEED = 7
private const val MAX_FONT_SIZE = 64f
private const val MIN_FONT_SIZE = 24f
private val characters = listOf("ジ", "ェ", "ッ", "ト", "パ", "ッ", "ク", "構", "成")
private val colors = listOf(0xffcefbe4, 0xff81ec72, 0xff5cd646, 0xff54d13c, 0xff4ccc32, 0xff43c728)
@Composable
fun MatrixText(
stripCount: Int = 25,
lettersPerStrip: Int = 20,
@arcadefire
arcadefire / bottomsheet.kt
Created September 12, 2021 12:50
Bottom sheet
enum class States {
EXPANDED,
COLLAPSED
}
@ExperimentalMaterialApi
@Composable
fun FullHeightBottomSheet(
header: @Composable () -> Unit,
body: @Composable () -> Unit
@mwolfson
mwolfson / Color.kt
Last active March 27, 2024 07:28
Material Design Color Resources for Jetpack Compose
import androidx.compose.ui.graphics.Color
// Material Color Resources
val amber_050 = Color(0xFFfff8e1) // Use with black text
val amber_100 = Color(0xFFffecb3) // Use with black text
val amber_200 = Color(0xFFffe082) // Use with black text
val amber_300 = Color(0xFFffd54f) // Use with black text
val amber_400 = Color(0xFFffca28) // Use with black text
val amber_500 = Color(0xFFffc107) // Use with black text
@surajsau
surajsau / DragDropList.kt
Last active January 8, 2025 03:32
Drag-n-Drop implementation in Jetpack Compose
@Composable
fun DragDropList(
items: List<ReorderItem>,
onMove: (Int, Int) -> Unit,
modifier: Modifier = Modifier
) {
val scope = rememberCoroutineScope()
var overscrollJob by remember { mutableStateOf<Job?>(null) }
@JustJerem
JustJerem / CircularProgressIndicator.kt
Last active June 15, 2021 15:35
Progress circle showing an icon if completed.
import androidx.compose.animation.core.*
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset