Jasmine-liang / gitblog

"Peope Die, But Long Live Github"
0 stars 0 forks source link

Building record: Todo-list app using MVVM architecture #9

Open Jasmine-liang opened 3 years ago

Jasmine-liang commented 3 years ago

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?

Jasmine-liang commented 3 years ago

Day 2

Room with ViewModel, Coordinate example

Reference:

Jasmine-liang commented 3 years ago

Day 3

Add a Callback when the database object is initialized

There are two ways of adding a Callback:

Jasmine-liang commented 3 years ago

Day 4

Room vs DataStore, Why use DataSource for Menu ?

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

Preference DataStore, like SharedPreferences, accesses data based on keys, without defining a schema upfront.

Jasmine-liang commented 3 years ago

Day 5 (Update checked Tasks)

Jasmine-liang commented 3 years ago

Day 6 (Add Swipe-Delete-And-Undo)

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

Jasmine-liang commented 3 years ago

Day 7 (Navigate between fragments)

Use Safe Args to pass data between fragments