Closed adam-codersgu closed 1 year ago
Important: Note any RecyclerView adapters that have a header element e.g. Album/Playlist views will need to have + 1 added to the index of any content updates.
The interface could have two variables: contentIndex and adapterIndex (which could have + 1 if needed)
Important: Also note that for the RecyclerView updates to be effective, onClickListeners need to be assigned in the ViewHolder rather than onBindViewHolder, as demonstrated in AlbumAdapter
Working on branch enhancement/recycler_view_interface_inheritance
Completed and merged https://github.com/adam-codersgu/supernova/pull/44
In AlbumFragment, I have added a way of updating the RecyclerView that could potentially be applied to other similar UIs e.g. artist song view, song view etc. Could potentially explore using an interface to prevent code duplication? Perhaps also other methods in the interface could be used for updating RecyclerViews that display other types of content e.g. Playlist objects or artist names. In which case, perhaps some kind of interface hierarchy could be used where abstract methods are implemented as required. Need to ensure that each adapter type can be accessed in a similar way though. For example, this could potentially be done by referencing each adapter based on its supertype RecyclerView.Adapter()