Skip to content

Instantly share code, notes, and snippets.

View ardakazanci's full-sized avatar
:bowtie:
E=mc^2

Arda K. ardakazanci

:bowtie:
E=mc^2
View GitHub Profile
@ardakazanci
ardakazanci / Parallax.kt
Created August 7, 2025 18:29
Jetpack Compose Parallax Concept
@Composable
fun Modifier.parallaxHeader(
listState: LazyListState,
headerHeightDp: Dp,
maxStretchFactor: Float = 3.0f,
pullMultiplier: Float = 1.5f,
onHeightChanged: (Dp) -> Unit
): Modifier {
val density = LocalDensity.current
val coroutineScope = rememberCoroutineScope()
@ardakazanci
ardakazanci / KeyboardInsets.kt
Created July 27, 2025 12:05
Keyboard Animation Insets with Jetpack Compose
@Composable
fun KeyboardWindowInsets(modifier: Modifier = Modifier) {
val coroutineScope = rememberCoroutineScope()
val verticalOffset = remember { Animatable(0f) }
var email by remember { mutableStateOf("") }
var sliderValue by remember { mutableFloatStateOf(1f) }
val isValidEmail = remember(email) {
Patterns.EMAIL_ADDRESS.matcher(email).matches()
}
@ardakazanci
ardakazanci / StretchTabComponent.kt
Created July 19, 2025 06:32
Stretch Tab Jetpack Compose
data class TabPosition(val left: Float, val right: Float)
@Composable
fun StretchTabComponent() {
val tabs = listOf("SALE", "RENT")
var selectedIndex by remember { mutableIntStateOf(0) }
val tabPositions = remember { mutableStateListOf<TabPosition>() }
val startX = remember { Animatable(0f) }
val endX = remember { Animatable(0f) }
val scope = rememberCoroutineScope()
@ardakazanci
ardakazanci / RockPaperScissors.kt
Created July 7, 2025 16:31
RockPaperScissors Jetpack Compose
@Stable
data class Particle(
val id: Int, // stable key
val type: MutableState<RPS>,
val x: MutableState<Float>,
val y: MutableState<Float>,
val dx: MutableState<Float>,
val dy: MutableState<Float>
)
@ardakazanci
ardakazanci / BottomNavigationNavigation3.kt
Created June 4, 2025 08:30
BottomNavigation with Jetpack Navigation3
@Serializable
sealed interface AppScreenKey : NavKey
@Serializable
sealed interface RootScreenKey : AppScreenKey {
@Serializable object Home : RootScreenKey
@Serializable object Profile : RootScreenKey
@Serializable object Settings : RootScreenKey
}
@ardakazanci
ardakazanci / HeartLove.kt
Created June 2, 2025 06:54
Press L for Love Jetpack Compose
@Composable
fun FloatingHeartsAnimation() {
var showHearts by remember { mutableStateOf(false) }
val heartList = remember { mutableStateListOf<Int>() }
var sliderValue by remember { mutableFloatStateOf(0.5f) }
val scale = remember { Animatable(1f) }
val scope = rememberCoroutineScope()
val config = HeartConfig(
radiusMultiplier = lerp(0.5f, 2f, sliderValue),
@ardakazanci
ardakazanci / Stepper.kt
Created May 30, 2025 17:14
Stepper with Jetpack Compose
@Composable
fun Stepper(
modifier: Modifier = Modifier,
initialValue: Int = 16,
onValueChange: (Int) -> Unit = {}
) {
var value by remember { mutableIntStateOf(initialValue) }
var dragOffset by remember { mutableFloatStateOf(0f) }
var isDragging by remember { mutableStateOf(false) }
val thresholdPx = with(LocalDensity.current) {
@ardakazanci
ardakazanci / navigation3.kt
Created May 21, 2025 16:57
Navigation3 ViewModel Playground Gist with Jetpack Compose
@Serializable
sealed interface ScreenKey : NavKey {
@Serializable object List : ScreenKey
@Serializable data class Detail(val itemId: String) : ScreenKey
}
class DetailViewModel : ViewModel() {
var clickCount by mutableStateOf(0)
fun onClicked() { clickCount++ }
@ardakazanci
ardakazanci / CheckboxSwitcher.kt
Created May 10, 2025 13:34
CheckBox Switcher with Jetpack Compose
@Composable
fun CheckBoxSwitcherComponent() {
var isChecked by remember { mutableStateOf(false) }
var cornerRadius by remember { mutableStateOf(16f) }
var shadowElevation by remember { mutableStateOf(12f) }
var scaleFactor by remember { mutableStateOf(0.93f) }
var iconSize by remember { mutableStateOf(24f) }
val sliderColors = SliderDefaults.colors(
thumbColor = Color(0xFF4CAF50),
@ardakazanci
ardakazanci / MeasureBuildTime.sh
Created February 10, 2025 15:38
Daily Measure Build Time
#!/bin/bash
LOG_FILE="build_times.log"
START_TIME=$(date +%s)
echo "Starting Gradle Build..."
./gradlew assembleDebug
END_TIME=$(date +%s)
BUILD_TIME=$((END_TIME - START_TIME))