Skip to content

Instantly share code, notes, and snippets.

View abualgait's full-sized avatar
📖
keep learning

Muhammad Sayed abualgait

📖
keep learning
View GitHub Profile
@ardakazanci
ardakazanci / AnimatedTextSwitcher.kt
Created June 11, 2024 17:02
Animated Text in Jetpack Compose
@Composable
fun AnimatedTextSwitcher() {
var isYellowBoxVisibility by remember { mutableStateOf(true) }
LaunchedEffect(Unit) {
while (true) {
delay(3000)
isYellowBoxVisibility = !isYellowBoxVisibility
}
}
@vishal2376
vishal2376 / FlipAnimation.kt
Created April 25, 2024 17:16
Card Flip Animation using Jetpack Compose
package com.vishal2376.animations.ui.theme
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.EaseInOut
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
//settings.gradle.kts
dependencyResolutionManagement {
repositories {
maven { url = uri("https://androidx.dev/snapshots/builds/11670047/artifacts/repository/") }
google()
mavenCentral()
maven(url = "https://plugins.gradle.org/m2/")
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
@PalankiBharat
PalankiBharat / DelayedClickModifier.kt
Created February 26, 2024 12:48
This is a Modifier extension used to delay a click by some time you can specify your own delay here to reduce unnecessary monkey clicks.
package com.bharatsdk.animationsexamples.ui
import androidx.compose.foundation.clickable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
@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()) {
@ardakazanci
ardakazanci / StickyFloatingDraggableButton.kt
Created January 16, 2024 19:04
Sticky Draggable Button for Jetpack Compose
@Composable
fun DraggableStickyButton() {
val context = LocalContext.current
val density = LocalDensity.current
val imageBitmap = remember {
val bitmap = BitmapFactory.decodeResource(context.resources, R.drawable.ball)
bitmap.asImageBitmap()
}
val screenWidthPx = with(density) { LocalConfiguration.current.screenWidthDp.dp.toPx() }
val screenHeightPx = with(density) { LocalConfiguration.current.screenHeightDp.dp.toPx() }
@ardakazanci
ardakazanci / TicTacToe.kt
Created January 8, 2024 16:49
Tic Tac Toe - Jetpack Compose
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
TicTacToeGameTheme {
TicTacToeGame()
}
}
}
@ardakazanci
ardakazanci / DraggableButton.kt
Created January 4, 2024 15:49
DraggableButton for jetpack compose
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
RotationButtonTheme {
RotatableDraggableImage()
}
}
}
@ardakazanci
ardakazanci / ScratchEffect.kt
Created January 1, 2024 16:55
Scratch Effect - Jetpack Compose
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
SampleUiDesignForCartTheme {
ScratchCardView()
}
}
}
@bmc08gt
bmc08gt / SettingsSection.kt
Created December 14, 2023 17:29
SettingsSectionScope
interface SettingsSectionScope {
fun item(
icon: ImageVector? = null,
title: String,
subtitle: String? = null,
endSlot: @Composable () -> Unit = { },
onClick: (() -> Unit)? = null,
)
@Composable