Advanced Kotlin Patterns on Android / Idiomatic Kotlin code on Android
- Safe fragments presentation
- Sealed classes presentation
-
A fragment made with Anko with a RecyclerView, its ViewHolder and item view
-
Crossinline one-liner anonymous classes
- parcelableCreator function, call-sites:
- FoodListFragment.DataSource.Popular (parcelable singleton)
- FoodListFragment.DataSource.FilterAndSort
- User
- CachedAsyncTaskLoader, call-site
- ClickableSpan, call-site
- TextWatcher, call-site
- parcelableCreator function, call-sites:
-
Reactive data binding via broadcasts
- bind() implementation
- ProfileFragment — usage sample
-
Safe fragments
- Unsafe fragment implementation, Unsafe call-site
- Safe fragment with deprecated no-arg constructor, normal constructor, and mode delegation; call-site
-
Coroutines Sample use, including
delay
and bindings to Retrofit. -
Sealed classes
- Object-oriented solution (contrary to original java.lang.reflect.Type), call-site
- Functional-style solution, call-site
- Option, Either
- sealed class Attachment, AttachmentsFragment use-site