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 / 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))
@ardakazanci
ardakazanci / VerticalText.kt
Last active March 7, 2025 06:48
Vertical Text Jetpack Compose
@SuppressLint("WrongConstant")
@Composable
fun FallingVerticalText(modifier: Modifier = Modifier) {
val text = "「春は、曙。」"
val textSize = 64.sp
val infiniteTransition = rememberInfiniteTransition()
val offsets = text.mapIndexed { index, _ ->
infiniteTransition.animateFloat(
@ardakazanci
ardakazanci / SegmentedProgress.kt
Created February 1, 2025 05:04
Segmented Progress with Jetpack Compose
@Composable
fun SegmentedArcProgressIndicator(
progress: Float,
strokeWidth: Float = 48f,
maxAngle: Float = 160f,
gapAngle: Float = 15f,
backgroundColor: Color = Color(0xffCBE0E8),
progressColor: Brush = Brush.linearGradient(listOf(Color(0xff83B2D1), Color(0xff106AA7)))
) {
val animatedProgress by animateFloatAsState(
@ardakazanci
ardakazanci / SliceMenu.kt
Created November 30, 2024 07:44
Slice Menu in Jetpack Compose
@Composable
fun SliceMenu(modifier: Modifier = Modifier, onSliceClick: (Int) -> Unit) {
val slices = 6
val colors = listOf(
Brush.linearGradient(listOf(Color(0xFFFF1744), Color(0xFFFFC400))),
Brush.linearGradient(listOf(Color(0xFF1A237E), Color(0xFF2962FF))),
Brush.linearGradient(listOf(Color(0xFF00C853), Color(0xFF64DD17))),
Brush.linearGradient(listOf(Color(0xFFFF6D00), Color(0xFFFFAB00))),
Brush.linearGradient(listOf(Color(0xFFD500F9), Color(0xFF6200EA))),
Brush.linearGradient(listOf(Color(0xFF00BFA5), Color(0xFF00E5FF)))
@ardakazanci
ardakazanci / Maze.kt
Created November 22, 2024 17:31
Maze Generator Jetpack Compose
enum class CellType {
Space, Wall
}
data class MazeTile(val x: Int, val y: Int, var type: CellType = CellType.Wall)
@RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM)
class Maze(private val width: Int, private val height: Int) {
val maze: Array<Array<MazeTile>> = Array(height) { y ->
Array(width) { x -> MazeTile(x, y) }