Skip to content

Instantly share code, notes, and snippets.

View raghunandankavi2010's full-sized avatar
🤵‍♂️
Android dev looking to learn new technologies and always open for a new job.

Raghunandan Kavi raghunandankavi2010

🤵‍♂️
Android dev looking to learn new technologies and always open for a new job.
View GitHub Profile
/*
* Copyright 2026 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
package com.example.composelearning.animcompose
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
@raghunandankavi2010
raghunandankavi2010 / InstagramCarousel2.kt
Created October 2, 2025 11:16
Instagram Carousel with item selection
package com.example.composelearning.lists
import android.annotation.SuppressLint
import android.widget.Toast
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.FloatSpringSpec
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.calculateTargetValue
import androidx.compose.animation.splineBasedDecay
import androidx.compose.foundation.background
@raghunandankavi2010
raghunandankavi2010 / RetryCoroutines.kt
Created February 9, 2025 07:45
Retry with exponential back off coroutines
import kotlinx.coroutines.*
import java.io.IOException
suspend fun <T> retryIO(
times: Int = Int.MAX_VALUE,
initialDelay: Long = 100, // 0.1 second
maxDelay: Long = 1000, // 1 second
factor: Double = 2.0,
block: suspend () -> T
): T {
@raghunandankavi2010
raghunandankavi2010 / Retry.kt
Created February 9, 2025 07:38
Retry with exponential back off using flow
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import java.io.IOException
import kotlin.math.pow
fun <T> Flow<T>.retryWithExponentialBackoff(
times: Int,
initialDelay: Long,
factor: Double
): Flow<T> =
LaunchedEffect(greyAnimate,yellowAnimate,redAnimate,greenAnimate,redAnimate) {
launch {
greenAnimate.animateTo(
targetValue = 1f,
animationSpec = tween(durationMillis = 3000, easing = LinearEasing))
yellowAnimate.animateTo(
targetValue = 1f,
animationSpec = tween(durationMillis = 3000, easing = LinearEasing))
redAnimate.animateTo(
package com.example.composelearning.graphics
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.AnimationVector1D
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.BoxWithConstraints
@raghunandankavi2010
raghunandankavi2010 / Swipetodismiss.kt
Created May 14, 2023 10:46
Swipe to dismiss in Lazy Column
@ExperimentalMaterialApi
@Composable
fun Tutorial2_13Screen() {
val viewModel = MyViewModel()
TutorialContent(viewModel)
}
@ExperimentalMaterialApi
@Composable
private fun TutorialContent(viewModel: MyViewModel) {
package com.example.composelearning.lists
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.FloatSpringSpec
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.calculateTargetValue
import androidx.compose.animation.splineBasedDecay
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.horizontalDrag
@raghunandankavi2010
raghunandankavi2010 / CircularRowList
Created July 25, 2022 05:55
Circular Row List with scale and alpha using custom Layout
@Stable
interface CircularRowState {
val horizontalOffset: Float
val firstVisibleItem: Int
val lastVisibleItem: Int
val scaleX: Float
val scaleY: Float
val alphaValue: Float
suspend fun snapTo(value: Float)