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 / RulerView.kt
Created April 28, 2024 06:15
RulerView - Jetpack Compose
@Composable
fun RulerView(
startValue: Int,
endValue: Int,
step: Int
) {
val density = LocalDensity.current
val scrollState = rememberScrollState()
val sectionWidth = 80.dp
var sliderValue by remember { mutableFloatStateOf(0.5f) }
@ardakazanci
ardakazanci / Bar.kt
Created April 24, 2024 15:49
Bar with JetpackCompose
data class BarDataM(val value: Float, val label: String)
@Composable
fun BarChartComponent(
bars: List<BarDataM>,
barWidth: Dp,
spaceBetweenBars: Dp,
animateChart: Boolean
) {
var selectedBar by remember { mutableIntStateOf(-1) }
@ardakazanci
ardakazanci / FlipCard.kt
Created April 21, 2024 10:27
Flip Card with Jetpack Compose
@Composable
fun FlipActionScreen() {
var flippedState by remember { mutableStateOf(false) }
val rotationY by animateFloatAsState(
targetValue = if (flippedState) 180f else 0f,
animationSpec = spring(
dampingRatio = Spring.DampingRatioHighBouncy,
stiffness = Spring.StiffnessVeryLow
)
)
@ardakazanci
ardakazanci / CircularMenuGroup.kt
Created April 10, 2024 07:33
Circular Menu Group with Jetpack Compose
@Composable
fun CircularMenuGroup(
icons: List<ImageVector>,
baseRadius: Float,
modifier: Modifier = Modifier,
backgroundColor: Color = Color(0xFF21FA90),
shadowElevation: Dp = 4.dp
) {
var selectedIndex by remember { mutableIntStateOf(-1) }
var sizeSliderValue by remember { mutableFloatStateOf(1f) }
@ardakazanci
ardakazanci / CardExpandContainerTransform.kt
Created April 9, 2024 15:35 — forked from JunkFood02/CardExpandContainerTransform.kt
Container transform for cards (🐈 included)
@file:OptIn(
ExperimentalSharedTransitionApi::class, ExperimentalMaterial3Api::class
)
package com.example.compose_debug
import androidx.activity.compose.BackHandler
import androidx.annotation.DrawableRes
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedVisibilityScope
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
setContent {
ColorPickerTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
@ardakazanci
ardakazanci / AdbCommands
Created March 16, 2024 15:01 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@ardakazanci
ardakazanci / shared_app_bar_final.kt
Created March 10, 2024 18:29 — forked from fvilarino/shared_app_bar_final.kt
Shared App Bar - Final
val HomeRoute = "home"
val SettingsRoute = "settings"
val ManyOptionsRoute = "manyOptions"
val NoAppBarRoute = "noAppBar"
sealed interface Screen {
val route: String
val isAppBarVisible: Boolean
val navigationIcon: ImageVector?
val navigationIconContentDescription: String?
@ardakazanci
ardakazanci / MetaballEffect.kt
Created February 20, 2024 17:06
Jetpack Compose MetaBall Effect
@Composable
fun MetaballEffect() {
var targetAngle by remember { mutableStateOf(0f) }
val animatedAngle by animateFloatAsState(
targetValue = targetAngle,
animationSpec = tween(durationMillis = 1000)
)
var toggle by remember { mutableStateOf(false) }
@ardakazanci
ardakazanci / InteractiveTouchCanvas.kt
Created February 15, 2024 18:09
Interactive Canvas for jetpack compose
@Composable
fun InteractiveCanvas(maxWidth: Int, maxHeight: Int) {
val random = remember { Random.Default }
var touchPosition by remember { mutableStateOf(Offset.Unspecified) }
val heartSize = 75F
val heartPath = createHeartPath(heartSize)
val heartOffsets = remember { mutableStateListOf<Offset>() }
val heartColors = remember { mutableStateListOf<Color>() }
if (heartOffsets.isEmpty()) {