Commit 5ac59c8a by 范玉宾

fix play list err

parent 16a79f30
package com.yidianling.muse.activity
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.os.Handler
import com.blankj.utilcode.util.SPUtils
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestOptions
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.muse.R
import jp.wasabeef.glide.transformations.BitmapTransformation
import jp.wasabeef.glide.transformations.BlurTransformation
import kotlinx.android.synthetic.main.activity_play_meditation_time_off.*
import kotlinx.android.synthetic.main.activity_play_meditation_time_off.iv_close
class MeditationTimeOffActivity : BaseActivity() {
......@@ -43,7 +37,6 @@ class MeditationTimeOffActivity : BaseActivity() {
iv_close?.setOnClickListener { finish() }
tv_save_setting?.setOnClickListener {
ToastHelper.show("保存设置")
val hour = wheel_hour.selectedItem
val minute = wheel_minute.selectedItem
......@@ -63,7 +56,6 @@ class MeditationTimeOffActivity : BaseActivity() {
}
tv_cancel_time_off?.setOnClickListener {
ToastHelper.show("关闭定时")
SPUtils.getInstance().put("SELECT_H",0)
SPUtils.getInstance().put("SELECT_M",1)
val intent = Intent()
......
......@@ -68,6 +68,7 @@ class PlayMeditationActivity : BaseActivity() {
private var meditations = mutableListOf<MeditationPlayModuleBean.MeditationDetail>()
private var currentMeditation: MeditationPlayModuleBean.MeditationDetail? = null
private var currentMeditationIndex = 0
private var collected = false
......@@ -324,12 +325,12 @@ class PlayMeditationActivity : BaseActivity() {
iv_collect.setImageResource(R.drawable.icon_play_meditation_collect)
}
} else {
show("操作失败!")
}
}, {
object : ThrowableConsumer() {
override fun accept(msg: String) {
show(msg)
}
}
})
......@@ -464,6 +465,9 @@ class PlayMeditationActivity : BaseActivity() {
}
exo_play.setOnClickListener {
if (Utils.isFastClick()) return@setOnClickListener
if (isPlaying) {
mMediaPlayer?.pause()
if (mMeditationId == null || mMediaId == null) return@setOnClickListener
......@@ -522,6 +526,9 @@ class PlayMeditationActivity : BaseActivity() {
}
exo_prev.setOnClickListener {
if (Utils.isFastClick()) return@setOnClickListener
//上一曲埋点
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
......@@ -530,7 +537,12 @@ class PlayMeditationActivity : BaseActivity() {
mBuried ?: "",
""
)
val currentPosition = meditations.indexOf(currentMeditation)
var currentPosition = 0
meditations?.forEachIndexed { index, meditationDetail ->
if (meditationDetail.mediaId == mMediaId){
currentPosition = index
}
}
if (currentPosition > 0) {
if (mMeditationId == null || mMediaId == null) return@setOnClickListener
......@@ -552,7 +564,10 @@ class PlayMeditationActivity : BaseActivity() {
val currentPosition = meditation.broadcastTime
mStatus = meditation.status
updateUI()
mTitle = meditation.title
mDesc = meditation.title
updateUI(needRefresh = false)
initMediaPlayer(mMediaUrl, currentPosition, mMediaIdFromLocal == mMediaId)
} else {
......@@ -561,6 +576,8 @@ class PlayMeditationActivity : BaseActivity() {
}
exo_next.setOnClickListener {
if (Utils.isFastClick()) return@setOnClickListener
//下一个点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
......@@ -569,7 +586,12 @@ class PlayMeditationActivity : BaseActivity() {
mBuried ?: "",
""
)
val currentPosition = meditations.indexOf(currentMeditation)
var currentPosition = 0
meditations?.forEachIndexed { index, meditationDetail ->
if (meditationDetail.mediaId == mMediaId){
currentPosition = index
}
}
if (currentPosition < meditations.size - 1) {
if (mMeditationId == null || mMediaId == null) return@setOnClickListener
......@@ -583,7 +605,8 @@ class PlayMeditationActivity : BaseActivity() {
)
val meditation = meditations[currentPosition + 1]
currentMeditation = meditation
currentMeditation = meditation.copy(meditationId = mMeditationId!!)
mMediaId = meditation.mediaId
mMediaCoverUrl = meditation.coverImageUrl
......@@ -591,6 +614,9 @@ class PlayMeditationActivity : BaseActivity() {
val currentPosition = meditation.broadcastTime
mStatus = meditation.status
mTitle = meditation.title
mDesc = meditation.title
updateUI(needRefresh = false)
initMediaPlayer(mMediaUrl, currentPosition, mMediaIdFromLocal == mMediaId)
......@@ -600,6 +626,8 @@ class PlayMeditationActivity : BaseActivity() {
}
exo_rew.setOnClickListener {
if (Utils.isFastClick()) return@setOnClickListener
//快退点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
......@@ -617,6 +645,8 @@ class PlayMeditationActivity : BaseActivity() {
}
exo_ffwd.setOnClickListener {
if (Utils.isFastClick()) return@setOnClickListener
//快进点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment