Added suggestions
This commit is contained in:
parent
547e49507e
commit
06a52b1323
10 changed files with 45 additions and 15 deletions
|
@ -623,6 +623,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
|
|||
fragment: Fragment,
|
||||
tag: String
|
||||
) {
|
||||
|
||||
supportFragmentManager.commit {
|
||||
replace(R.id.fragment_container, fragment, tag)
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class HomeAdapter(
|
|||
.inflate(R.layout.section_recycler_view, parent, false)
|
||||
return when (viewType) {
|
||||
RECENT_ARTISTS, TOP_ARTISTS -> ArtistViewHolder(layout)
|
||||
PLAYLISTS -> PlaylistViewHolder(layout)
|
||||
FAVOURITES -> PlaylistViewHolder(layout)
|
||||
SUGGESTIONS -> {
|
||||
SuggestionsViewHolder(
|
||||
LayoutInflater.from(activity).inflate(
|
||||
|
@ -89,19 +89,19 @@ class HomeAdapter(
|
|||
val viewHolder = holder as ArtistViewHolder
|
||||
viewHolder.bindView(list[position].arrayList as List<Artist>, R.string.top_artists)
|
||||
}
|
||||
PLAYLISTS -> {
|
||||
val viewHolder = holder as PlaylistViewHolder
|
||||
viewHolder.bindView(
|
||||
list[position].arrayList as List<Playlist>,
|
||||
R.string.favorites
|
||||
)
|
||||
}
|
||||
SUGGESTIONS -> {
|
||||
val viewHolder = holder as SuggestionsViewHolder
|
||||
viewHolder.bindView(
|
||||
list[position].arrayList as List<Song>
|
||||
)
|
||||
}
|
||||
FAVOURITES -> {
|
||||
val viewHolder = holder as PlaylistViewHolder
|
||||
viewHolder.bindView(
|
||||
list[position].arrayList as List<Playlist>,
|
||||
R.string.favorites
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ class HomeAdapter(
|
|||
|
||||
companion object {
|
||||
|
||||
@IntDef(RECENT_ALBUMS, TOP_ALBUMS, RECENT_ARTISTS, TOP_ARTISTS, PLAYLISTS, SUGGESTIONS)
|
||||
@IntDef(RECENT_ALBUMS, TOP_ALBUMS, RECENT_ARTISTS, TOP_ARTISTS, SUGGESTIONS, FAVOURITES)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class HomeSection
|
||||
|
||||
|
@ -124,8 +124,8 @@ class HomeAdapter(
|
|||
const val TOP_ALBUMS = 1
|
||||
const val RECENT_ARTISTS = 2
|
||||
const val TOP_ARTISTS = 0
|
||||
const val SUGGESTIONS = 4
|
||||
const val PLAYLISTS = 5
|
||||
const val SUGGESTIONS = 5
|
||||
const val FAVOURITES = 4
|
||||
}
|
||||
|
||||
private inner class AlbumViewHolder(view: View) : AbsHomeViewItem(view) {
|
||||
|
|
|
@ -55,8 +55,8 @@ class LibraryViewModel(application: Application) :
|
|||
_repository.topAlbums(),
|
||||
_repository.recentArtists(),
|
||||
_repository.recentAlbums(),
|
||||
_repository.favoritePlaylist(),
|
||||
_repository.suggestions()
|
||||
_repository.suggestions(),
|
||||
_repository.favoritePlaylist()
|
||||
)
|
||||
for (r in result) {
|
||||
if (r != null) {
|
||||
|
|
|
@ -15,7 +15,6 @@ class AlbumsFragment :
|
|||
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(),
|
||||
MainActivityFragmentCallbacks {
|
||||
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mainActivity.libraryViewModel.allAlbums()
|
||||
|
|
|
@ -110,7 +110,7 @@ class RepositoryImpl constructor(private val context: Context) : Repository {
|
|||
val playlists = PlaylistLoader.getFavoritePlaylist(context)
|
||||
return if (playlists.isNotEmpty()) Home(
|
||||
playlists,
|
||||
HomeAdapter.PLAYLISTS,
|
||||
HomeAdapter.FAVOURITES,
|
||||
R.drawable.ic_favorite_white_24dp
|
||||
) else null
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue