Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
f870d439
Commit
f870d439
authored
May 27, 2022
by
范玉宾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 18219
parent
ddadb6ad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
38 deletions
+31
-38
PlayMeditationActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
+14
-33
MeditationFloatEvent.kt
m-muse/src/main/java/com/yidianling/muse/event/MeditationFloatEvent.kt
+1
-1
MeditationWindowService.kt
m-muse/src/main/java/com/yidianling/muse/service/MeditationWindowService.kt
+15
-3
layout_quit_meditation.xml
m-muse/src/main/res/layout/layout_quit_meditation.xml
+1
-1
No files found.
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
View file @
f870d439
...
...
@@ -111,7 +111,6 @@ class PlayMeditationActivity : BaseActivity() {
mMeditationType
=
intent
?.
getIntExtra
(
"MEDITATION_TYPE"
,
0
)
mMediaUrl
=
intent
?.
getStringExtra
(
"MEDIA_URL"
)
?:
""
mMediaCoverUrl
=
intent
?.
getStringExtra
(
"MEDIA_COVER_URL"
)
?:
""
broadcastTime
=
intent
?.
getIntExtra
(
"BROAD_CAST_TIME"
,
0
)
?:
0
initView
()
getData
()
...
...
@@ -155,7 +154,7 @@ class PlayMeditationActivity : BaseActivity() {
updateUI
()
initMediaPlayer
(
m
Title
,
currentPosition
)
initMediaPlayer
(
m
MediaUrl
,
currentPosition
)
//快进点击事件
ActionCountUtils
.
baiDuCountSign3
(
...
...
@@ -172,7 +171,7 @@ class PlayMeditationActivity : BaseActivity() {
show
(
msg
)
}
})
}
else
if
(
mMeditationType
==
1
)
{
}
else
{
MuseHttp
.
getInstance
().
getMeditationPlayDetail
(
meditionType
=
1
,
mediaId
=
mMediaId
!!
,
...
...
@@ -350,28 +349,19 @@ class PlayMeditationActivity : BaseActivity() {
)
if
(
mMeditationType
==
0
){
stopPlay
()
if
(
mMeditationId
!=
null
&&
mMediaId
!=
null
)
{
M
useHttp
.
getInstance
().
postMeditation
PlayRecord
(
M
ediaPlayerTimeUtil
.
upload
PlayRecord
(
meditationId
=
mMeditationId
!!
.
toInt
(),
isQuit
=
1
,
mediaId
=
mMediaId
!!
,
playTime
=
(
seekbar_play_progress
.
progress
/
1000.00
).
roundToInt
(),
isComplete
=
0
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
finish
()
},
{
object
:
ThrowableConsumer
()
{
override
fun
accept
(
msg
:
String
)
{
finish
()
}
}
})
stopPlay
()
}
else
{
stopPlay
()
finish
()
}
}
else
{
if
(
quitDialog
==
null
)
{
quitDialog
=
QuitMeditationDialog
.
newInstance
()
...
...
@@ -379,28 +369,16 @@ class PlayMeditationActivity : BaseActivity() {
if
(
quitDialog
!=
null
&&
quitDialog
?.
isAdded
==
false
)
{
quitDialog
?.
setListener
(
object
:
QuitMeditationDialog
.
ClickListener
{
override
fun
quit
()
{
stopPlay
()
if
(
mMeditationId
!=
null
&&
mMediaId
!=
null
)
{
M
useHttp
.
getInstance
().
postMeditation
PlayRecord
(
M
ediaPlayerTimeUtil
.
upload
PlayRecord
(
meditationId
=
mMeditationId
!!
.
toInt
(),
isQuit
=
1
,
mediaId
=
mMediaId
!!
,
playTime
=
(
seekbar_play_progress
.
progress
/
1000.00
).
roundToInt
(),
isComplete
=
0
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
finish
()
},
{
object
:
ThrowableConsumer
()
{
override
fun
accept
(
msg
:
String
)
{
finish
()
}
}
})
}
else
{
finish
()
}
stopPlay
()
finish
()
}
})
quitDialog
?.
show
(
supportFragmentManager
,
QuitMeditationDialog
.
TAG
)
...
...
@@ -419,7 +397,7 @@ class PlayMeditationActivity : BaseActivity() {
""
)
val
event
=
MeditationFloatEvent
(
true
,
meditation
Detail
=
currentMeditation
?.
copy
(
meditationType
=
mMeditationType
))
meditation
=
currentMeditation
?.
copy
(
meditationType
=
mMeditationType
))
EventBus
.
getDefault
().
post
(
event
)
Handler
().
postDelayed
({
...
...
@@ -756,6 +734,9 @@ class PlayMeditationActivity : BaseActivity() {
private
fun
initMediaPlayer
(
path
:
String
,
current
:
Int
)
{
val
event
=
MeditationFloatEvent
(
show
=
false
,
stop
=
false
,
meditation
=
currentMeditation
)
EventBus
.
getDefault
().
post
(
event
)
if
(
MediaPlayerManager
.
getInstance
(
this
)
?.
getAudioPath
()
!=
null
&&
MediaPlayerManager
.
getInstance
(
this
)
?.
getAudioPath
()
==
path
)
{
...
...
@@ -947,7 +928,7 @@ class PlayMeditationActivity : BaseActivity() {
}
override
fun
onBackPressed
()
{
val
event
=
MeditationFloatEvent
(
true
,
meditation
Detail
=
currentMeditation
)
val
event
=
MeditationFloatEvent
(
true
,
meditation
=
currentMeditation
)
EventBus
.
getDefault
().
post
(
event
)
super
.
onBackPressed
()
}
...
...
m-muse/src/main/java/com/yidianling/muse/event/MeditationFloatEvent.kt
View file @
f870d439
...
...
@@ -6,6 +6,6 @@ class MeditationFloatEvent(
val
show
:
Boolean
,
val
stop
:
Boolean
?=
null
,
val
time
:
Long
?=
null
,
val
meditation
Detail
:
MeditationPlayModuleBean
.
MeditationDetail
?=
null
val
meditation
:
MeditationPlayModuleBean
.
MeditationDetail
?=
null
)
m-muse/src/main/java/com/yidianling/muse/service/MeditationWindowService.kt
View file @
f870d439
...
...
@@ -17,6 +17,7 @@ import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import
android.view.WindowManager
import
android.widget.ImageView
import
android.widget.TextView
import
androidx.appcompat.widget.AppCompatSeekBar
import
androidx.core.app.NotificationCompat
import
androidx.lifecycle.LifecycleService
import
com.bumptech.glide.Glide
...
...
@@ -61,12 +62,18 @@ class MeditationWindowService : LifecycleService() {
private
var
mCurrentMeditation
:
MeditationPlayModuleBean
.
MeditationDetail
?
=
null
private
var
mMeditations
=
mutableListOf
<
MeditationPlayModuleBean
.
MeditationDetail
>()
private
var
windowIsShow
=
false
private
var
mDisposable
:
Disposable
?
=
null
private
var
mObservable
:
Observable
<
Long
>?
=
null
private
var
mObserver
:
Observer
<
Long
>?
=
null
private
var
mProgressTimer
=
Timer
()
private
lateinit
var
mSeekBar
:
AppCompatSeekBar
override
fun
onCreate
()
{
super
.
onCreate
()
...
...
@@ -80,6 +87,7 @@ class MeditationWindowService : LifecycleService() {
}
}
mSeekBar
=
AppCompatSeekBar
(
this
)
EventBus
.
getDefault
().
register
(
this
)
}
...
...
@@ -124,7 +132,7 @@ class MeditationWindowService : LifecycleService() {
mDisposable
?.
dispose
()
}
}
else
{
if
(!
event
.
show
)
{
if
(
event
.
show
!=
null
&&
!
event
.
show
)
{
if
(
event
.
stop
==
true
){
try
{
mMediaPlayer
?.
stop
()
...
...
@@ -135,14 +143,18 @@ class MeditationWindowService : LifecycleService() {
}
hideFloatWindow
()
}
if
(
event
.
show
&&
event
.
meditationDetail
!=
null
)
{
if
(
event
.
show
!=
null
&&
event
.
show
&&
event
.
meditation
!=
null
)
{
if
(!
windowIsShow
)
{
showWindow
()
}
updateFloatView
(
event
.
meditation
Detail
)
updateFloatView
(
event
.
meditation
)
}
}
mSeekBar
.
progress
=
2
mSeekBar
.
max
=
event
.
meditation
?.
duration
?.
toInt
()
?:
0
}
private
fun
updateFloatView
(
meditation
:
MeditationPlayModuleBean
.
MeditationDetail
)
{
...
...
m-muse/src/main/res/layout/layout_quit_meditation.xml
View file @
f870d439
...
...
@@ -12,7 +12,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginVertical=
"28dp"
android:text=
"确定要结束
联系
吗?"
android:text=
"确定要结束
练习
吗?"
android:textColor=
"#FF242424"
android:textSize=
"16sp"
android:layout_gravity=
"center_horizontal"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment