Fix playing queue list above FAB
This commit is contained in:
parent
8ef8a3955f
commit
1e1f9b1a6b
2 changed files with 15 additions and 9 deletions
|
@ -14,6 +14,7 @@ import code.name.monkey.retromusic.activities.base.AbsMusicServiceActivity
|
|||
import code.name.monkey.retromusic.adapter.song.PlayingQueueAdapter
|
||||
import code.name.monkey.retromusic.extensions.applyToolbar
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote
|
||||
import code.name.monkey.retromusic.util.DensityUtil
|
||||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
|
||||
|
@ -21,7 +22,7 @@ import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
|
|||
import kotlinx.android.synthetic.main.activity_playing_queue.*
|
||||
|
||||
|
||||
class PlayingQueueActivity : AbsMusicServiceActivity() {
|
||||
open class PlayingQueueActivity : AbsMusicServiceActivity() {
|
||||
|
||||
private var wrappedAdapter: RecyclerView.Adapter<*>? = null
|
||||
private var recyclerViewDragDropManager: RecyclerViewDragDropManager? = null
|
||||
|
@ -29,7 +30,7 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
|
|||
private lateinit var linearLayoutManager: LinearLayoutManager
|
||||
|
||||
|
||||
protected fun getUpNextAndQueueTime(): String {
|
||||
private fun getUpNextAndQueueTime(): String {
|
||||
val duration = MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.position)
|
||||
|
||||
return MusicUtil.buildInfoString(
|
||||
|
@ -55,6 +56,7 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
|
|||
clearQueue.setOnClickListener {
|
||||
MusicPlayerRemote.clearQueue()
|
||||
}
|
||||
checkForPadding()
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
|
@ -76,7 +78,7 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
|
|||
MusicPlayerRemote.playingQueue,
|
||||
MusicPlayerRemote.position,
|
||||
R.layout.item_queue)
|
||||
wrappedAdapter = recyclerViewDragDropManager!!.createWrappedAdapter(playingQueueAdapter!!)
|
||||
wrappedAdapter = recyclerViewDragDropManager?.createWrappedAdapter(playingQueueAdapter!!)
|
||||
|
||||
linearLayoutManager = LinearLayoutManager(this)
|
||||
|
||||
|
@ -84,7 +86,7 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
|
|||
layoutManager = linearLayoutManager
|
||||
adapter = wrappedAdapter
|
||||
itemAnimator = animator
|
||||
recyclerViewDragDropManager!!.attachRecyclerView(this)
|
||||
recyclerViewDragDropManager?.attachRecyclerView(this)
|
||||
}
|
||||
|
||||
linearLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.position + 1, 0)
|
||||
|
@ -101,11 +103,17 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
|
|||
})
|
||||
}
|
||||
|
||||
private fun checkForPadding() {
|
||||
val height = DensityUtil.dip2px(this, 102f)
|
||||
recyclerView.setPadding(0, 0, 0, (height))
|
||||
}
|
||||
|
||||
override fun onQueueChanged() {
|
||||
if (MusicPlayerRemote.playingQueue.isEmpty()) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
checkForPadding()
|
||||
updateQueue()
|
||||
updateCurrentSong()
|
||||
}
|
||||
|
@ -124,13 +132,13 @@ class PlayingQueueActivity : AbsMusicServiceActivity() {
|
|||
}
|
||||
|
||||
private fun updateQueuePosition() {
|
||||
playingQueueAdapter!!.setCurrent(MusicPlayerRemote.position)
|
||||
playingQueueAdapter?.setCurrent(MusicPlayerRemote.position)
|
||||
resetToCurrentPosition()
|
||||
playerQueueSubHeader.text = getUpNextAndQueueTime()
|
||||
}
|
||||
|
||||
private fun updateQueue() {
|
||||
playingQueueAdapter!!.swapDataSet(MusicPlayerRemote.playingQueue, MusicPlayerRemote.position)
|
||||
playingQueueAdapter?.swapDataSet(MusicPlayerRemote.playingQueue, MusicPlayerRemote.position)
|
||||
resetToCurrentPosition()
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
android:id="@+id/appBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="0dp"
|
||||
app:elevation="0dp">
|
||||
app:liftOnScroll="true">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/collapsingToolbarLayout"
|
||||
|
@ -20,7 +19,6 @@
|
|||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:titleEnabled="false">
|
||||
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
|
|
Loading…
Reference in a new issue