This commit is contained in:
ocean 2024-07-04 15:37:18 +08:00
parent 732eac6b96
commit ec6350c733
5 changed files with 29 additions and 14 deletions

View File

@ -173,13 +173,15 @@ abstract class MoBaseActivity : AppCompatActivity(), MusicPlayerView.PlaySkipFor
override fun onPositionDiscontinuity( override fun onPositionDiscontinuity(
oldPosition: Player.PositionInfo, newPosition: Player.PositionInfo, reason: Int oldPosition: Player.PositionInfo, newPosition: Player.PositionInfo, reason: Int
) { ) {
if (reason == Player.DISCONTINUITY_REASON_AUTO_TRANSITION) { LogTag.LogD(TAG,"reason->$reason")
if (reason == Player.DISCONTINUITY_REASON_AUTO_TRANSITION
|| reason == Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT) {
if (meController != null) { if (meController != null) {
musicPlayerView.updateInfoUi(meController.currentMediaItem) musicPlayerView.updateInfoUi(meController.currentMediaItem)
musicPlayerView.updateSetProgress(meController) musicPlayerView.updateSetProgress(meController)
musicPlayerView.updateProgressState(meController) musicPlayerView.updateProgressState(meController)
} }
LogTag.LogD(TAG,"reason update")
events.trySend(Event.AutomaticallySwitchSongs) events.trySend(Event.AutomaticallySwitchSongs)
} }
} }

View File

@ -56,7 +56,7 @@ class MoListDetailsActivity : MoBaseActivity(), DetailsListAdapter.OnItemMoreCli
data class OnDownloadRemove(val bean: PlaylistItem) : Request() data class OnDownloadRemove(val bean: PlaylistItem) : Request()
data class OnUpdateDownloadUi(val bean: PlaylistItem) : Request() data class OnUpdateDownloadUi(val bean: PlaylistItem) : Request()
data class OnAddPlaylist(val bean: PlaylistItem) : Request() data class OnAddPlaylist(val bean: PlaylistItem) : Request()
data class OnUpdateCurrentListItem(val bean: PlaylistItem):Request() data class OnUpdateCurrentListItem(val bean: PlaylistItem) : Request()
} }
companion object { companion object {
@ -300,7 +300,7 @@ class MoListDetailsActivity : MoBaseActivity(), DetailsListAdapter.OnItemMoreCli
override fun onItemMoreClick(position: Int) { override fun onItemMoreClick(position: Int) {
val bean = myList[position] val bean = myList[position]
LogD(TAG,"MoListDetailsActivity onItemMoreClick -> ${bean.asPlaylistItem}") LogD(TAG, "MoListDetailsActivity onItemMoreClick -> ${bean.asPlaylistItem}")
moreDialog = ListMoreBottomSheetDialog( moreDialog = ListMoreBottomSheetDialog(
this@MoListDetailsActivity, this@MoListDetailsActivity,
bean.asPlaylistItem, bean.asPlaylistItem,
@ -378,13 +378,25 @@ class MoListDetailsActivity : MoBaseActivity(), DetailsListAdapter.OnItemMoreCli
binding.secondSubtitle.text = it.secondSubtitle binding.secondSubtitle.text = it.secondSubtitle
val mapList = it.moPlaylistOrAlbumListBean.map { item -> val mapList = it.moPlaylistOrAlbumListBean.map { item ->
val offlineBean = App.appOfflineDBManager.getOfflineBeanByID(item.videoId!!) val offlineBean = App.appOfflineDBManager.getOfflineBeanByID(item.videoId?:"")
val favoriteBean = App.appFavoriteDBManager.getFavoriteBeanByID(item.videoId) val favoriteBean = App.appFavoriteDBManager.getFavoriteBeanByID(item.videoId?:"")
var isOffline = false
var bytesDownloaded = 0L
var size = ""
if (offlineBean != null) {
isOffline = offlineBean.isOffline
bytesDownloaded = offlineBean.bytesDownloaded ?: 0L
size = offlineBean.size ?: ""
}
var isFavorite = false
if (favoriteBean != null) {
isFavorite = favoriteBean.isFavorite
}
item.copy( item.copy(
isOffline = offlineBean?.isOffline ?: false, isOffline = isOffline,
isFavorite = favoriteBean?.isFavorite ?: false, isFavorite = isFavorite,
bytesDownloaded = offlineBean?.bytesDownloaded, bytesDownloaded = bytesDownloaded,
size = offlineBean?.size size = size
) )
} }
@ -414,7 +426,7 @@ class MoListDetailsActivity : MoBaseActivity(), DetailsListAdapter.OnItemMoreCli
} }
myList.forEach { item -> myList.forEach { item ->
if (item.videoId == id) { if (item.videoId == id) {
LogD(TAG,"updateCurrentItem -> $item") LogD(TAG, "updateCurrentItem -> $item")
} }
} }
} }

View File

@ -505,7 +505,7 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
binding.sbProgress.valueTo = MediaControllerManager.getDuration().toFloat() binding.sbProgress.valueTo = MediaControllerManager.getDuration().toFloat()
val value = MediaControllerManager.getCurrentPosition().toFloat() val value = MediaControllerManager.getCurrentPosition().toFloat()
if (binding.sbProgress.valueTo > value) { if (binding.sbProgress.valueTo > value) {
binding.sbProgress.value = MediaControllerManager.getCurrentPosition().toFloat() binding.sbProgress.value = value
} }
updateProgressState() updateProgressState()
@ -893,7 +893,7 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
val value = currentPosition.toFloat() val value = currentPosition.toFloat()
if (binding.sbProgress.valueTo > value) { if (binding.sbProgress.valueTo > value) {
binding.sbProgress.value = currentPosition.toFloat() binding.sbProgress.value = value
} }
sendEmptyMessageDelayed(1, 50) sendEmptyMessageDelayed(1, 50)

View File

@ -150,6 +150,7 @@ class PlaybackService : MediaSessionService(), Player.Listener {
return ResolvingDataSource.Factory(createCacheDataSource()) { dataSpec -> return ResolvingDataSource.Factory(createCacheDataSource()) { dataSpec ->
val videoId = dataSpec.key ?: error("A key must be set") val videoId = dataSpec.key ?: error("A key must be set")
LogD(TAG, "playbackService videoId-> $videoId")
val position = dataSpec.position val position = dataSpec.position
val length = if (dataSpec.length >= 0) dataSpec.length else 1 val length = if (dataSpec.length >= 0) dataSpec.length else 1

View File

@ -39,7 +39,7 @@ class RatingDialog(private val mContext: Context) : Dialog(mContext) {
} }
} }
dismiss() dismiss()
val jsonObject = JSONObject() val jsonObject = JSONObject()
jsonObject.put( jsonObject.put(
"rating_star_type", starType "rating_star_type", starType