Focus on the following code. https://github.com/HabitRPG/habitica-android/blob/def26be8222fd5df49c7af03b1c4b4eec8666c64/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/tasks/TasksFragment.kt#L146-L162 The code handle filtering action and trigger Adaptor to be updated.
The model is on here. The repository is on here and use Realm.IO. In quick view, I see the Realm act as cache. For example in this repository, the tag from online database is synched with the local, by deleting unexist tags. After created, repository needs to be registered in this factory or provider class.