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
c6b43e16
Commit
c6b43e16
authored
May 23, 2022
by
范玉宾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
to be test
parent
deddb032
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
261 additions
and
78 deletions
+261
-78
config.gradle
config.gradle
+10
-10
PlayMeditationActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
+166
-47
FloatViewTouchListener.kt
m-muse/src/main/java/com/yidianling/muse/helper/FloatViewTouchListener.kt
+39
-0
MediaPlayerManager.kt
m-muse/src/main/java/com/yidianling/muse/helper/MediaPlayerManager.kt
+1
-0
MeditationViewModel.kt
m-muse/src/main/java/com/yidianling/muse/helper/MeditationViewModel.kt
+16
-0
ShareMeditationDialog.kt
m-muse/src/main/java/com/yidianling/muse/widget/ShareMeditationDialog.kt
+27
-19
MineFragment.java
m-user/src/main/java/com/yidianling/user/mine/MineFragment.java
+2
-2
No files found.
config.gradle
View file @
c6b43e16
...
...
@@ -8,13 +8,13 @@ ext {
"m-confide"
:
"0.0.49.69"
,
"m-consultant"
:
"0.0.60.16"
,
"m-fm"
:
"0.0.30.08"
,
"m-user"
:
"0.0.62.0
4
"
,
"m-home"
:
"0.0.23.
35
"
,
"m-user"
:
"0.0.62.0
5
"
,
"m-home"
:
"0.0.23.
49
"
,
"m-im"
:
"0.0.21.30"
,
"m-dynamic"
:
"0.0.7.35"
,
"m-article"
:
"0.0.0.10"
,
"m-muse"
:
"0.0.28.2
8
"
,
"m-muse"
:
"0.0.28.2
9
"
,
"m-tests"
:
"0.0.24.18"
,
"m-course"
:
"0.0.43.37"
,
...
...
@@ -35,10 +35,10 @@ ext {
//mdt 组件
"ydl-tuicore"
:
"0.0.22"
,
//第一步
"ydl-platform"
:
"0.0.41.
2
"
,
"ydl-platform"
:
"0.0.41.
5
"
,
//第二步 若干
"ydl-webview"
:
"0.0.38.7
1
"
,
"ydl-webview"
:
"0.0.38.7
3
"
,
"ydl-media"
:
"0.0.21.44"
,
"ydl-pay"
:
"0.0.18.19"
,
"m-audioim"
:
"0.0.49.29.85"
,
...
...
@@ -94,13 +94,13 @@ ext {
"m-confide"
:
"0.0.49.69"
,
"m-consultant"
:
"0.0.60.16"
,
"m-fm"
:
"0.0.30.08"
,
"m-user"
:
"0.0.62.0
4
"
,
"m-home"
:
"0.0.23.
35
"
,
"m-user"
:
"0.0.62.0
5
"
,
"m-home"
:
"0.0.23.
49
"
,
"m-im"
:
"0.0.21.30"
,
"m-dynamic"
:
"0.0.7.35"
,
"m-article"
:
"0.0.0.8"
,
"m-muse"
:
"0.0.28.2
8
"
,
"m-muse"
:
"0.0.28.2
9
"
,
"m-tests"
:
"0.0.24.18"
,
"m-course"
:
"0.0.43.37"
,
//-------------- 业务模块 API 层 --------------
...
...
@@ -119,10 +119,10 @@ ext {
//mdt组件
"ydl-tuicore"
:
"0.0.22"
,
//第一步
"ydl-platform"
:
"0.0.41.
2
"
,
"ydl-platform"
:
"0.0.41.
5
"
,
//第二步 若干
"ydl-webview"
:
"0.0.38.7
1
"
,
"ydl-webview"
:
"0.0.38.7
3
"
,
"ydl-media"
:
"0.0.21.44"
,
"ydl-pay"
:
"0.0.18.19"
,
"m-audioim"
:
"0.0.49.29.85"
,
...
...
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
View file @
c6b43e16
...
...
@@ -33,6 +33,9 @@ import io.reactivex.disposables.Disposable
import
io.reactivex.functions.Consumer
import
io.reactivex.schedulers.Schedulers
import
kotlinx.android.synthetic.main.activity_play_meditation.*
import
kotlinx.android.synthetic.main.activity_play_meditation.iv_close
import
kotlinx.android.synthetic.main.activity_play_meditation.tv_title
import
kotlinx.android.synthetic.main.layout_meditation_play_float_view.*
import
kotlinx.android.synthetic.main.player_control_view.*
import
java.util.*
import
java.util.concurrent.TimeUnit
...
...
@@ -55,7 +58,10 @@ class PlayMeditationActivity : BaseActivity() {
private
val
newPath
=
"http://file.diyring.cc/UserRingWorksFile/0/50284096.mp3"
private
var
currentPath
=
""
private
var
shareTitle
=
""
private
var
shareUrl
=
""
private
var
shareContent
=
""
private
var
shareImageUrl
=
""
private
var
collected
=
false
private
var
isPlaying
=
false
...
...
@@ -79,9 +85,11 @@ class PlayMeditationActivity : BaseActivity() {
statusBarLightMode
(
this
)
super
.
onCreate
(
savedInstanceState
)
mMediaPlayer
=
MediaPlayerManager
.
getInstance
(
this
)
?.
getMediaPlayer
()
EventBus
.
getDefault
().
register
(
this
)
mediaId
=
intent
?.
getLongExtra
(
"MEDIA_ID"
,
0L
)
mediaId
=
intent
?.
getLongExtra
(
"MEDIA_ID"
,
0L
)
meditationId
=
intent
?.
getLongExtra
(
"MEDITATION_ID"
,
0L
)
meditationType
=
intent
?.
getIntExtra
(
"MEDITATION_TYPE"
,
0
)
mediaUrl
=
intent
?.
getStringExtra
(
"MEDIA_URL"
)
?:
""
...
...
@@ -118,7 +126,7 @@ class PlayMeditationActivity : BaseActivity() {
if
(
meditationPlayBean
.
mediaId
==
currentMediaId
)
{
mediaId
=
module
?.
mediaId
?:
0L
val
title
=
meditationPlayBean
.
title
?:
"未知标题"
val
desc
=
meditationPlayBean
.
desc
?:
"
写着人们心疼的曲折,我想我很快乐,做一个旁观者
"
val
desc
=
meditationPlayBean
.
desc
?:
""
val
mediaUrl
=
meditationPlayBean
.
mediaUrl
...
...
@@ -133,6 +141,10 @@ class PlayMeditationActivity : BaseActivity() {
tv_title
.
text
=
title
tv_content
.
text
=
desc
shareTitle
=
title
shareContent
=
desc
shareUrl
=
mediaUrl
iv_collect
.
setImageResource
(
if
(
status
==
0
)
{
R
.
drawable
.
icon_play_meditation_collect
...
...
@@ -141,6 +153,7 @@ class PlayMeditationActivity : BaseActivity() {
}
)
initMediaPlayer
(
mediaUrl
,
currentPosition
)
}
}
...
...
@@ -168,7 +181,7 @@ class PlayMeditationActivity : BaseActivity() {
if
(
meditationPlayBean
.
mediaId
==
currentMediaId
)
{
mediaId
=
module
?.
mediaId
?:
0L
val
title
=
meditationPlayBean
.
title
val
desc
=
meditationPlayBean
.
desc
?:
"
写着人们心疼的曲折,我想我很快乐,做一个旁观者
"
val
desc
=
meditationPlayBean
.
desc
?:
""
val
bgImageUrl
=
meditationPlayBean
.
coverImageUrl
...
...
@@ -189,6 +202,10 @@ class PlayMeditationActivity : BaseActivity() {
tv_title
.
text
=
title
tv_content
.
text
=
desc
shareTitle
=
title
shareContent
=
desc
shareUrl
=
mediaUrl
iv_collect
.
setImageResource
(
if
(
status
==
0
)
{
R
.
drawable
.
icon_play_meditation_collect
...
...
@@ -196,6 +213,7 @@ class PlayMeditationActivity : BaseActivity() {
R
.
drawable
.
icon_meditation_collected
}
)
initMediaPlayer
(
mediaUrl
,
currentPosition
)
}
}
...
...
@@ -290,6 +308,8 @@ class PlayMeditationActivity : BaseActivity() {
private
fun
initView
()
{
shareImageUrl
=
mediaCoverUrl
Glide
.
with
(
this
)
.
load
(
mediaCoverUrl
)
.
into
(
iv_bg
)
...
...
@@ -336,7 +356,11 @@ class PlayMeditationActivity : BaseActivity() {
iv_share
.
setOnClickListener
{
if
(
shareDialog
==
null
)
{
shareDialog
=
ShareMeditationDialog
.
newInstance
(
shareImageUrl
=
""
)
.
newInstance
(
shareTitle
=
shareTitle
,
shareContent
=
shareContent
,
shareUrl
=
shareUrl
,
shareImageUrl
=
shareImageUrl
)
}
if
(
shareDialog
!=
null
&&
shareDialog
?.
isAdded
==
false
)
{
shareDialog
?.
show
(
supportFragmentManager
,
ShareMeditationDialog
.
TAG
)
...
...
@@ -360,7 +384,7 @@ class PlayMeditationActivity : BaseActivity() {
exo_play
.
setOnClickListener
{
if
(
isPlaying
)
{
MediaPlayerManager
.
getInstance
(
this
)
?.
pause
()
mMediaPlayer
?.
pause
()
if
(
meditationId
==
null
||
mediaId
==
null
)
return
@setOnClickListener
postPlayRecord
(
isQuit
=
0
,
...
...
@@ -370,7 +394,7 @@ class PlayMeditationActivity : BaseActivity() {
}
else
{
val
duration
=
mMediaPlayer
?.
duration
MediaPlayerManager
.
getInstance
(
this
)
?.
play
()
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
play
()
if
(
duration
!=
null
)
{
seekbar_play_progress
.
max
=
duration
...
...
@@ -378,7 +402,9 @@ class PlayMeditationActivity : BaseActivity() {
mTimer
.
schedule
(
object
:
TimerTask
()
{
override
fun
run
()
{
if
(!
isSeekbarChanging
)
{
seekbar_play_progress
.
progress
=
mMediaPlayer
?.
currentPosition
?:
0
seekbar_play_progress
.
progress
=
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
getMediaPlayer
()
?.
currentPosition
?:
0
}
}
},
0
,
50
)
...
...
@@ -398,14 +424,18 @@ class PlayMeditationActivity : BaseActivity() {
postPlayRecord
(
isQuit
=
0
,
playTime
=
0
,
isComplete
=
0
)
MediaPlayerManager
.
getInstance
(
this
)
?.
setAudioPath
(
newPath
)
isPlaying
=
if
(
mMediaPlayer
?.
isPlaying
==
true
)
{
isPlaying
=
if
(
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
getMediaPlayer
()
?.
isPlaying
==
true
)
{
exo_play
.
setImageResource
(
R
.
drawable
.
icon_pause_play
)
if
(
duration
!=
null
)
{
seekbar_play_progress
.
max
=
duration
}
mTimer
.
schedule
(
object
:
TimerTask
()
{
override
fun
run
()
{
seekbar_play_progress
.
progress
=
mMediaPlayer
?.
currentPosition
?:
0
seekbar_play_progress
.
progress
=
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
getMediaPlayer
()
?.
currentPosition
?:
0
}
},
0
,
50
)
true
...
...
@@ -420,7 +450,9 @@ class PlayMeditationActivity : BaseActivity() {
postPlayRecord
(
isQuit
=
0
,
playTime
=
0
,
isComplete
=
0
)
MediaPlayerManager
.
getInstance
(
this
)
?.
setAudioPath
(
newPath
)
isPlaying
=
if
(
mMediaPlayer
?.
isPlaying
==
true
)
{
isPlaying
=
if
(
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
getMediaPlayer
()
?.
isPlaying
==
true
)
{
exo_play
.
setImageResource
(
R
.
drawable
.
icon_pause_play
)
if
(
duration
!=
null
)
{
seekbar_play_progress
.
max
=
duration
...
...
@@ -428,7 +460,9 @@ class PlayMeditationActivity : BaseActivity() {
mTimer
.
schedule
(
object
:
TimerTask
()
{
override
fun
run
()
{
if
(!
isSeekbarChanging
)
{
seekbar_play_progress
.
progress
=
mMediaPlayer
?.
currentPosition
?:
0
seekbar_play_progress
.
progress
=
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
getMediaPlayer
()
?.
currentPosition
?:
0
}
}
},
0
,
50
)
...
...
@@ -440,19 +474,22 @@ class PlayMeditationActivity : BaseActivity() {
}
exo_rew
.
setOnClickListener
{
if
(
mMediaPlayer
!=
null
)
{
val
currentPosition
=
mMediaPlayer
!!
.
currentPosition
val
seekPosition
=
0
.
coerceAtLeast
(
currentPosition
-
15000
)
mMediaPlayer
!!
.
seekTo
(
seekPosition
)
}
val
currentPosition
=
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
getMediaPlayer
()
?.
currentPosition
val
seekPosition
=
0
.
coerceAtLeast
(
currentPosition
?.
minus
(
15000
)
?:
0
)
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
getMediaPlayer
()
?.
seekTo
(
seekPosition
)
}
exo_ffwd
.
setOnClickListener
{
if
(
mMediaPlayer
!=
null
)
{
val
currentPosition
=
mMediaPlayer
!!
.
currentPosition
val
seekPosition
=
duration
.
coerceAtMost
(
currentPosition
+
15000
)
mMediaPlayer
!!
.
seekTo
(
seekPosition
)
}
val
currentPosition
=
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
getMediaPlayer
()
?.
currentPosition
val
seekPosition
=
duration
.
coerceAtMost
(
currentPosition
?.
plus
(
15000
)
?:
0
)
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
getMediaPlayer
()
?.
seekTo
(
seekPosition
)
}
seekbar_play_progress
.
setOnSeekBarChangeListener
(
object
:
SeekBar
.
OnSeekBarChangeListener
{
...
...
@@ -521,17 +558,61 @@ class PlayMeditationActivity : BaseActivity() {
private
fun
initMediaPlayer
(
path
:
String
,
current
:
Int
)
{
if
(
currentPath
==
MediaPlayerManager
.
getInstance
(
this
)
?.
getAudioPath
())
{
if
(
MediaPlayerManager
.
getInstance
(
this
)
?.
getAudioPath
()
==
null
&&
MediaPlayerManager
.
getInstance
(
this
)
?.
getAudioPath
()
==
path
)
{
MediaPlayerManager
.
getInstance
(
this
)
?.
play
()
if
(
mMediaPlayer
?.
isPlaying
==
true
)
{
return
exo_play
.
setImageResource
(
R
.
drawable
.
icon_pause_play
)
true
}
else
{
mMediaPlayer
?.
start
()
exo_play
.
setImageResource
(
R
.
drawable
.
icon_pause_meditation
)
false
}
val
currentPosition
=
mMediaPlayer
?.
currentPosition
duration
=
mMediaPlayer
?.
duration
?:
0
if
(
current
!=
null
&&
current
>
0
)
{
mMediaPlayer
?.
seekTo
(
current
*
1000
)
seekbar_play_progress
.
max
=
duration
seekbar_play_progress
.
progress
=
current
exo_position
.
text
=
MediaPlayerTimeUtil
.
calculateTime
(
current
)
}
else
if
(
currentPosition
!=
null
)
{
seekbar_play_progress
.
max
=
duration
seekbar_play_progress
.
progress
=
current
exo_position
.
text
=
MediaPlayerTimeUtil
.
calculateTime
(
currentPosition
/
1000
)
}
if
(
duration
!=
null
)
{
exo_duration
.
text
=
MediaPlayerTimeUtil
.
calculateTime
(
duration
/
1000
)
}
if
(
duration
!=
null
)
{
seekbar_play_progress
.
max
=
duration
}
mTimer
.
schedule
(
object
:
TimerTask
()
{
override
fun
run
()
{
if
(!
isSeekbarChanging
)
{
seekbar_play_progress
.
progress
=
mMediaPlayer
?.
currentPosition
?:
0
}
}
},
0
,
50
)
}
else
{
MediaPlayerManager
.
getInstance
(
this
)
?.
setAudioPath
(
path
)
MediaPlayerManager
.
getInstance
(
this
)
?.
setOnPreparedListener
(
object
:
MediaPlayerManager
.
OnMediaPlayerManagerListener
{
override
fun
onPrepared
(
mediaPlayer
:
MediaPlayer
)
{
MediaPlayerManager
.
getInstance
(
this
@PlayMeditationActivity
)
?.
play
()
if
(
mMediaPlayer
?.
isPlaying
==
true
)
{
stopPlay
()
exo_play
.
setImageResource
(
R
.
drawable
.
icon_pause_play
)
true
}
else
{
exo_play
.
setImageResource
(
R
.
drawable
.
icon_pause_meditation
)
false
}
MediaPlayerManager
.
getInstance
(
this
)
?.
getAudioPath
()
==
path
val
currentPosition
=
mMediaPlayer
?.
currentPosition
duration
=
mMediaPlayer
?.
duration
?:
0
if
(
current
!=
null
&&
current
>
0
)
{
...
...
@@ -542,11 +623,23 @@ class PlayMeditationActivity : BaseActivity() {
}
else
if
(
currentPosition
!=
null
)
{
seekbar_play_progress
.
max
=
duration
seekbar_play_progress
.
progress
=
current
exo_position
.
text
=
MediaPlayerTimeUtil
.
calculateTime
(
currentPosition
/
1000
)
exo_position
.
text
=
MediaPlayerTimeUtil
.
calculateTime
(
currentPosition
/
1000
)
}
if
(
duration
!=
null
)
{
exo_duration
.
text
=
MediaPlayerTimeUtil
.
calculateTime
(
duration
/
1000
)
}
mTimer
.
schedule
(
object
:
TimerTask
()
{
override
fun
run
()
{
if
(!
isSeekbarChanging
)
{
seekbar_play_progress
.
progress
=
mMediaPlayer
?.
currentPosition
?:
0
}
}
},
0
,
50
)
}
})
}
}
...
...
@@ -561,13 +654,13 @@ class PlayMeditationActivity : BaseActivity() {
tv_time_off
.
visibility
=
View
.
GONE
mDisposable
?.
dispose
()
initRxTimeOff
((
minute
*
60
*
1000
).
toLong
(),
0
)
initRxTimeOff
((
minute
*
60
*
1000
).
toLong
(),
0
)
}
else
{
tv_time_off_pure_music
.
visibility
=
View
.
GONE
tv_time_off
.
visibility
=
View
.
VISIBLE
mDisposable
?.
dispose
()
initRxTimeOff
((
minute
*
60
*
1000
).
toLong
(),
1
)
initRxTimeOff
((
minute
*
60
*
1000
).
toLong
(),
1
)
}
}
else
{
mDisposable
?.
dispose
()
...
...
@@ -577,22 +670,22 @@ class PlayMeditationActivity : BaseActivity() {
}
}
private
fun
initRxTimeOff
(
time
:
Long
,
meditationType
:
Int
)
{
mObservable
=
Observable
.
interval
(
0
,
1
,
TimeUnit
.
SECONDS
)
private
fun
initRxTimeOff
(
time
:
Long
,
meditationType
:
Int
)
{
mObservable
=
Observable
.
interval
(
0
,
1
,
TimeUnit
.
SECONDS
)
.
take
(
time
/
1000
+
1
)
.
map
{
t
->
time
-
t
*
1000
}
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
mObserver
=
object
:
Observer
<
Long
>{
mObserver
=
object
:
Observer
<
Long
>
{
override
fun
onSubscribe
(
d
:
Disposable
)
{
mDisposable
=
d
}
override
fun
onNext
(
t
:
Long
)
{
if
(
meditationType
==
0
){
if
(
meditationType
==
0
)
{
tv_time_off_pure_music
.
text
=
MediaPlayerTimeUtil
.
formatTimeOff
(
t
)
}
else
{
}
else
{
tv_time_off
.
text
=
MediaPlayerTimeUtil
.
formatTimeOff
(
t
)
}
}
...
...
@@ -603,37 +696,64 @@ class PlayMeditationActivity : BaseActivity() {
override
fun
onComplete
()
{
show
(
"倒计时结束,停止播放吧!"
)
if
(
mMediaPlayer
?.
isPlaying
==
true
){
if
(
mMediaPlayer
?.
isPlaying
==
true
)
{
mMediaPlayer
?.
stop
()
exo_play
.
setImageResource
(
R
.
drawable
.
icon_pause_meditation
)
}
if
(
meditationType
==
0
){
if
(
meditationType
==
0
)
{
tv_time_off_pure_music
.
text
=
""
}
else
{
}
else
{
tv_time_off
.
text
=
""
}
}
}
if
(
mObserver
!=
null
&&
mObserver
is
Observer
<
Long
>)
{
if
(
mObserver
!=
null
&&
mObserver
is
Observer
<
Long
>)
{
mObservable
?.
subscribe
(
mObserver
as
Observer
<
Long
>)
}
if
(
mDisposable
?.
isDisposed
==
true
&&
mObserver
!=
null
&&
mObserver
is
Observer
<
Long
>)
{
if
(
mDisposable
?.
isDisposed
==
true
&&
mObserver
!=
null
&&
mObserver
is
Observer
<
Long
>)
{
mObservable
?.
subscribe
(
mObserver
as
Observer
<
Long
>)
}
}
fun
onEvent
(
event
:
MeditationEvent
){
if
(
event
!=
null
){
LogUtil
.
d
(
"Lancet ====="
,
event
.
toString
())
fun
onEventMainThread
(
event
:
MeditationEvent
)
{
if
(
event
!=
null
)
{
Glide
.
with
(
this
)
.
load
(
event
.
mediaCoverUrl
)
.
into
(
iv_bg
)
tv_title
.
text
=
event
.
title
tv_content
.
text
=
event
.
desc
shareTitle
=
event
.
title
shareContent
=
event
.
desc
shareUrl
=
event
.
mediaUrl
shareImageUrl
=
event
.
mediaCoverUrl
val
status
=
event
.
status
iv_collect
.
setImageResource
(
if
(
status
==
0
)
{
R
.
drawable
.
icon_play_meditation_collect
}
else
{
R
.
drawable
.
icon_meditation_collected
}
)
if
(
event
.
mediaUrl
==
MediaPlayerManager
.
getInstance
(
this
)
?.
getAudioPath
())
{
return
}
initMediaPlayer
(
event
.
mediaUrl
,
0
)
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
if
(
EventBus
.
getDefault
().
isRegistered
(
this
))
{
if
(
EventBus
.
getDefault
().
isRegistered
(
this
))
{
EventBus
.
getDefault
().
unregister
(
this
)
}
...
...
@@ -641,9 +761,8 @@ class PlayMeditationActivity : BaseActivity() {
mTimer
.
cancel
()
}
private
fun
stopPlay
(){
// MediaPlayerManager.getInstance(this).stop()
// MediaPlayerManager.getInstance(this).release()
private
fun
stopPlay
()
{
}
companion
object
{
...
...
m-muse/src/main/java/com/yidianling/muse/helper/FloatViewTouchListener.kt
0 → 100644
View file @
c6b43e16
package
com.yidianling.muse.helper
import
android.view.MotionEvent
import
android.view.View
import
android.view.WindowManager
class
FloatViewTouchListener
(
val
wl
:
WindowManager
.
LayoutParams
,
val
windowManager
:
WindowManager
):
View
.
OnTouchListener
{
private
var
x
=
0
private
var
y
=
0
override
fun
onTouch
(
view
:
View
,
motionEvent
:
MotionEvent
):
Boolean
{
when
(
motionEvent
.
action
)
{
MotionEvent
.
ACTION_DOWN
->
{
x
=
motionEvent
.
rawX
.
toInt
()
y
=
motionEvent
.
rawY
.
toInt
()
}
MotionEvent
.
ACTION_MOVE
->
{
val
nowX
=
motionEvent
.
rawX
.
toInt
()
val
nowY
=
motionEvent
.
rawY
.
toInt
()
val
movedX
=
nowX
-
x
val
movedY
=
nowY
-
y
x
=
nowX
y
=
nowY
wl
.
apply
{
x
+=
movedX
y
+=
movedY
}
//更新悬浮窗位置
windowManager
.
updateViewLayout
(
view
,
wl
)
}
else
->
{
}
}
return
false
}
}
\ No newline at end of file
m-muse/src/main/java/com/yidianling/muse/helper/MediaPlayerManager.kt
View file @
c6b43e16
...
...
@@ -21,6 +21,7 @@ class MediaPlayerManager private constructor() {
}
}
fun
getMediaPlayer
():
MediaPlayer
=
mMediaPlayer
fun
getAudioPath
():
String
?
=
mPath
...
...
m-muse/src/main/java/com/yidianling/muse/helper/MeditationViewModel.kt
0 → 100644
View file @
c6b43e16
package
com.yidianling.muse.helper
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
object
MeditationViewModel
:
ViewModel
()
{
//悬浮窗口创建 移除 基于无障碍服务
var
isShowWindow
=
MutableLiveData
<
Boolean
>()
//悬浮窗口创建 移除
var
isShowSuspendWindow
=
MutableLiveData
<
Boolean
>()
//悬浮窗口显示 隐藏
var
isVisible
=
MutableLiveData
<
Boolean
>()
}
\ No newline at end of file
m-muse/src/main/java/com/yidianling/muse/widget/ShareMeditationDialog.kt
View file @
c6b43e16
...
...
@@ -59,9 +59,11 @@ class ShareMeditationDialog : DialogFragment() {
private
fun
initView
(
view
:
View
?)
{
val
imageUrl
=
"http://static.ydlcdn.com/v1/images/logo320.png"
val
shareImageUrl
=
arguments
?.
getString
(
KEY_SHARE_IMAGE_URL
)
val
shareImageUrl
=
arguments
?.
getString
(
KEY_SHARE_IMAGE_URL
)
?:
""
val
shareTitle
=
arguments
?.
getString
(
KEY_SHARE_TITLE
)
?:
""
val
shareContent
=
arguments
?.
getString
(
KEY_SHARE_CONTENT
)
?:
""
val
shareUrl
=
arguments
?.
getString
(
KEY_SHARE_URL
)
?:
""
ivSharePicture
=
view
?.
findViewById
(
R
.
id
.
iv_share_picture
)
...
...
@@ -83,10 +85,10 @@ class ShareMeditationDialog : DialogFragment() {
ShareUtils
.
shareTo
(
SHARE_MEDIA
.
WEIXIN
,
activity
as
Activity
,
"share_title"
,
"http://www.baidu.com"
,
"share_context"
,
i
mageUrl
shareTitle
,
shareUrl
,
shareContent
,
shareI
mageUrl
)
dismiss
()
}
...
...
@@ -95,10 +97,10 @@ class ShareMeditationDialog : DialogFragment() {
ShareUtils
.
shareTo
(
SHARE_MEDIA
.
WEIXIN_CIRCLE
,
activity
as
Activity
,
"share_title"
,
"https://www.baidu.com"
,
"share_context"
,
i
mageUrl
shareTitle
,
shareUrl
,
shareContent
,
shareI
mageUrl
)
dismiss
()
}
...
...
@@ -112,10 +114,10 @@ class ShareMeditationDialog : DialogFragment() {
ShareUtils
.
shareTo
(
SHARE_MEDIA
.
QZONE
,
activity
as
Activity
,
"share_title"
,
"http://www.baidu.com"
,
"share_context"
,
i
mageUrl
shareTitle
,
shareUrl
,
shareContent
,
shareI
mageUrl
)
dismiss
()
}
...
...
@@ -124,10 +126,10 @@ class ShareMeditationDialog : DialogFragment() {
ShareUtils
.
shareTo
(
SHARE_MEDIA
.
QQ
,
activity
as
Activity
,
"share_title"
,
"http://www.baidu.com"
,
"share_context"
,
i
mageUrl
shareTitle
,
shareUrl
,
shareContent
,
shareI
mageUrl
)
dismiss
()
}
...
...
@@ -141,10 +143,16 @@ class ShareMeditationDialog : DialogFragment() {
companion
object
{
const
val
TAG
=
"ShareMeditationDialog"
private
const
val
KEY_SHARE_TITLE
=
"key_share_title"
private
const
val
KEY_SHARE_URL
=
"key_share_url"
private
const
val
KEY_SHARE_CONTENT
=
"key_share_content"
private
const
val
KEY_SHARE_IMAGE_URL
=
"key_share_image_url"
fun
newInstance
(
shareImageUrl
:
String
):
ShareMeditationDialog
{
fun
newInstance
(
share
Title
:
String
,
shareUrl
:
String
,
shareContent
:
String
,
share
ImageUrl
:
String
):
ShareMeditationDialog
{
val
args
=
Bundle
()
args
.
putString
(
KEY_SHARE_TITLE
,
shareTitle
)
args
.
putString
(
KEY_SHARE_CONTENT
,
shareContent
)
args
.
putString
(
KEY_SHARE_URL
,
shareUrl
)
args
.
putString
(
KEY_SHARE_IMAGE_URL
,
shareImageUrl
)
val
fragment
=
ShareMeditationDialog
()
fragment
.
arguments
=
args
...
...
m-user/src/main/java/com/yidianling/user/mine/MineFragment.java
View file @
c6b43e16
...
...
@@ -484,11 +484,11 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
}
ModularServiceManager
.
INSTANCE
.
provide
(
ICourseService
.
class
).
startMyCourseActivity
(
mActivity
);
}
else
if
(
id
==
R
.
id
.
ll_meditation
){
//冥想
// TODO: 2022/5/6 冥想入口
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
mActivity
,
true
))
{
return
;
}
ToastUtil
.
toastShort
(
"冥想冥想冥想"
);
H5Params
h5Params3
=
new
H5Params
(
HttpConfig
.
Companion
.
getMH5_URL
()
+
"meditation?hideNavBar=1"
,
null
);
NewH5Activity
.
start
(
getActivity
(),
h5Params3
);
}
else
if
(
id
==
R
.
id
.
ll_call_order
)
{
//倾诉
ActionCountUtils
.
Companion
.
count
(
YDL_USER_MY_MIDDLE_TYPE_CLICK
,
"倾诉记录"
);
...
...
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