Ideally, our classes referencing music items (e.g. TopMusic, Track) should be refactored such that we have a single 'MusicDetailsFragment', since they have similar use-cases. I started work on this awhile back (by creating an abstract MusicEntity class) but ran into some issues.
Namely, when data-binding the MusicDetails layout, we would need to know at runtime whether we're binding TopMusic or Tracks. I'm sure there's a canonical way to do this, but binding through the XML seems problematic with this approach.
Ideally, our classes referencing music items (e.g. TopMusic, Track) should be refactored such that we have a single 'MusicDetailsFragment', since they have similar use-cases. I started work on this awhile back (by creating an abstract MusicEntity class) but ran into some issues.
Namely, when data-binding the MusicDetails layout, we would need to know at runtime whether we're binding TopMusic or Tracks. I'm sure there's a canonical way to do this, but binding through the XML seems problematic with this approach.