
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 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.
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.
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.
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.
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 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.
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.
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.