Android code piecesπŸ“±πŸ’»
23 subscribers
39 photos
3 videos
6 links
Sample and useful code pieces and tricks for Android and Kotlin
Download Telegram
The
OnBackPressedDispatcher
controls how Back button events are dispatched to one or more
OnBackPressedCallback
objects.

https://developer.android.com/reference/androidx/activity/OnBackPressedCallback
In Kotlin a "receiver" is the instance on which an extension function is defined, or the type for a lambda with receiver.

https://kotlinlang.org/docs/reference/annotations.html
If you want to iterate over all the entries of a known enum class, you can use the β€˜.values()’ function. If you are working with generic enums, you can use the β€˜enumValues()’ function instead.
JetPack Compose has a very strange
way of describing columns and rows.
The calls to StartScreenMiddleScreen, and EndScreen might happen in any order.

This means you can't, for example, have StartScreen() set some global variable (a side-effect) and have MiddleScreen() take advantage of that change.

Instead, each of those functions needs to be self-contained.
This media is not supported in your browser
VIEW IN TELEGRAM
We are finally getting the ability to animate Lazy list's item position changes in #JetpackCompose just like we did with DiffUtil πŸŽ‰

The Modifier API called `Modifier.animateItemPlacement()` was implemented and merged and will probably be released in an upcoming Compose version.