Deepak Gahlot
04/29/2021, 7:05 AMDeepak Gahlot
04/29/2021, 7:09 AMDeepak Gahlot
04/29/2021, 7:09 AMval isRotated = questionnaireViewModel.autoSaveStateFlow.collectAsState()
var currentDateTime = LocalDateTime.now()
val angle: Float by animateFloatAsState(
targetValue = if (isRotated.value) 360F else 0F,
animationSpec = tween(
durationMillis = 3000,
easing = FastOutSlowInEasing
)
)
coroutineScope.launch(<http://Dispatchers.IO|Dispatchers.IO>) {
//repeate Task Here
delay(10000)
questionnaireViewModel.setAutoSaveState(true)
Log.i("👀mylog", "run: running animation")
}
Deepak Gahlot
04/29/2021, 7:09 AMDeepak Gahlot
04/29/2021, 7:11 AMDeepak Gahlot
04/29/2021, 7:11 AMAlbert Chang
04/29/2021, 7:23 AMcoroutineScope.launch
saying Calls to launch should happen inside a LaunchedEffect and not composition
?Deepak Gahlot
04/29/2021, 7:34 AMDeepak Gahlot
04/29/2021, 7:35 AMAlbert Chang
04/29/2021, 7:38 AMrunning once every time the composition recomposesThis is likely wrong. Why do you want this?
Albert Chang
04/29/2021, 7:40 AMDeepak Gahlot
04/29/2021, 7:41 AMAlbert Chang
04/29/2021, 7:42 AMLaunchedEffect(questionnaireViewModel) {
while (true) {
dalay(10000)
questionnaireViewModel.setAutoSaveState(true)
}
}
Deepak Gahlot
04/29/2021, 7:53 AM