Commit 3c51b5b3 by 范玉宾

fix bugs

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