Fixed a rare crash because of notifyDataSetChanged in Now playing ViewPager
This commit is contained in:
parent
88b0299ef9
commit
dba4edd8ef
3 changed files with 8 additions and 7 deletions
|
@ -49,7 +49,6 @@ import code.name.monkey.retromusic.util.LyricUtil
|
|||
import code.name.monkey.retromusic.util.CoverLyricsType
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
|
||||
import code.name.monkey.retromusic.util.logD
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
@ -250,8 +249,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
|||
|
||||
private fun updatePlayingQueue() {
|
||||
binding.viewPager.apply {
|
||||
adapter = AlbumCoverPagerAdapter(childFragmentManager, MusicPlayerRemote.playingQueue)
|
||||
adapter?.notifyDataSetChanged()
|
||||
adapter = AlbumCoverPagerAdapter(parentFragmentManager, MusicPlayerRemote.playingQueue)
|
||||
setCurrentItem(MusicPlayerRemote.position, true)
|
||||
onPageSelected(MusicPlayerRemote.position)
|
||||
}
|
||||
|
@ -260,7 +258,6 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
|
|||
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
|
||||
|
||||
override fun onPageSelected(position: Int) {
|
||||
logD("Page Selected $position")
|
||||
currentPosition = position
|
||||
if (binding.viewPager.adapter != null) {
|
||||
(binding.viewPager.adapter as AlbumCoverPagerAdapter).receiveColor(
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?colorSurface">
|
||||
android:background="?colorSurface"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<include layout="@layout/shadow_statusbar_toolbar" />
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?colorSurface">
|
||||
android:background="?colorSurface"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<include layout="@layout/shadow_statusbar_toolbar" />
|
||||
|
||||
|
@ -27,7 +29,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/ic_keyboard_arrow_down_black"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue