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
5abdfb2c
Commit
5abdfb2c
authored
May 27, 2022
by
范玉宾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix play record bug
parent
0637f105
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
160 additions
and
118 deletions
+160
-118
PlayFragment.java
app/src/main/java/com/ydl/component/music/PlayFragment.java
+12
-0
home_muse_view.xml
m-home/src/ydl/res/layout/home_muse_view.xml
+2
-0
layout_meditation_item.xml
m-home/src/ydl/res/layout/layout_meditation_item.xml
+5
-3
build.gradle
m-muse/build.gradle
+1
-0
MeditationTimeOffActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/MeditationTimeOffActivity.kt
+15
-0
PlayMeditationActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
+6
-3
MeditationFloatEvent.kt
m-muse/src/main/java/com/yidianling/muse/event/MeditationFloatEvent.kt
+2
-0
MediaPlayerManager.kt
m-muse/src/main/java/com/yidianling/muse/helper/MediaPlayerManager.kt
+3
-17
MeditationWindowService.kt
m-muse/src/main/java/com/yidianling/muse/service/MeditationWindowService.kt
+7
-0
activity_play_meditation.xml
m-muse/src/main/res/layout/activity_play_meditation.xml
+1
-1
activity_play_meditation_time_off.xml
m-muse/src/main/res/layout/activity_play_meditation_time_off.xml
+106
-94
No files found.
app/src/main/java/com/ydl/component/music/PlayFragment.java
View file @
5abdfb2c
...
...
@@ -22,11 +22,14 @@ import com.ydl.media.view.PlayTypeEnum;
import
com.ydl.media.view.PlayerFloatHelper
;
import
com.ydl.ydlcommon.utils.LogUtil
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.muse.event.MeditationFloatEvent
;
import
java.util.HashMap
;
import
java.util.Locale
;
import
java.util.Objects
;
import
de.greenrobot.event.EventBus
;
/**
* Created by haorui on 2019-10-28 .
* Des:
...
...
@@ -61,6 +64,7 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
@Override
public
void
onActivityCreated
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onActivityCreated
(
savedInstanceState
);
EventBus
.
getDefault
().
register
(
this
);
initPlayMode
();
onChangeImpl
(
AudioPlayer
.
Companion
.
get
().
getPlayMusic
());
AudioPlayer
.
Companion
.
get
().
addOnPlayEventListener
(
this
);
...
...
@@ -261,6 +265,9 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
public
void
onDestroy
()
{
AudioPlayer
.
Companion
.
get
().
removeOnPlayEventListener
(
this
);
PlayerFloatHelper
.
Companion
.
onDestroy
();
if
(
EventBus
.
getDefault
().
isRegistered
(
this
)){
EventBus
.
getDefault
().
unregister
(
this
);
}
super
.
onDestroy
();
}
...
...
@@ -290,4 +297,9 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
ivPrev
=
bindSource
.
findViewById
(
R
.
id
.
iv_prev
);
ivCover
=
bindSource
.
findViewById
(
R
.
id
.
iv_cover
);
}
public
void
onEventMainThread
(
MeditationFloatEvent
event
){
}
}
m-home/src/ydl/res/layout/home_muse_view.xml
View file @
5abdfb2c
...
...
@@ -77,6 +77,8 @@
android:layout_width=
"200dp"
android:layout_height=
"40dp"
android:layout_marginBottom=
"14dp"
app:tabTextColor=
"#88FFFFFF"
app:tabSelectedTextColor=
"#FFFFFF"
style=
"@style/MeditationTabLayoutStyle"
/>
<androidx.viewpager2.widget.ViewPager2
...
...
m-home/src/ydl/res/layout/layout_meditation_item.xml
View file @
5abdfb2c
...
...
@@ -20,14 +20,14 @@
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
android:background=
"#88000000"
>
<ImageView
android:id=
"@+id/iv_meditation_type"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"centerCrop"
tools:src=
"@drawable/play_page_default_bg"
/>
android:scaleType=
"centerCrop"
/>
<TextView
android:id=
"@+id/tv_meditation_type"
...
...
@@ -35,6 +35,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|start"
tools:text=
"溪流"
android:singleLine=
"true"
android:ellipsize=
"end"
android:textColor=
"@color/white"
android:textSize=
"14sp"
android:layout_marginStart=
"6dp"
...
...
m-muse/build.gradle
View file @
5abdfb2c
...
...
@@ -60,6 +60,7 @@ dependencies {
implementation
'com.github.weidongjian:androidWheelView:1.0.0'
implementation
'com.github.feeeei:CircleSeekbar:v1.1.2'
implementation
'jp.wasabeef:blurry:4.0.1'
// solve build problem
// cannot access 'androidx.lifecycle.hasdefaultviewmodelproviderfactory'
// Comment out when compiling
...
...
m-muse/src/main/java/com/yidianling/muse/activity/MeditationTimeOffActivity.kt
View file @
5abdfb2c
package
com.yidianling.muse.activity
import
android.content.Intent
import
android.graphics.Color
import
android.os.Bundle
import
android.os.Handler
import
com.blankj.utilcode.util.SPUtils
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
jp.wasabeef.blurry.Blurry
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
()
{
...
...
@@ -20,6 +24,17 @@ class MeditationTimeOffActivity : BaseActivity() {
}
private
fun
initView
()
{
Handler
().
postDelayed
({
Blurry
.
with
(
this
)
.
radius
(
25
)
.
sampling
(
1
)
.
color
(
Color
.
parseColor
(
"#FF173F5D"
))
.
async
()
.
capture
(
iv_bg
)
.
into
(
iv_bg
)
},
300
)
iv_close
?.
setOnClickListener
{
finish
()
}
tv_save_setting
?.
setOnClickListener
{
...
...
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
View file @
5abdfb2c
package
com.yidianling.muse.activity
import
android.content.Intent
import
android.graphics.Color
import
android.media.MediaPlayer
import
android.os.Bundle
import
android.os.Handler
...
...
@@ -39,6 +40,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.disposables.Disposable
import
io.reactivex.functions.Consumer
import
io.reactivex.schedulers.Schedulers
import
jp.wasabeef.blurry.Blurry
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
...
...
@@ -604,7 +606,8 @@ class PlayMeditationActivity : BaseActivity() {
if
(
isLoop
){
if
(
isSingle
||
meditations
.
size
==
1
){
MediaPlayerManager
.
getInstance
(
this
)
?.
setAudioPath
(
currentMeditation
?.
mediaUrl
?:
""
)
MediaPlayerManager
.
getInstance
(
this
)
?.
setAudioPath
(
currentMeditation
?.
mediaUrl
?:
""
,
isLoop
=
true
)
}
else
{
currentMeditationIndex
=
meditations
.
indexOf
(
currentMeditation
)
...
...
@@ -758,7 +761,7 @@ class PlayMeditationActivity : BaseActivity() {
mDisposable
?.
dispose
()
initRxTimeOff
((
minute
*
60
*
1000
).
toLong
(),
1
)
}
val
event
=
MeditationFloatEvent
(
false
,(
minute
*
60
*
1000
).
toLong
())
val
event
=
MeditationFloatEvent
(
false
,
time
=
(
minute
*
60
*
1000
).
toLong
())
EventBus
.
getDefault
().
post
(
event
)
}
else
{
initPlayCompletionListener
()
...
...
@@ -766,7 +769,7 @@ class PlayMeditationActivity : BaseActivity() {
tv_time_off
.
visibility
=
View
.
GONE
tv_time_off_pure_music
.
visibility
=
View
.
GONE
mMediaPlayer
?.
isLooping
=
false
val
event
=
MeditationFloatEvent
(
false
,
0
)
val
event
=
MeditationFloatEvent
(
false
,
time
=
0
)
EventBus
.
getDefault
().
post
(
event
)
}
}
...
...
m-muse/src/main/java/com/yidianling/muse/event/MeditationFloatEvent.kt
View file @
5abdfb2c
...
...
@@ -4,6 +4,7 @@ import com.yidianling.muse.bean.MeditationPlayModuleBean
class
MeditationFloatEvent
(
val
show
:
Boolean
,
val
stop
:
Boolean
?=
null
,
val
time
:
Long
?=
null
,
val
meditationDetail
:
MeditationPlayModuleBean
.
MeditationDetail
?=
null
)
\ No newline at end of file
m-muse/src/main/java/com/yidianling/muse/helper/MediaPlayerManager.kt
View file @
5abdfb2c
...
...
@@ -30,8 +30,10 @@ class MediaPlayerManager private constructor() {
mMediaPlayer
?.
prepareAsync
()
mMediaPlayer
?.
setOnPreparedListener
{
listener
?.
onPrepared
(
it
)
if
(
isLoop
){
mMediaPlayer
?.
seekTo
(
0
)
}
}
}
fun
getMediaPlayer
():
MediaPlayer
?
=
mMediaPlayer
...
...
@@ -65,22 +67,6 @@ class MediaPlayerManager private constructor() {
this
.
listener
=
listener
}
fun
startPlayList
(
audioPaths
:
ArrayList
<
String
>,
playCallBack
:
MediaPlayCallBack
,
startIndex
:
Int
){
if
(
audioPaths
.
isNullOrEmpty
()
||
startIndex
>=
mAudioPaths
.
size
){
return
}
mMediaPlayCallBack
=
playCallBack
mAudioPaths
=
audioPaths
mCurrentListIndex
=
startIndex
mMediaPlayCallBack
?.
mediaPlayCallBack
(
TYPE_LIST
,
MediaPlayCallBack
.
STATE_START
,
mCurrentListIndex
)
setAudioPath
(
mAudioPaths
[
mCurrentListIndex
])
}
companion
object
{
private
var
mContext
:
Context
by
Delegates
.
notNull
()
...
...
m-muse/src/main/java/com/yidianling/muse/service/MeditationWindowService.kt
View file @
5abdfb2c
...
...
@@ -123,6 +123,13 @@ class MeditationWindowService : LifecycleService() {
}
}
else
{
if
(!
event
.
show
)
{
if
(
event
.
stop
==
true
){
try
{
mMediaPlayer
?.
stop
()
}
catch
(
e
:
Exception
){
}
}
hideFloatWindow
()
}
if
(
event
.
show
&&
event
.
meditationDetail
!=
null
)
{
...
...
m-muse/src/main/res/layout/activity_play_meditation.xml
View file @
5abdfb2c
...
...
@@ -6,7 +6,7 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"
@color/_8c
"
>
android:background=
"
#CC282E3F
"
>
<ImageView
android:id=
"@+id/iv_bg"
...
...
m-muse/src/main/res/layout/activity_play_meditation_time_off.xml
View file @
5abdfb2c
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:
background=
"#FF173F5D
"
>
android:
id=
"@+id/root_layout
"
>
<ImageView
android:id=
"@+id/iv_close"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"50dp"
android:layout_marginEnd=
"24dp"
android:padding=
"12dp"
android:src=
"@drawable/icon_play_meditation_time_off_close"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"90dp"
android:text=
"定时关闭"
android:textColor=
"@color/white"
android:textStyle=
"bold"
android:textSize=
"24sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/iv_close"
/>
android:id=
"@+id/iv_bg"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#FF173F5D"
/>
<
Linear
Layout
<
androidx.constraintlayout.widget.Constraint
Layout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:gravity=
"center"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
>
android:layout_height=
"match_parent"
android:background=
"@color/transparent"
>
<
com.weigan.loopview.Loop
View
android:id=
"@+id/
wheel_hour
"
android:layout_width=
"
50dp
"
android:layout_height=
"
240dp
"
a
pp:awv_itemsVisibleCount=
"4
"
a
pp:awv_textsize=
"36
"
a
pp:awv_dividerTextColor=
"0x00FFFFFF
"
a
pp:awv_isLoop=
"fal
se"
app:
awv_outerTextColor=
"0x66FFFFFF
"
app:
awv_centerTextColor=
"@color/white
"
/>
<
Image
View
android:id=
"@+id/
iv_close
"
android:layout_width=
"
wrap_content
"
android:layout_height=
"
wrap_content
"
a
ndroid:layout_marginTop=
"50dp
"
a
ndroid:layout_marginEnd=
"24dp
"
a
ndroid:padding=
"12dp
"
a
ndroid:src=
"@drawable/icon_play_meditation_time_off_clo
se"
app:
layout_constraintTop_toTopOf=
"parent
"
app:
layout_constraintEnd_toEndOf=
"parent
"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin
Start=
"16
dp"
android:text=
"
小时
"
android:layout_margin
Top=
"90
dp"
android:text=
"
定时关闭
"
android:textColor=
"@color/white"
android:textSize=
"18sp"
/>
android:textStyle=
"bold"
android:textSize=
"24sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/iv_close"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:gravity=
"center"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<com.weigan.loopview.LoopView
android:id=
"@+id/wheel_hour"
android:layout_width=
"50dp"
android:layout_height=
"240dp"
app:awv_itemsVisibleCount=
"4"
app:awv_textsize=
"36"
app:awv_dividerTextColor=
"0x00FFFFFF"
app:awv_isLoop=
"false"
app:awv_outerTextColor=
"0x66FFFFFF"
app:awv_centerTextColor=
"@color/white"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:text=
"小时"
android:textColor=
"@color/white"
android:textSize=
"18sp"
/>
<com.weigan.loopview.LoopView
android:id=
"@+id/wheel_minute"
android:layout_width=
"50dp"
android:layout_height=
"240dp"
android:layout_marginStart=
"60dp"
app:awv_itemsVisibleCount=
"4"
app:awv_textsize=
"36"
app:awv_dividerTextColor=
"0x00FFFFFF"
app:awv_isLoop=
"false"
app:awv_outerTextColor=
"0x66FFFFFF"
app:awv_centerTextColor=
"@color/white"
/>
<com.weigan.loopview.LoopView
android:id=
"@+id/wheel_minute"
android:layout_width=
"50dp"
android:layout_height=
"240dp"
android:layout_marginStart=
"60dp"
app:awv_itemsVisibleCount=
"4"
app:awv_textsize=
"36"
app:awv_dividerTextColor=
"0x00FFFFFF"
app:awv_isLoop=
"false"
app:awv_outerTextColor=
"0x66FFFFFF"
app:awv_centerTextColor=
"@color/white"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:text=
"分钟"
android:textColor=
"@color/white"
android:textSize=
"18sp"
/>
</LinearLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:text=
"分钟"
android:id=
"@+id/tv_cancel_time_off"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_marginBottom=
"50dp"
android:layout_marginHorizontal=
"16dp"
android:background=
"@drawable/bg_cancel_play_meditation_time_off"
android:text=
"关闭定时"
android:textColor=
"@color/white"
android:textSize=
"18sp"
/>
android:textSize=
"16sp"
android:gravity=
"center"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
</LinearLayout>
<TextView
android:id=
"@+id/tv_cancel_time_off"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_marginBottom=
"50dp"
android:layout_marginHorizontal=
"16dp"
android:background=
"@drawable/bg_cancel_play_meditation_time_off"
android:text=
"关闭定时"
android:textColor=
"@color/white"
android:textSize=
"16sp"
android:gravity=
"center"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_save_setting"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_marginBottom=
"28dp"
android:layout_marginHorizontal=
"16dp"
android:background=
"@drawable/bg_save_play_meditation_time_off"
android:text=
"保存设置"
android:textColor=
"#FF282E3F"
android:textSize=
"16sp"
android:gravity=
"center"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/tv_cancel_time_off"
/>
<TextView
android:id=
"@+id/tv_save_setting"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_marginBottom=
"28dp"
android:layout_marginHorizontal=
"16dp"
android:background=
"@drawable/bg_save_play_meditation_time_off"
android:text=
"保存设置"
android:textColor=
"#FF282E3F"
android:textSize=
"16sp"
android:gravity=
"center"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/tv_cancel_time_off"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
</FrameLayout>
\ No newline at end of file
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