Fixed Now playing viewpager lag

This commit is contained in:
Prathamesh More 2022-05-30 19:34:43 +05:30
parent 1edd4acd9c
commit da0a4d5c13
3 changed files with 4 additions and 17 deletions

View file

@ -183,7 +183,9 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
override fun onPlayingMetaChanged() { override fun onPlayingMetaChanged() {
logD("Playing Meta Changed") logD("Playing Meta Changed")
viewPager.setCurrentItem(MusicPlayerRemote.position, true) if (viewPager.currentItem != MusicPlayerRemote.position) {
viewPager.setCurrentItem(MusicPlayerRemote.position, true)
}
updateLyrics() updateLyrics()
} }
@ -260,8 +262,7 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_playe
} }
} }
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
}
override fun onPageSelected(position: Int) { override fun onPageSelected(position: Int) {
currentPosition = position currentPosition = position

View file

@ -22,7 +22,6 @@ import kotlinx.parcelize.Parcelize
@Parcelize @Parcelize
data class CategoryInfo( data class CategoryInfo(
val category: Category, val category: Category,
@get:JvmName("isVisible")
var visible: Boolean var visible: Boolean
) : Parcelable { ) : Parcelable {

View file

@ -1376,18 +1376,5 @@ class MusicService : MediaBrowserServiceCompat(),
or PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS or PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS
or PlaybackStateCompat.ACTION_STOP or PlaybackStateCompat.ACTION_STOP
or PlaybackStateCompat.ACTION_SEEK_TO) or PlaybackStateCompat.ACTION_SEEK_TO)
private fun copy(bitmap: Bitmap): Bitmap? {
var config = bitmap.config
if (config == null) {
config = Bitmap.Config.RGB_565
}
return try {
bitmap.copy(config, false)
} catch (e: OutOfMemoryError) {
e.printStackTrace()
null
}
}
} }
} }