You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The progressAnimation builder is currently JVM-only. On other platforms, you can still use t.animation { progressLayout { ... } } which will render the same widget, you’ll just need to call progress.build manually.
However, it's not clear how to achieve implement progressAnimation on non-JVM platforms... Looking at the existing JVM ProgressAnimation it's quite a complicated bit of code, and requires several internal functions which would have to be duplicated.
Suggestions
Update the docs to include a demonstration of how to do it in KMP
Convert ProgressAnimation to Kotlin Multiplatform. This would probably require adding a dependency on Kotlinx Coroutines, for synchronizing (currently done using the @Synchronized annotation) and running background tasks (currently done using a Java Timer).
I've had a stab at this, and it's possible. I've made a PR as a demonstration Convert ProgressAnimation to multiplatform #149. However, it might break GraalVM support... So an alternative would be to introduce a new ProgressAnimation that's compatible with coroutines - ProgressAnimationAsync (or something) - that is the same, but has suspend funs.
The text was updated successfully, but these errors were encountered:
I mentioned in #149 that I'm working on multiplatform support right now, but in the meantime you can animate it manually like this:
val progress = progressLayout {
progressBar()
}
val a = terminal.animation<Int> { progress.build(completed = it.toLong(), total =10) }
repeat(10) {
a.update(it)
delay(500)
}
Though you'll have to keep track of completedPerSecond yourself if you're showing it, and the framerates of all the cells will be the same. The new version I'm working on won't have those limitations.
Hi 👋
There's currently a note in the
progressAnimation {}
docs saying thatHowever, it's not clear how to achieve implement
progressAnimation
on non-JVM platforms... Looking at the existing JVM ProgressAnimation it's quite a complicated bit of code, and requires several internal functions which would have to be duplicated.Suggestions
Update the docs to include a demonstration of how to do it in KMP
Convert ProgressAnimation to Kotlin Multiplatform. This would probably require adding a dependency on Kotlinx Coroutines, for synchronizing (currently done using the
@Synchronized
annotation) and running background tasks (currently done using a Java Timer).I've had a stab at this, and it's possible. I've made a PR as a demonstration Convert ProgressAnimation to multiplatform #149. However, it might break GraalVM support... So an alternative would be to introduce a new ProgressAnimation that's compatible with coroutines - ProgressAnimationAsync (or something) - that is the same, but has
suspend fun
s.The text was updated successfully, but these errors were encountered: