Commit 5ac59c8a by 范玉宾

fix play list err

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