This is a sample of Room.
The project has 5 modules.
- app-kotlin: CheeseRoom written in Kotlin
- app-java: CheeseRoom written in Sample
- app-start: CheeseRoom codelab in Kotlin
- common: This module has data such as cheese images
- playground: Demonstrates some techniques of Room
- MainActivity
- CheeseListFragment: shows the list of cheeses
- CheeseListViewModel
- CheeseDetailFragment: shows the detail of a selected cheese. User can mark it favorite.
- CheeseDetailViewModel
- CheeseListFragment: shows the list of cheeses
See Guide to App Architecture for the overall design of this layer.
- CheeseRepository
- CheeseApi : Web API (It actually returns a constant data, but just pretend that it is a synchronous network call.)
- CheeseDatabase : The main database
The database has only 1 table.
- Cheese: table
- id: primary key, integer
- name: text
- favorite: boolean
- Choose 'app-start' from the drop-down menu of the configurations.
- Read MainActivity.kt, CheeseListFragment.kt, and CheeseDetailFragment.kt.
- Finish TODOs in Cheese.kt.
- Finish TODOs in CheeseDatabase.kt.
- Finish TODOs in CheeseDao.kt.
- Finish TODOs in CheeseRepository.kt.
- Finish TODOs in CheeseListViewModel.kt and CheeseDetailViewModel.kt.
- Run CheeseDatabaseTest