Commit 3c51b5b3 by 范玉宾

fix bugs

parent f870d439
...@@ -67,7 +67,7 @@ public class PlayFragment extends Fragment implements View.OnClickListener, ...@@ -67,7 +67,7 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
initPlayMode(); initPlayMode();
MeditationFloatEvent event = new MeditationFloatEvent(false,true,null,null); MeditationFloatEvent event = new MeditationFloatEvent(false,true,null,null,null);
EventBus.getDefault().post(event); EventBus.getDefault().post(event);
onChangeImpl(AudioPlayer.Companion.get().getPlayMusic()); onChangeImpl(AudioPlayer.Companion.get().getPlayMusic());
......
...@@ -14,7 +14,7 @@ ext { ...@@ -14,7 +14,7 @@ ext {
"m-dynamic" : "0.0.7.73", "m-dynamic" : "0.0.7.73",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
"m-muse" : "0.0.28.46", "m-muse" : "0.0.28.47",
"m-tests" : "0.0.24.18", "m-tests" : "0.0.24.18",
"m-course" : "0.0.43.37", "m-course" : "0.0.43.37",
...@@ -99,7 +99,7 @@ ext { ...@@ -99,7 +99,7 @@ ext {
"m-dynamic" : "0.0.7.73", "m-dynamic" : "0.0.7.73",
"m-article" : "0.0.0.8", "m-article" : "0.0.0.8",
"m-muse" : "0.0.28.46", "m-muse" : "0.0.28.47",
"m-tests" : "0.0.24.18", "m-tests" : "0.0.24.18",
"m-course" : "0.0.43.37", "m-course" : "0.0.43.37",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
......
...@@ -357,6 +357,7 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -357,6 +357,7 @@ class PlayMeditationActivity : BaseActivity() {
isComplete = 0 isComplete = 0
) )
stopPlay() stopPlay()
finish()
} else { } else {
stopPlay() stopPlay()
finish() finish()
...@@ -679,16 +680,22 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -679,16 +680,22 @@ class PlayMeditationActivity : BaseActivity() {
} }
private fun initPlayCompletionListener(isLoop: Boolean = false, isSingle: Boolean = false) { private fun initPlayCompletionListener(isLoop: Boolean = false, isSingle: Boolean = false) {
mMediaPlayer?.setOnCompletionListener { mMediaPlayer?.setOnCompletionListener {
val playTime = (seekbar_play_progress.progress / 1000.00).roundToInt() val duration = currentMeditation?.duration?.toInt()?:0
MediaPlayerTimeUtil.uploadPlayRecord( val currentDuration = mMediaPlayer?.currentPosition?:0
meditationId = mMeditationId?.toInt(), if(currentDuration==duration){
mediaId = mMediaId, val playTime = (seekbar_play_progress.progress / 1000.00).roundToInt()
isQuit = 0,
playTime = playTime, MediaPlayerTimeUtil.uploadPlayRecord(
isComplete = 1 meditationId = mMeditationId?.toInt(),
) mediaId = mMediaId,
isQuit = 0,
playTime = playTime,
isComplete = 1
)
}
if (isLoop){ if (isLoop){
if (isSingle || meditations.size == 1){ if (isSingle || meditations.size == 1){
......
...@@ -4,8 +4,9 @@ import com.yidianling.muse.bean.MeditationPlayModuleBean ...@@ -4,8 +4,9 @@ import com.yidianling.muse.bean.MeditationPlayModuleBean
class MeditationFloatEvent( class MeditationFloatEvent(
val show: Boolean, val show: Boolean,
val stop: Boolean?=null, val stop: Boolean? = null,
val time:Long?=null, val time: Long? = null,
val meditation: MeditationPlayModuleBean.MeditationDetail?=null val meditation: MeditationPlayModuleBean.MeditationDetail? = null,
val meditations: ArrayList<MeditationPlayModuleBean.MeditationDetail>? = null
) )
...@@ -151,7 +151,6 @@ class MeditationWindowService : LifecycleService() { ...@@ -151,7 +151,6 @@ class MeditationWindowService : LifecycleService() {
} }
} }
mSeekBar.progress = 2 mSeekBar.progress = 2
mSeekBar.max = event.meditation?.duration?.toInt()?:0 mSeekBar.max = event.meditation?.duration?.toInt()?:0
...@@ -235,12 +234,22 @@ class MeditationWindowService : LifecycleService() { ...@@ -235,12 +234,22 @@ class MeditationWindowService : LifecycleService() {
}, 0, 50) }, 0, 50)
mMediaPlayer?.setOnCompletionListener { mMediaPlayer?.setOnCompletionListener {
postPlayRecord(
0, (ivProgress?.curProcess?.div(1000.00))?.roundToInt() ?: 0, val duration = meditation?.duration?.toInt()?:0
1, val currentDuration = mMediaPlayer?.currentPosition?:0
meditation.meditationId.toInt(),
meditation.mediaId ?: 0L if(meditation.mediaId!=null && meditation.meditationId!=null){
) val playTime = (ivProgress?.curProcess?.div(1000.00))?.roundToInt() ?: 0
if(duration == currentDuration){
MediaPlayerTimeUtil.uploadPlayRecord(
meditationId = meditation.meditationId.toInt(),
mediaId = meditation.mediaId,
isQuit = 0,
playTime = playTime,
isComplete = 1
)
}
}
if (mMediaPlayer?.isPlaying == true) { if (mMediaPlayer?.isPlaying == true) {
ivPlayOrPause?.setImageResource(R.drawable.icon_meditation_float_play) ivPlayOrPause?.setImageResource(R.drawable.icon_meditation_float_play)
} else { } else {
...@@ -252,12 +261,17 @@ class MeditationWindowService : LifecycleService() { ...@@ -252,12 +261,17 @@ class MeditationWindowService : LifecycleService() {
//悬浮窗关闭点击事件 //悬浮窗关闭点击事件
ActionCountUtils.count(MuseBIConstants.YDL_MUSE_MEDITATION_WINDOW_CLOSE_CLICK,"") ActionCountUtils.count(MuseBIConstants.YDL_MUSE_MEDITATION_WINDOW_CLOSE_CLICK,"")
postPlayRecord( if(meditation.mediaId!=null && meditation.meditationId!=null){
1, (ivProgress?.curProcess?.div(1000.00))?.roundToInt() ?: 0, val playTime = (ivProgress?.curProcess?.div(1000.00))?.roundToInt() ?: 0
0, MediaPlayerTimeUtil.uploadPlayRecord(
meditation.meditationId.toInt(), meditationId = meditation.meditationId.toInt(),
meditation.mediaId ?: 0L mediaId = meditation.mediaId,
) isQuit = 0,
playTime = playTime,
isComplete = 0
)
}
MediaPlayerManager.getInstance(this)?.stop() MediaPlayerManager.getInstance(this)?.stop()
hideFloatWindow() hideFloatWindow()
} }
...@@ -344,30 +358,4 @@ class MeditationWindowService : LifecycleService() { ...@@ -344,30 +358,4 @@ class MeditationWindowService : LifecycleService() {
} }
private fun postPlayRecord(
isQuit: Int,
playTime: Int,
isComplete: Int,
meditationId: Int,
mediaId: Long
) {
MuseHttp.getInstance().postMeditationPlayRecord(
meditationId = meditationId,
isQuit = isQuit, mediaId = mediaId,
playTime = playTime,
isComplete = isComplete
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
}, {
object : ThrowableConsumer() {
override fun accept(msg: String) {
}
}
})
}
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#CC282E3F"> android:background="#B3000000">
<ImageView <ImageView
android:id="@+id/iv_bg" android:id="@+id/iv_bg"
......
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