
Build a fully functional to-do app using Kansai with a Room database, navigation component, view model, and data binding in a clean architecture.
Explore the project's Gradle build script, plugins, and repositories, then review dependencies for navigation, lifecycle, view model, data binding, and Kotlin coroutines, all from GitHub as a preview.
At the time of creating this course I've used kotlinx.synthetics for getting reference to views, like in this example:
val view = inflater.inflate(R.layout.fragment_add, container, false)
But now kotlinx.synthetics is deprecated and we need to migrate to View Binding. I've already made a video about that migration so be sure to check out the last section of this course, lecture #51.
Thank you,
Stefan.
Learn to migrate from Kotlin Android extensions' synthetic imports to view binding, addressing deprecation and pointing to lecture 51 for migration steps.
Project Files available on Github.
Design the list fragment layout in an Android Kotlin project by converting to constraint layout, adding a recycler view and a floating action button, and configuring no-data icons.
Design the add fragment layout with constraint layout, including edit texts, a priorities spinner, and description, and wire the floating action button to navigate to add fragment.
Design the update fragment layout. Reuse views from the ad fragment; enable navigation from the list fragment via a route layout click listener; add a custom input background with focus.
setHasOptionsMenu() has been deprecated, there's a new way of handling the logic for the Menu. I've made an update video in the last section of this course, check it out.
setHasOptionsMenu() has been deprecated, there's a new way of handling the logic for the Menu. I've made an update video in the last section of this course, check it out.
setHasOptionsMenu() has been deprecated, there's a new way of handling the logic for the Menu. I've made an update video in the last section of this course, check it out.
Learn to implement transition animations between fragments in an Android app using Kotlin, creating enter, exit, pop enter, and pop exit animations and linking them in the navigation graph.
Discover the Room library and its architectural components, including entity, DAO, and database, that provide compile-time verified queries and reduced boilerplate for Android data persistence.
Create a priority model class with high, medium, and low constants to act as a database column, and set up a data package for Room database.
Create a Room entity class ToDoData to represent a database table, with id as auto-generated primary key and columns for title, priority, and description, using a data class.
Define a room annotated data access object interface for to-do data with get all data and insert queries, using suspend for background execution.
Create a ToDoDatabase annotated as a Room database for app data, linking the Todo entity and TodoDao. Implement a singleton getDatabase(context) with a synchronized block to ensure a single instance.
Implement a type converter in room to store a Priority enum as a string. Create functions to convert priority objects to strings and back, and apply it in the database.
Create a ToDoRepository that abstracts data access across sources with a clean API, connecting to the DAO to fetch all data and insert items.
Create a ToDoViewModel that extends AndroidViewModel to provide data from the repository to the UI. Use viewModelScope to insert data on a background thread and expose all data for observation.
Insert data into the room database from the ad fragment by collecting title, description, and priority, validating inputs, converting priority to an enum, and invoking the view model to save.
Now you don't need to use this DB Browser anymore, because Database Inspector Tool is available in Android Studio directly.
Create a shared view model to centralize verify data and priority handling, and share it between fragments to avoid duplicating code.
Color spinner items by priority in an Android Kotlin app using a shared view model and an on item selected listener, applying red, yellow, and green text colors.
Design a recycler view row layout to display database data, including a title, description, and a priority indicator circle, with a custom item background drawable and constraints.
Create a RecyclerView ListAdapter with a custom view holder, inflate the item layout, bind to-do data (title, description, priority), and color the priority card (red/high, yellow/medium, green/low) via setData.
Initialize a recycler view with a list adapter and linear layout manager, and observe get all data from the view model's live data to update the list when database changes.
Use safe args to pass a ToDoData object from the list fragment to the update fragment, enabling the update screen to display the selected item's title, description, and priority.
Learn to update a selected to-do item in Android using update fragment, shared view model, and room database. Handle input validation, data mapping, and navigation after saving.
Show how to delete all items from a Kotlin Android app database by adding a delete all query, wiring it to a menu item, and confirming with a dialog.
Toggle no data views by observing a mutable live data boolean in the shared view model, reacting to database emptiness in the list fragment.
From now on we don't need any data binding dependency. We can only add "databinding true" inside buildFeatures block of code in our gradle build file.
Implement data binding in the list fragment by creating binding adapters, converting layouts to data binding layouts, and binding a shared view model to observe empty database state.
Implement data binding for the update fragment and layout, populate fields from fragment args, and add a custom binding adapter named Paris priority to set the spinner selection.
Implement swipe to delete in a RecyclerView by creating an abstract SwipeToDelete class extending item touch helper and wiring it in the list fragment to remove items from the database.
Implement an undo feature for swipe-to-delete in the Android Kotlin to-do app by restoring a deleted item via a snackbar action, updating the adapter and re-inserting at the original position.
Implement DiffUtil to optimize recycler view updates by calculating differences between old and new lists and updating only changed items, wiring a diff callback into the adapter.
Enhance your Android RecyclerView with the Wasabi animations library, applying a custom item animator for insert, update, delete, and swipe actions, and customize duration with slide-in-up and landing effects.
Implement a searchable to-do app by adding a DAO query to search the database, observe live data, and update the recycler view in real time as users type.
Sort items by high and low priority using custom queries in the dao, expose results through the repository and view model, and observe live data to update the RecyclerView.
Swap linear layouts for recycler views to grid layouts with a span count, then switch to a vertical staggered grid to handle items of different heights.
So this course will be a little different from my previous ones, because in this course we are going to build a fully functional To-Do application. We are going to build our app using Kotlin programming language, and you'll see all the benefits and power of concise way of programming with Kotlin. Our To-Do app will combine different android architecture components like Navigation Component, ROOM database, LiveData, ViewModel, Data Binding and more...
You will learn how to follow the principle of single activity and multiple fragments in your app. You will learn how to use Navigation Component in your app, how to work with Safe Args to pass data between fragments, and also create custom made Transition Animations for your destinations.
So why is a To-Do app important, well first and foremost because it teaches you how to build and maintain a database, how to write SQL queries to insert, update, delete data from database, but also how to write custom queries to search through Database, Sort your database by certain criteria and display it in proper way to your RecyclerView.
Also we are going to have a clean architecture in our project, you will learn how to organize your project structure and maintain good code readability.
At the later section of this course I'm going to teach you how to implement data binding to your app, and you'll see all the benefits of using it, because we are going to have less boilerplate codes in our app, plus everything will be separated, and our fragments will look a lot cleaner and simple. You will also be introduced with custom BindingAdapters.
At the end of this course we will implement swipe to delete function to our RecyclerView, also I'll show you how to easily change RecyclerViewlayout, apply a different look to your app with Grid and Staggered Grid layout as well. And when we are talking about RecyclerView, I should also mention that we will implement DiffUtil in our app and that way, increase overall app performance.
Also I need to mention that this course is NOT for ABSOLUTE beginners in android development. Because this course assumes that you already have a basic knowledge of programming in Kotlin, and a basic knowledge of android architecture components.
But if you wish to continue improving your skills and building your knowledge furthermore then this course is definitely the right option for you.