Skip to content

Instantly share code, notes, and snippets.

View GibsonRuitiari's full-sized avatar
🤯

Ruitiari GibsonRuitiari

🤯
View GitHub Profile
@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()