Skip to content

Instantly share code, notes, and snippets.

View GibsonRuitiari's full-sized avatar
🤯

Ruitiari GibsonRuitiari

🤯
View GitHub Profile
@KlassenKonstantin
KlassenKonstantin / AnimatedFocusIndicator.kt
Created May 28, 2024 10:27
Animated focus indicator
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
BorderPathTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Box(
modifier = Modifier
.fillMaxSize()
@KlassenKonstantin
KlassenKonstantin / SharedTrans.kt
Last active November 14, 2024 17:03
Popup shared transition test
private val products = listOf(
Product("🍎", "Apples"),
Product("🍪", "Cookies"),
Product("🍉", "Watermelon"),
Product("🫐", "Blueberries"),
Product("🍊", "Oranges"),
Product("🍑", "Peaches"),
Product("🥦", "Broccoli"),
)
@Composable
fun HomeList(taskViewModel: ListViewModel = viewModel()) {
val coroutineScope = rememberCoroutineScope()
val scaffoldState = rememberScaffoldState()
val onShowSnackbar: (Task) -> Unit = { task ->
coroutineScope.launch {
val snackbarResult = scaffoldState.snackbarHostState.showSnackbar(
message = "${task.title} completed",
actionLabel = "Undo"
@Tea-Ayataka
Tea-Ayataka / Timer.kt
Created September 15, 2018 08:54
Kotlin Coroutine Timer
package net.ayataka.bas.utils
import kotlinx.coroutines.experimental.*
import net.ayataka.bas.LOGGER
import kotlin.system.measureTimeMillis
fun CoroutineScope.timer(interval: Long, fixedRate: Boolean = true, action: suspend TimerScope.() -> Unit): Job {
return launch {
val scope = TimerScope()