Add Two New Fragments (Leaders and Single Player)

We’ve got a bunch of code to copy over to set up these screens. All the code needed for both views can be found in the Code folder under chapter-11/code-to-copy. You want to grab everything inside the leaders and players packages (except for PlayerListItem and PlayersAdapter), and both Player and PlayerStats need to be part of the entities list in BaseballDatabase:

 entities = [
» Player::​class​,
» PlayerStats::​class​,
  ScheduledGame::​class​,
  TeamStanding::​class
 ]

The BaseballRepository and BaseballDao classes can be copied over as well, as they contain the new functions for these two pages plus everything else we’ve added up to this point. The same is true for both data/Converters.kt ...

Get Kotlin and Android Development featuring Jetpack now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.