Fixed last top/recent albums/artists half visible
This commit is contained in:
parent
fa191b0cf4
commit
1036b79a24
3 changed files with 27 additions and 32 deletions
|
@ -65,23 +65,13 @@ abstract class AbsPlayerControlsFragment(@LayoutRes layout: Int) : AbsMusicServi
|
||||||
seekBar?.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
|
seekBar?.setOnSeekBarChangeListener(object : SimpleOnSeekbarChangeListener() {
|
||||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||||
if (fromUser) {
|
if (fromUser) {
|
||||||
progressViewUpdateHelper.stop()
|
MusicPlayerRemote.seekTo(progress)
|
||||||
onUpdateProgressViews(
|
onUpdateProgressViews(
|
||||||
MusicPlayerRemote.songProgressMillis,
|
MusicPlayerRemote.songProgressMillis,
|
||||||
MusicPlayerRemote.songDurationMillis
|
MusicPlayerRemote.songDurationMillis
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
|
||||||
super.onStopTrackingTouch(seekBar)
|
|
||||||
MusicPlayerRemote.seekTo(seekBar.progress)
|
|
||||||
onUpdateProgressViews(
|
|
||||||
MusicPlayerRemote.songProgressMillis,
|
|
||||||
MusicPlayerRemote.songDurationMillis
|
|
||||||
)
|
|
||||||
progressViewUpdateHelper.start()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -267,7 +267,7 @@ class HomeFragment :
|
||||||
imageView.setOnClickListener {
|
imageView.setOnClickListener {
|
||||||
it.isClickable = false
|
it.isClickable = false
|
||||||
it.postDelayed({ it.isClickable = true }, 500)
|
it.postDelayed({ it.isClickable = true }, 500)
|
||||||
MusicPlayerRemote.playNext(songs)
|
MusicPlayerRemote.playNext(songs[index])
|
||||||
if (!MusicPlayerRemote.isPlaying) {
|
if (!MusicPlayerRemote.isPlaying) {
|
||||||
MusicPlayerRemote.playNextSong()
|
MusicPlayerRemote.playNextSong()
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,9 +117,9 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
||||||
layoutManager = linearLayoutManager()
|
layoutManager = linearLayoutManager()
|
||||||
scheduleLayoutAnimation()
|
scheduleLayoutAnimation()
|
||||||
}
|
}
|
||||||
libraryViewModel.recentSongs().observe(viewLifecycleOwner, { songs ->
|
libraryViewModel.recentSongs().observe(viewLifecycleOwner) { songs ->
|
||||||
songAdapter.swapDataSet(songs)
|
songAdapter.swapDataSet(songs)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun topPlayed() {
|
private fun topPlayed() {
|
||||||
|
@ -133,9 +133,9 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
||||||
adapter = songAdapter
|
adapter = songAdapter
|
||||||
layoutManager = linearLayoutManager()
|
layoutManager = linearLayoutManager()
|
||||||
}
|
}
|
||||||
libraryViewModel.playCountSongs().observe(viewLifecycleOwner, { songs ->
|
libraryViewModel.playCountSongs().observe(viewLifecycleOwner) { songs ->
|
||||||
songAdapter.swapDataSet(songs)
|
songAdapter.swapDataSet(songs)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadHistory() {
|
private fun loadHistory() {
|
||||||
|
@ -150,9 +150,9 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
||||||
adapter = songAdapter
|
adapter = songAdapter
|
||||||
layoutManager = linearLayoutManager()
|
layoutManager = linearLayoutManager()
|
||||||
}
|
}
|
||||||
libraryViewModel.observableHistorySongs().observe(viewLifecycleOwner, {
|
libraryViewModel.observableHistorySongs().observe(viewLifecycleOwner) {
|
||||||
songAdapter.swapDataSet(it)
|
songAdapter.swapDataSet(it)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadFavorite() {
|
private fun loadFavorite() {
|
||||||
|
@ -166,30 +166,35 @@ class DetailListFragment : AbsMainActivityFragment(R.layout.fragment_playlist_de
|
||||||
adapter = songAdapter
|
adapter = songAdapter
|
||||||
layoutManager = linearLayoutManager()
|
layoutManager = linearLayoutManager()
|
||||||
}
|
}
|
||||||
libraryViewModel.favorites().observe(viewLifecycleOwner, { songEntities ->
|
libraryViewModel.favorites().observe(viewLifecycleOwner) { songEntities ->
|
||||||
val songs = songEntities.map { songEntity -> songEntity.toSong() }
|
val songs = songEntities.map { songEntity -> songEntity.toSong() }
|
||||||
songAdapter.swapDataSet(songs)
|
songAdapter.swapDataSet(songs)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun loadArtists(title: Int, type: Int) {
|
private fun loadArtists(title: Int, type: Int) {
|
||||||
binding.toolbar.setTitle(title)
|
binding.toolbar.setTitle(title)
|
||||||
libraryViewModel.artists(type).observe(viewLifecycleOwner, { artists ->
|
val artistAdapter = artistAdapter(listOf())
|
||||||
binding.recyclerView.apply {
|
binding.recyclerView.apply {
|
||||||
adapter = artistAdapter(artists)
|
adapter = artistAdapter
|
||||||
layoutManager = gridLayoutManager()
|
layoutManager = gridLayoutManager()
|
||||||
}
|
}
|
||||||
})
|
libraryViewModel.artists(type).observe(viewLifecycleOwner) { artists ->
|
||||||
|
artistAdapter.swapDataSet(artists)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadAlbums(title: Int, type: Int) {
|
private fun loadAlbums(title: Int, type: Int) {
|
||||||
binding.toolbar.setTitle(title)
|
binding.toolbar.setTitle(title)
|
||||||
libraryViewModel.albums(type).observe(viewLifecycleOwner, { albums ->
|
val albumAdapter = albumAdapter(listOf())
|
||||||
binding.recyclerView.apply {
|
binding.recyclerView.apply {
|
||||||
adapter = albumAdapter(albums)
|
adapter = albumAdapter
|
||||||
layoutManager = gridLayoutManager()
|
layoutManager = gridLayoutManager()
|
||||||
}
|
}
|
||||||
})
|
libraryViewModel.albums(type).observe(viewLifecycleOwner) { albums ->
|
||||||
|
albumAdapter.swapDataSet(albums)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun artistAdapter(artists: List<Artist>): ArtistAdapter = ArtistAdapter(
|
private fun artistAdapter(artists: List<Artist>): ArtistAdapter = ArtistAdapter(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue