Open Jasmine-liang opened 3 years ago
Reference:
There are two ways of adding a Callback:
.addCallback( obejct : RoomDatabase.Callback(){// implementation})
Here are some refs that helps to understand some related code:
android - RecycleView displaying only the first item - Stack Overflow
If you have a need for partial updates, referential integrity, or large/complex datasets, you should consider using Room instead of DataStore. DataStore is ideal for small or simple datasets and does not support partial updates or referential integrity.
Preference DataStore, like SharedPreferences, accesses data based on keys, without defining a schema upfront.
I followed this article Step by Step: RecyclerView Swipe to Delete and Undo, and learned how to implemented a custom UI for Swipe-Delete feature, this article also helps: Android RecyclerView Swipe To Delete And Undo
Also learned some insights about SingleLiveEvent: Android SingleLiveEvent Redux with Kotlin Flow | by Michael Ferguson | ProAndroidDev
task
object between TaskFragment
and Add/EditTaskFragment
, ref: Pass data between destinations | Android Developers
SavedStateHandle
to restore UI state when app’s process being stoppedThe scenario usually is: while you editing a task, you receive a phone call and leave the app in the background. We want what you just edited stays the same when you come back to the app. So you don't need to type it again:)
Ref: ViewModels: Persistence, onSaveInstanceState(), Restoring UI State and Loaders | Android Developers
Show case, code -> Todolist app
https://user-images.githubusercontent.com/63624438/118086286-48d24a80-b3f6-11eb-80eb-8394bd686de8.mp4
Day 1
Why Coordianate Layout?
Why Relative Layout?
RelativeLayout enables you to specify how child views are positioned relative to each other.
Trade-off using
@Parcelize
annotationWe know implementing
Parcelable
on an entity class so the entity object will be put into anIntent
object and passed between activities/fragment. Is it a good practice? What about Repository pattern? android - Is it good practice implementing Parcelable on a Room database entity? - Stack OverflowAdditional knowledge
ellipsize: What does ellipsize mean in android?
tool-attributes: Tools attributes reference tldr:
tools:text
means the text won't be generated into APK