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
1a10f407
Commit
1a10f407
authored
May 26, 2022
by
upwork.021
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/d/lancet/4.3.93_muse' into d/lancet/4.3.93_muse
parents
ab504794
674cf978
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
290 additions
and
136 deletions
+290
-136
config.gradle
config.gradle
+10
-10
build.gradle
m-fm/build.gradle
+0
-1
HomeMuseView.kt
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeMuseView.kt
+26
-56
home_button_banner_view.xml
m-home/src/ydl/res/layout/home_button_banner_view.xml
+1
-1
home_muse_view.xml
m-home/src/ydl/res/layout/home_muse_view.xml
+7
-6
MeditationTimeOffActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/MeditationTimeOffActivity.kt
+1
-6
PlayMeditationActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
+59
-20
FloatViewTouchListener.kt
m-muse/src/main/java/com/yidianling/muse/helper/FloatViewTouchListener.kt
+0
-2
MediaPlayerManager.kt
m-muse/src/main/java/com/yidianling/muse/helper/MediaPlayerManager.kt
+65
-1
MeditationWindowService.kt
m-muse/src/main/java/com/yidianling/muse/service/MeditationWindowService.kt
+45
-16
MeditationFloatPermissionUtil.kt
m-muse/src/main/java/com/yidianling/muse/utils/MeditationFloatPermissionUtil.kt
+39
-0
layout_meditation_play_float_view.xml
m-muse/src/main/res/layout/layout_meditation_play_float_view.xml
+1
-1
MineFragment.kt
m-user/src/main/java/com/yidianling/user/mine/MineFragment.kt
+14
-16
YDLShareDialog.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/view/dialog/YDLShareDialog.kt
+0
-0
platform_dialog_share.xml
ydl-platform/src/main/res/layout/platform_dialog_share.xml
+2
-0
ReloadUrlEvent.kt
ydl-webview/src/main/java/com/ydl/event/ReloadUrlEvent.kt
+13
-0
NewH5Activity.java
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
+7
-0
No files found.
config.gradle
View file @
1a10f407
...
@@ -8,13 +8,13 @@ ext {
...
@@ -8,13 +8,13 @@ ext {
"m-confide"
:
"0.0.49.74"
,
"m-confide"
:
"0.0.49.74"
,
"m-consultant"
:
"0.0.60.25"
,
"m-consultant"
:
"0.0.60.25"
,
"m-fm"
:
"0.0.30.08"
,
"m-fm"
:
"0.0.30.08"
,
"m-user"
:
"0.0.62.1
2
"
,
"m-user"
:
"0.0.62.1
6
"
,
"m-home"
:
"0.0.23.
58
"
,
"m-home"
:
"0.0.23.
61
"
,
"m-im"
:
"0.0.21.44"
,
"m-im"
:
"0.0.21.44"
,
"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.3
7
"
,
"m-muse"
:
"0.0.28.3
8
"
,
"m-tests"
:
"0.0.24.18"
,
"m-tests"
:
"0.0.24.18"
,
"m-course"
:
"0.0.43.37"
,
"m-course"
:
"0.0.43.37"
,
...
@@ -35,10 +35,10 @@ ext {
...
@@ -35,10 +35,10 @@ ext {
//mdt 组件
//mdt 组件
"ydl-tuicore"
:
"0.0.23"
,
"ydl-tuicore"
:
"0.0.23"
,
//第一步
//第一步
"ydl-platform"
:
"0.0.41.
06
"
,
"ydl-platform"
:
"0.0.41.
15
"
,
//第二步 若干
//第二步 若干
"ydl-webview"
:
"0.0.38.7
5
"
,
"ydl-webview"
:
"0.0.38.7
9
"
,
"ydl-media"
:
"0.0.21.44"
,
"ydl-media"
:
"0.0.21.44"
,
"ydl-pay"
:
"0.0.18.19"
,
"ydl-pay"
:
"0.0.18.19"
,
"m-audioim"
:
"0.0.49.29.90"
,
"m-audioim"
:
"0.0.49.29.90"
,
...
@@ -93,13 +93,13 @@ ext {
...
@@ -93,13 +93,13 @@ ext {
"m-confide"
:
"0.0.49.74"
,
"m-confide"
:
"0.0.49.74"
,
"m-consultant"
:
"0.0.60.25"
,
"m-consultant"
:
"0.0.60.25"
,
"m-fm"
:
"0.0.30.08"
,
"m-fm"
:
"0.0.30.08"
,
"m-user"
:
"0.0.62.1
2
"
,
"m-user"
:
"0.0.62.1
6
"
,
"m-home"
:
"0.0.23.
58
"
,
"m-home"
:
"0.0.23.
61
"
,
"m-im"
:
"0.0.21.44"
,
"m-im"
:
"0.0.21.44"
,
"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.3
7
"
,
"m-muse"
:
"0.0.28.3
8
"
,
"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 层 --------------
...
@@ -118,10 +118,10 @@ ext {
...
@@ -118,10 +118,10 @@ ext {
//mdt组件
//mdt组件
"ydl-tuicore"
:
"0.0.23"
,
"ydl-tuicore"
:
"0.0.23"
,
//第一步
//第一步
"ydl-platform"
:
"0.0.41.
06
"
,
"ydl-platform"
:
"0.0.41.
15
"
,
//第二步 若干
//第二步 若干
"ydl-webview"
:
"0.0.38.7
5
"
,
"ydl-webview"
:
"0.0.38.7
9
"
,
"ydl-media"
:
"0.0.21.44"
,
"ydl-media"
:
"0.0.21.44"
,
"ydl-pay"
:
"0.0.18.19"
,
"ydl-pay"
:
"0.0.18.19"
,
"m-audioim"
:
"0.0.49.29.90"
,
"m-audioim"
:
"0.0.49.29.90"
,
...
...
m-fm/build.gradle
View file @
1a10f407
...
@@ -73,7 +73,6 @@ dependencies {
...
@@ -73,7 +73,6 @@ dependencies {
if
(
rootProject
.
ext
.
dev_mode
){
if
(
rootProject
.
ext
.
dev_mode
){
//开发时使用
//开发时使用
api
project
(
":ydl-platform"
)
api
project
(
":ydl-platform"
)
api
project
(
':m-user'
)
implementation
modularPublication
(
'com.ydl:m-user-api'
)
implementation
modularPublication
(
'com.ydl:m-user-api'
)
implementation
modularPublication
(
'com.ydl:m-dynamic-api'
)
implementation
modularPublication
(
'com.ydl:m-dynamic-api'
)
implementation
project
(
':ydl-media'
)
implementation
project
(
':ydl-media'
)
...
...
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeMuseView.kt
View file @
1a10f407
...
@@ -87,87 +87,58 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
...
@@ -87,87 +87,58 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
}
}
iv_video_background
?.
setOnClickListener
{
// homeEvent?.museMoreClick(Gson().toJson(bean))
if
(
Utils
.
isFastClick
())
{
//防止连击
return
@setOnClickListener
}
if
(!
moreLink
.
isNullOrBlank
())
{
NewH5Activity
.
start
(
context
,
H5Params
(
moreLink
,
null
))
}
}
val
greeting
=
bean
.
mditationIndexInfo
?.
greetings
?:
"你好"
val
greeting
=
bean
.
mditationIndexInfo
?.
greetings
?:
"你好"
tv_time
.
text
=
greeting
tv_time
.
text
=
greeting
val
slogan
=
val
slogan
=
if
(
bean
.
mditationIndexInfo
?.
desc
.
isNullOrBlank
()){
if
(
bean
.
mditationIndexInfo
?.
desc
.
isNullOrBlank
())
{
"无常的日子里,呼吸间拾起力量"
"无常的日子里,呼吸间拾起力量"
}
else
{
}
else
{
bean
.
mditationIndexInfo
?.
desc
bean
.
mditationIndexInfo
?.
desc
}
}
tv_meditation_slogan
.
text
=
slogan
tv_meditation_slogan
.
text
=
slogan
val
videoUrl
=
bean
.
mditationIndexInfo
?.
videoLink
val
videoUrl
=
bean
.
mditationIndexInfo
?.
videoLink
val
videoThumbnailUrl
=
bean
.
mditationIndexInfo
?.
mditationIndexUrl
video_view
?.
setVideoPath
(
videoUrl
)
if
(
videoUrl
.
isNullOrBlank
()){
video_view
?.
setOnErrorListener
{
mp
,
what
,
extra
->
Glide
.
with
(
this
)
true
.
load
(
videoThumbnailUrl
)
}
.
transition
(
withCrossFade
())
video_view
?.
setOnPreparedListener
{
.
into
(
iv_video_background
)
it
?.
setVideoScalingMode
(
MediaPlayer
.
VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
)
}
else
{
video_view
?.
setOnInfoListener
{
mp
,
what
,
extra
->
GlideApp
.
with
(
this
)
if
(
what
==
MediaPlayer
.
MEDIA_INFO_VIDEO_RENDERING_START
)
{
.
load
(
videoThumbnailUrl
)
video_view
.
setBackgroundColor
(
Color
.
TRANSPARENT
)
.
transition
(
withCrossFade
())
.
into
(
iv_video_background
)
video_view
?.
setVideoPath
(
videoUrl
)
video_view
?.
setOnErrorListener
{
mp
,
what
,
extra
->
Glide
.
with
(
this
)
.
load
(
bean
.
mditationIndexInfo
?.
mditationIndexUrl
)
.
transition
(
withCrossFade
())
.
into
(
iv_video_background
)
true
}
video_view
?.
setOnPreparedListener
{
it
?.
setVideoScalingMode
(
MediaPlayer
.
VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
)
video_view
?.
setOnInfoListener
{
mp
,
what
,
extra
->
if
(
what
==
MediaPlayer
.
MEDIA_INFO_VIDEO_RENDERING_START
){
iv_video_background
.
visibility
=
View
.
GONE
video_view
.
setBackgroundColor
(
Color
.
TRANSPARENT
)
}
true
}
}
it
?.
start
()
true
it
?.
setVolume
(
0.0F
,
0.0F
)
}
}
video_view
?.
setOnCompletionListener
{
video_view
?.
start
()
}
it
?.
start
()
it
?.
setVolume
(
0.0F
,
0.0F
)
}
}
video_view
?.
setOnCompletionListener
{
video_view
?.
start
()
}
bean
.
mditationListResponse
?.
forEach
{
bean
.
mditationListResponse
?.
forEach
{
meditationTitles
.
add
(
it
.
comment
)
meditationTitles
.
add
(
it
.
comment
)
}
}
view_pager
.
adapter
=
MeditationViewPagerAdapter
(
mContext
,
bean
)
view_pager
.
adapter
=
MeditationViewPagerAdapter
(
mContext
,
bean
)
tab_layout
.
addOnTabSelectedListener
(
object
:
TabLayout
.
OnTabSelectedListener
{
tab_layout
.
addOnTabSelectedListener
(
object
:
TabLayout
.
OnTabSelectedListener
{
override
fun
onTabSelected
(
tab
:
TabLayout
.
Tab
?)
{
override
fun
onTabSelected
(
tab
:
TabLayout
.
Tab
?)
{
var
text
:
String
?
=
tab
?.
text
.
toString
().
trim
()
var
text
:
String
?
=
tab
?.
text
.
toString
().
trim
()
val
spStr
=
SpannableString
(
text
)
val
spStr
=
SpannableString
(
text
)
val
styleSpan
=
StyleSpan
(
Typeface
.
BOLD
)
val
styleSpan
=
StyleSpan
(
Typeface
.
BOLD
)
spStr
.
setSpan
(
styleSpan
,
0
,
text
?.
length
?:
0
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
spStr
.
setSpan
(
styleSpan
,
0
,
text
?.
length
?:
0
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
tab
?.
text
=
spStr
tab
?.
text
=
spStr
}
}
override
fun
onTabUnselected
(
tab
:
TabLayout
.
Tab
?)
{
override
fun
onTabUnselected
(
tab
:
TabLayout
.
Tab
?)
{
var
text
:
String
?
=
tab
?.
text
.
toString
().
trim
()
var
text
:
String
?
=
tab
?.
text
.
toString
().
trim
()
val
spStr
=
SpannableString
(
text
)
val
spStr
=
SpannableString
(
text
)
val
styleSpan
=
StyleSpan
(
Typeface
.
NORMAL
)
val
styleSpan
=
StyleSpan
(
Typeface
.
NORMAL
)
spStr
.
setSpan
(
styleSpan
,
0
,
text
?.
length
?:
0
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
spStr
.
setSpan
(
styleSpan
,
0
,
text
?.
length
?:
0
,
Spanned
.
SPAN_INCLUSIVE_EXCLUSIVE
)
tab
?.
text
=
spStr
tab
?.
text
=
spStr
}
}
...
@@ -177,9 +148,8 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
...
@@ -177,9 +148,8 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
})
})
TabLayoutMediator
(
tab_layout
,
view_pager
){
TabLayoutMediator
(
tab_layout
,
view_pager
)
{
tab
,
position
->
tab
,
position
->
tab
.
text
=
meditationTitles
[
position
]
tab
.
text
=
meditationTitles
[
position
]
}.
attach
()
}.
attach
()
}
}
...
...
m-home/src/ydl/res/layout/home_button_banner_view.xml
View file @
1a10f407
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/platform_color_FFFFFF"
android:textColor=
"@color/platform_color_FFFFFF"
android:textSize=
"@dimen/platform_dp_12"
android:textSize=
"@dimen/platform_dp_12"
android:text=
"
应有尽有
"
/>
android:text=
"
抑郁测量
"
/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
<RelativeLayout
...
...
m-home/src/ydl/res/layout/home_muse_view.xml
View file @
1a10f407
...
@@ -21,7 +21,8 @@
...
@@ -21,7 +21,8 @@
<FrameLayout
<FrameLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
android:background=
"#999999"
>
<com.yidianling.home.widget.AdaptiveVideoView
<com.yidianling.home.widget.AdaptiveVideoView
android:id=
"@+id/video_view"
android:id=
"@+id/video_view"
...
@@ -30,11 +31,11 @@
...
@@ -30,11 +31,11 @@
android:focusable=
"false"
android:focusable=
"false"
android:focusableInTouchMode=
"false"
/>
android:focusableInTouchMode=
"false"
/>
<ImageView
<!-- <ImageView-->
android:id=
"@+id/iv_video_background"
<!-- android:id="@+id/iv_video_background"-->
android:layout_width=
"match_parent"
<!-- android:layout_width="match_parent"-->
android:layout_height=
"match_parent"
<!-- android:layout_height="match_parent"-->
android:scaleType=
"fitCenter"
/
>
<!-- android:scaleType="fitCenter"/>--
>
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
m-muse/src/main/java/com/yidianling/muse/activity/MeditationTimeOffActivity.kt
View file @
1a10f407
...
@@ -4,7 +4,6 @@ import android.content.Intent
...
@@ -4,7 +4,6 @@ import android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
com.blankj.utilcode.util.SPUtils
import
com.blankj.utilcode.util.SPUtils
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.bean.StatusBarOptions
import
com.ydl.ydlcommon.utils.StatusBarUtils
import
com.ydl.ydlcommon.utils.StatusBarUtils
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.yidianling.muse.R
import
com.yidianling.muse.R
...
@@ -85,12 +84,8 @@ class MeditationTimeOffActivity : BaseActivity() {
...
@@ -85,12 +84,8 @@ class MeditationTimeOffActivity : BaseActivity() {
}
}
override
fun
getStatusViewOptions
():
StatusBarOptions
{
return
StatusBarOptions
(
true
,
false
)
}
override
fun
initDataAndEvent
()
{
override
fun
initDataAndEvent
()
{
StatusBarUtils
.
setWindowStatusBarColor
(
this
,
R
.
color
.
platform_main_theme
)
}
}
override
fun
layoutResId
():
Int
{
override
fun
layoutResId
():
Int
{
...
...
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
View file @
1a10f407
...
@@ -12,10 +12,10 @@ import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
...
@@ -12,10 +12,10 @@ import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import
com.ydl.webview.H5Params
import
com.ydl.webview.H5Params
import
com.ydl.webview.NewH5Activity
import
com.ydl.webview.NewH5Activity
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.bean.StatusBarOptions
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
import
com.ydl.ydlcommon.event.MeditationEvent
import
com.ydl.ydlcommon.event.MeditationEvent
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.utils.StatusBarUtils
import
com.ydl.ydlcommon.utils.StatusBarUtils.Companion.setTransparentForImageView
import
com.ydl.ydlcommon.utils.StatusBarUtils.Companion.setTransparentForImageView
import
com.ydl.ydlcommon.utils.StatusBarUtils.Companion.statusBarLightMode
import
com.ydl.ydlcommon.utils.StatusBarUtils.Companion.statusBarLightMode
import
com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.utils.Utils
...
@@ -28,6 +28,7 @@ import com.yidianling.muse.dialog.ChooseMusicDialog
...
@@ -28,6 +28,7 @@ import com.yidianling.muse.dialog.ChooseMusicDialog
import
com.yidianling.muse.event.MeditationFloatEvent
import
com.yidianling.muse.event.MeditationFloatEvent
import
com.yidianling.muse.helper.MediaPlayerManager
import
com.yidianling.muse.helper.MediaPlayerManager
import
com.yidianling.muse.utils.MediaPlayerTimeUtil
import
com.yidianling.muse.utils.MediaPlayerTimeUtil
import
com.yidianling.muse.utils.MeditationFloatPermissionUtil
import
com.yidianling.muse.widget.QuitMeditationDialog
import
com.yidianling.muse.widget.QuitMeditationDialog
import
com.yidianling.muse.widget.ShareMeditationDialog
import
com.yidianling.muse.widget.ShareMeditationDialog
import
com.yidianling.user.api.service.IUserService
import
com.yidianling.user.api.service.IUserService
...
@@ -63,6 +64,7 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -63,6 +64,7 @@ class PlayMeditationActivity : BaseActivity() {
private
var
meditations
=
mutableListOf
<
MeditationPlayModuleBean
.
MeditationDetail
>()
private
var
meditations
=
mutableListOf
<
MeditationPlayModuleBean
.
MeditationDetail
>()
private
var
currentMeditation
:
MeditationPlayModuleBean
.
MeditationDetail
?
=
null
private
var
currentMeditation
:
MeditationPlayModuleBean
.
MeditationDetail
?
=
null
private
var
currentMeditationIndex
=
0
private
var
shareTitle
=
""
private
var
shareTitle
=
""
private
var
shareUrl
=
""
private
var
shareUrl
=
""
...
@@ -86,6 +88,9 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -86,6 +88,9 @@ class PlayMeditationActivity : BaseActivity() {
private
var
mObservable
:
Observable
<
Long
>?
=
null
private
var
mObservable
:
Observable
<
Long
>?
=
null
private
var
mObserver
:
Observer
<
Long
>?
=
null
private
var
mObserver
:
Observer
<
Long
>?
=
null
private
var
status
=
0
private
var
buried
:
String
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
setTransparentForImageView
(
this
,
null
)
setTransparentForImageView
(
this
,
null
)
statusBarLightMode
(
this
)
statusBarLightMode
(
this
)
...
@@ -106,7 +111,7 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -106,7 +111,7 @@ class PlayMeditationActivity : BaseActivity() {
}
}
override
fun
initDataAndEvent
()
{
override
fun
initDataAndEvent
()
{
StatusBarUtils
.
setWindowStatusBarColor
(
this
,
R
.
color
.
platform_main_theme
)
}
}
private
fun
getData
()
{
private
fun
getData
()
{
...
@@ -114,7 +119,6 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -114,7 +119,6 @@ class PlayMeditationActivity : BaseActivity() {
if
(
meditationType
==
null
||
(
mediaId
==
null
&&
meditationType
!=
0
))
{
if
(
meditationType
==
null
||
(
mediaId
==
null
&&
meditationType
!=
0
))
{
return
return
}
}
// 声音详情
// 声音详情
if
(
meditationType
==
0
)
{
if
(
meditationType
==
0
)
{
MuseHttp
.
getInstance
().
getPureMusicPlayDetail
(
MuseHttp
.
getInstance
().
getPureMusicPlayDetail
(
...
@@ -143,7 +147,9 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -143,7 +147,9 @@ class PlayMeditationActivity : BaseActivity() {
businessType
=
meditationPlayBean
.
businessType
businessType
=
meditationPlayBean
.
businessType
val
status
=
meditationPlayBean
.
status
status
=
meditationPlayBean
.
status
buried
=
meditationPlayBean
.
buried
collected
=
status
==
1
collected
=
status
==
1
...
@@ -213,7 +219,9 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -213,7 +219,9 @@ class PlayMeditationActivity : BaseActivity() {
businessType
=
meditationPlayBean
.
businessType
businessType
=
meditationPlayBean
.
businessType
val
status
=
meditationPlayBean
.
status
status
=
meditationPlayBean
.
status
buried
=
meditationPlayBean
.
buried
collected
=
status
==
1
collected
=
status
==
1
...
@@ -332,10 +340,6 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -332,10 +340,6 @@ class PlayMeditationActivity : BaseActivity() {
return
R
.
layout
.
activity_play_meditation
return
R
.
layout
.
activity_play_meditation
}
}
override
fun
getStatusViewOptions
():
StatusBarOptions
{
return
StatusBarOptions
(
true
,
false
)
}
private
fun
initView
()
{
private
fun
initView
()
{
shareImageUrl
=
mediaCoverUrl
shareImageUrl
=
mediaCoverUrl
...
@@ -381,10 +385,6 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -381,10 +385,6 @@ class PlayMeditationActivity : BaseActivity() {
}
}
iv_back
.
setOnClickListener
{
iv_back
.
setOnClickListener
{
// MeditationViewModel.isVisible.postValue(true)
// MeditationViewModel.meditation.postValue(currentMeditation)
// MeditationViewModel.meditations.postValue(meditations as ArrayList<MeditationPlayModuleBean.MeditationDetail>)
// LogUtil.d("Lancet=======","post $currentMeditation")
val
event
=
MeditationFloatEvent
(
true
,
meditationDetail
=
currentMeditation
)
val
event
=
MeditationFloatEvent
(
true
,
meditationDetail
=
currentMeditation
)
EventBus
.
getDefault
().
post
(
event
)
EventBus
.
getDefault
().
post
(
event
)
...
@@ -586,10 +586,46 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -586,10 +586,46 @@ class PlayMeditationActivity : BaseActivity() {
})
})
initPlayCompletionListener
()
}
private
fun
initPlayCompletionListener
(
isLoop
:
Boolean
=
false
,
isSingle
:
Boolean
=
false
){
mMediaPlayer
?.
setOnCompletionListener
{
mMediaPlayer
?.
setOnCompletionListener
{
postPlayRecord
(
isQuit
=
0
,
postPlayRecord
(
isQuit
=
0
,
playTime
=
(
seekbar_play_progress
.
progress
/
1000.00
).
roundToInt
(),
playTime
=
(
seekbar_play_progress
.
progress
/
1000.00
).
roundToInt
(),
isComplete
=
1
)
isComplete
=
1
)
if
(
isLoop
){
if
(
isSingle
||
meditations
.
size
==
1
){
MediaPlayerManager
.
getInstance
(
this
)
?.
setAudioPath
(
currentMeditation
?.
mediaUrl
?:
""
)
}
else
{
currentMeditationIndex
=
meditations
.
indexOf
(
currentMeditation
)
if
(
currentMeditationIndex
==
meditations
.
size
-
1
){
currentMeditationIndex
=
0
}
else
{
currentMeditationIndex
++
}
currentMeditation
=
meditations
[
currentMeditationIndex
]
val
event
=
MeditationEvent
(
currentMeditation
?.
mediaId
?.
toInt
()
?:
0
,
meditationId
?:
0L
,
meditationType
?:
0
,
businessType
,
status
=
status
,
buried
=
buried
?:
""
,
mediaUrl
=
currentMeditation
?.
mediaUrl
?:
""
,
mediaCoverUrl
=
currentMeditation
?.
coverImageUrl
?:
""
,
title
=
currentMeditation
?.
title
?:
""
,
desc
=
currentMeditation
?.
desc
?:
""
)
EventBus
.
getDefault
().
post
(
event
)
}
}
isPlaying
=
if
(
it
.
isPlaying
)
{
isPlaying
=
if
(
it
.
isPlaying
)
{
exo_play
.
setImageResource
(
R
.
drawable
.
icon_pause_play
)
exo_play
.
setImageResource
(
R
.
drawable
.
icon_pause_play
)
true
true
...
@@ -601,7 +637,6 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -601,7 +637,6 @@ class PlayMeditationActivity : BaseActivity() {
mMediaPlayer
?.
pause
()
mMediaPlayer
?.
pause
()
}
}
}
}
}
}
private
fun
postPlayRecord
(
isQuit
:
Int
,
playTime
:
Int
,
isComplete
:
Int
)
{
private
fun
postPlayRecord
(
isQuit
:
Int
,
playTime
:
Int
,
isComplete
:
Int
)
{
...
@@ -707,22 +742,24 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -707,22 +742,24 @@ class PlayMeditationActivity : BaseActivity() {
val
minute
=
data
?.
extras
?.
getInt
(
"TIME_OFF_MINUTE"
,
0
)
val
minute
=
data
?.
extras
?.
getInt
(
"TIME_OFF_MINUTE"
,
0
)
if
(
minute
!=
null
&&
minute
>
0
)
{
if
(
minute
!=
null
&&
minute
>
0
)
{
if
(
meditationType
==
0
)
{
if
(
meditationType
==
0
)
{
initPlayCompletionListener
(
isLoop
=
true
,
isSingle
=
true
)
tv_time_off_pure_music
.
visibility
=
View
.
VISIBLE
tv_time_off_pure_music
.
visibility
=
View
.
VISIBLE
tv_time_off
.
visibility
=
View
.
GONE
tv_time_off
.
visibility
=
View
.
GONE
mDisposable
?.
dispose
()
mDisposable
?.
dispose
()
initRxTimeOff
((
minute
*
60
*
1000
).
toLong
(),
0
)
initRxTimeOff
((
minute
*
60
*
1000
).
toLong
(),
0
)
}
else
{
}
else
{
initPlayCompletionListener
(
isLoop
=
true
,
isSingle
=
false
)
tv_time_off_pure_music
.
visibility
=
View
.
GONE
tv_time_off_pure_music
.
visibility
=
View
.
GONE
tv_time_off
.
visibility
=
View
.
VISIBLE
tv_time_off
.
visibility
=
View
.
VISIBLE
mDisposable
?.
dispose
()
mDisposable
?.
dispose
()
initRxTimeOff
((
minute
*
60
*
1000
).
toLong
(),
1
)
initRxTimeOff
((
minute
*
60
*
1000
).
toLong
(),
1
)
}
}
}
else
{
}
else
{
initPlayCompletionListener
()
mDisposable
?.
dispose
()
mDisposable
?.
dispose
()
tv_time_off
.
visibility
=
View
.
GONE
tv_time_off
.
visibility
=
View
.
GONE
tv_time_off_pure_music
.
visibility
=
View
.
GONE
tv_time_off_pure_music
.
visibility
=
View
.
GONE
mMediaPlayer
?.
isLooping
=
false
}
}
}
}
}
}
...
@@ -801,19 +838,21 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -801,19 +838,21 @@ class PlayMeditationActivity : BaseActivity() {
if
(
event
.
mediaUrl
==
MediaPlayerManager
.
getInstance
(
this
)
?.
getAudioPath
())
{
if
(
event
.
mediaUrl
==
MediaPlayerManager
.
getInstance
(
this
)
?.
getAudioPath
())
{
return
return
}
}
initMediaPlayer
(
event
.
mediaUrl
,
0
)
initMediaPlayer
(
event
.
mediaUrl
,
0
)
}
}
}
}
override
fun
onBackPressed
()
{
val
event
=
MeditationFloatEvent
(
true
,
meditationDetail
=
currentMeditation
)
EventBus
.
getDefault
().
post
(
event
)
super
.
onBackPressed
()
}
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
super
.
onDestroy
()
super
.
onDestroy
()
if
(
EventBus
.
getDefault
().
isRegistered
(
this
))
{
if
(
EventBus
.
getDefault
().
isRegistered
(
this
))
{
EventBus
.
getDefault
().
unregister
(
this
)
EventBus
.
getDefault
().
unregister
(
this
)
}
}
mDisposable
?.
dispose
()
mDisposable
?.
dispose
()
mTimer
.
cancel
()
mTimer
.
cancel
()
}
}
...
...
m-muse/src/main/java/com/yidianling/muse/helper/FloatViewTouchListener.kt
View file @
1a10f407
...
@@ -27,8 +27,6 @@ class FloatViewTouchListener(val wl: WindowManager.LayoutParams, val windowManag
...
@@ -27,8 +27,6 @@ class FloatViewTouchListener(val wl: WindowManager.LayoutParams, val windowManag
x
+=
movedX
x
+=
movedX
y
+=
movedY
y
+=
movedY
}
}
LogUtil
.
d
(
"Lancet======="
,
"nowY=====$nowY"
)
LogUtil
.
d
(
"Lancet======="
,
"movedY=====$movedY"
)
//更新悬浮窗位置
//更新悬浮窗位置
windowManager
.
updateViewLayout
(
view
,
wl
)
windowManager
.
updateViewLayout
(
view
,
wl
)
}
}
...
...
m-muse/src/main/java/com/yidianling/muse/helper/MediaPlayerManager.kt
View file @
1a10f407
...
@@ -4,13 +4,18 @@ import android.content.Context
...
@@ -4,13 +4,18 @@ import android.content.Context
import
android.media.AudioAttributes
import
android.media.AudioAttributes
import
android.media.AudioManager
import
android.media.AudioManager
import
android.media.MediaPlayer
import
android.media.MediaPlayer
import
com.yidianling.muse.helper.MediaPlayerManager.MediaPlayCallBack.Companion.TYPE_LIST
import
kotlin.properties.Delegates
import
kotlin.properties.Delegates
class
MediaPlayerManager
private
constructor
()
{
class
MediaPlayerManager
private
constructor
()
{
private
var
listener
:
OnMediaPlayerManagerListener
?=
null
private
var
listener
:
OnMediaPlayerManagerListener
?=
null
fun
setAudioPath
(
path
:
String
){
private
var
mCurrentListIndex
=
0
private
var
mMediaPlayCallBack
:
MediaPlayCallBack
?=
null
private
var
mAudioPaths
=
mutableListOf
<
String
>()
fun
setAudioPath
(
path
:
String
,
isLoop
:
Boolean
=
false
){
val
attrs
=
AudioAttributes
.
Builder
()
val
attrs
=
AudioAttributes
.
Builder
()
.
setContentType
(
AudioAttributes
.
CONTENT_TYPE_MUSIC
)
.
setContentType
(
AudioAttributes
.
CONTENT_TYPE_MUSIC
)
...
@@ -26,6 +31,29 @@ class MediaPlayerManager private constructor() {
...
@@ -26,6 +31,29 @@ class MediaPlayerManager private constructor() {
mMediaPlayer
?.
setOnPreparedListener
{
mMediaPlayer
?.
setOnPreparedListener
{
listener
?.
onPrepared
(
it
)
listener
?.
onPrepared
(
it
)
}
}
// mMediaPlayer?.setOnCompletionListener {
// if (it !=null){
// it.stop()
// it.release()
// }
//
// mMediaPlayer = null
// if (mAudioPaths!=null){
// mCurrentListIndex++
// if(mCurrentListIndex<mAudioPaths.size){
// mMediaPlayCallBack?.mediaPlayCallBack(TYPE_LIST,
// MediaPlayCallBack.STATE_CUT, mCurrentListIndex)
// setAudioPath(mAudioPaths[mCurrentListIndex])
// }else{
// mMediaPlayCallBack?.mediaPlayCallBack(TYPE_LIST,
// MediaPlayCallBack.STATE_STOP,mAudioPaths.size
// )
// }
// }
//
// }
}
}
fun
getMediaPlayer
():
MediaPlayer
?
=
mMediaPlayer
fun
getMediaPlayer
():
MediaPlayer
?
=
mMediaPlayer
...
@@ -59,6 +87,22 @@ class MediaPlayerManager private constructor() {
...
@@ -59,6 +87,22 @@ class MediaPlayerManager private constructor() {
this
.
listener
=
listener
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
{
companion
object
{
private
var
mContext
:
Context
by
Delegates
.
notNull
()
private
var
mContext
:
Context
by
Delegates
.
notNull
()
...
@@ -90,4 +134,23 @@ class MediaPlayerManager private constructor() {
...
@@ -90,4 +134,23 @@ class MediaPlayerManager private constructor() {
fun
onPrepared
(
mediaPlayer
:
MediaPlayer
)
fun
onPrepared
(
mediaPlayer
:
MediaPlayer
)
}
}
interface
MediaPlayCallBack
{
companion
object
{
const
val
STATE_START
=
0
const
val
STATE_PLAY
=
1
const
val
STATE_PAUSE
=
2
const
val
STATE_STOP
=
3
const
val
STATE_CUT
=
4
const
val
TYPE_SINGLE
=
0
const
val
TYPE_LIST
=
1
}
fun
mediaPlayCallBack
(
type
:
Int
,
state
:
Int
,
position
:
Int
){}
}
}
}
\ No newline at end of file
m-muse/src/main/java/com/yidianling/muse/service/MeditationWindowService.kt
View file @
1a10f407
package
com.yidianling.muse.service
package
com.yidianling.muse.service
import
android.app.NotificationChannel
import
android.app.NotificationManager
import
android.content.ComponentName
import
android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.content.Intent.FLAG_ACTIVITY_NEW_TASK
import
android.content.Intent.FLAG_ACTIVITY_NEW_TASK
import
android.graphics.PixelFormat
import
android.graphics.PixelFormat
...
@@ -13,6 +17,7 @@ import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
...
@@ -13,6 +17,7 @@ import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import
android.view.WindowManager
import
android.view.WindowManager
import
android.widget.ImageView
import
android.widget.ImageView
import
android.widget.TextView
import
android.widget.TextView
import
androidx.core.app.NotificationCompat
import
androidx.lifecycle.LifecycleService
import
androidx.lifecycle.LifecycleService
import
com.bumptech.glide.Glide
import
com.bumptech.glide.Glide
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
...
@@ -21,7 +26,6 @@ import com.yidianling.muse.R
...
@@ -21,7 +26,6 @@ import com.yidianling.muse.R
import
com.yidianling.muse.activity.PlayMeditationActivity
import
com.yidianling.muse.activity.PlayMeditationActivity
import
com.yidianling.muse.bean.MeditationPlayModuleBean
import
com.yidianling.muse.bean.MeditationPlayModuleBean
import
com.yidianling.muse.event.MeditationFloatEvent
import
com.yidianling.muse.event.MeditationFloatEvent
import
com.yidianling.muse.helper.FloatViewTouchListener
import
com.yidianling.muse.helper.MediaPlayerManager
import
com.yidianling.muse.helper.MediaPlayerManager
import
de.greenrobot.event.EventBus
import
de.greenrobot.event.EventBus
import
io.feeeei.circleseekbar.CircleSeekBar
import
io.feeeei.circleseekbar.CircleSeekBar
...
@@ -51,6 +55,18 @@ class MeditationWindowService : LifecycleService() {
...
@@ -51,6 +55,18 @@ class MeditationWindowService : LifecycleService() {
override
fun
onCreate
()
{
override
fun
onCreate
()
{
super
.
onCreate
()
super
.
onCreate
()
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
ECLAIR
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
){
val
manager
=
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
val
channel
=
NotificationChannel
(
"壹点灵"
,
"play"
,
NotificationManager
.
IMPORTANCE_LOW
)
manager
.
createNotificationChannel
(
channel
)
val
notification
=
NotificationCompat
.
Builder
(
this
,
"壹点灵"
).
build
()
startForeground
(
1
,
notification
)
}
}
EventBus
.
getDefault
().
register
(
this
)
EventBus
.
getDefault
().
register
(
this
)
}
}
...
@@ -66,30 +82,23 @@ class MeditationWindowService : LifecycleService() {
...
@@ -66,30 +82,23 @@ class MeditationWindowService : LifecycleService() {
}
}
flags
=
flags
=
WindowManager
.
LayoutParams
.
FLAG_NOT_TOUCH_MODAL
or
WindowManager
.
LayoutParams
.
FLAG_NOT_FOCUSABLE
WindowManager
.
LayoutParams
.
FLAG_NOT_TOUCH_MODAL
or
WindowManager
.
LayoutParams
.
FLAG_NOT_FOCUSABLE
format
=
PixelFormat
.
RGBA_8888
format
=
PixelFormat
.
RGBA_8888
width
=
outMetrics
.
widthPixels
-
dp2px
(
32F
)
width
=
outMetrics
.
widthPixels
-
dp2px
(
32F
)
height
=
WRAP_CONTENT
height
=
WRAP_CONTENT
gravity
=
Gravity
.
CENTER_HORIZONTAL
or
Gravity
.
TOP
gravity
=
Gravity
.
CENTER_HORIZONTAL
or
Gravity
.
BOTTOM
x
=
outMetrics
.
widthPixels
/
2
-
width
/
2
y
=
outMetrics
.
heightPixels
-
height
*
2
}
}
floatRootView
=
floatRootView
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
layout_meditation_play_float_view
,
null
)
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
layout_meditation_play_float_view
,
null
)
ivClose
=
floatRootView
?.
findViewById
(
R
.
id
.
iv_close
)
ivClose
=
floatRootView
?.
findViewById
(
R
.
id
.
iv_close
)
ivCover
=
floatRootView
?.
findViewById
(
R
.
id
.
iv_cover
)
ivCover
=
floatRootView
?.
findViewById
(
R
.
id
.
iv_cover
)
tvTitle
=
floatRootView
?.
findViewById
(
R
.
id
.
tv_title
)
tvTitle
=
floatRootView
?.
findViewById
(
R
.
id
.
tv_title
)
ivProgress
=
floatRootView
?.
findViewById
(
R
.
id
.
progress_bar
)
ivProgress
=
floatRootView
?.
findViewById
(
R
.
id
.
progress_bar
)
ivPlayOrPause
=
floatRootView
?.
findViewById
(
R
.
id
.
iv_play_status
)
ivPlayOrPause
=
floatRootView
?.
findViewById
(
R
.
id
.
iv_play_status
)
// floatRootView?.setOnTouchListener(FloatViewTouchListener(layoutParams, mWindowManager))
floatRootView
?.
setOnTouchListener
(
FloatViewTouchListener
(
layoutParams
,
mWindowManager
))
mWindowManager
.
addView
(
floatRootView
,
layoutParams
)
mWindowManager
.
addView
(
floatRootView
,
layoutParams
)
windowIsShow
=
true
windowIsShow
=
true
}
}
...
@@ -106,9 +115,7 @@ class MeditationWindowService : LifecycleService() {
...
@@ -106,9 +115,7 @@ class MeditationWindowService : LifecycleService() {
}
}
private
fun
updateFloatView
(
meditation
:
MeditationPlayModuleBean
.
MeditationDetail
)
{
private
fun
updateFloatView
(
meditation
:
MeditationPlayModuleBean
.
MeditationDetail
)
{
mMediaPlayer
=
MediaPlayerManager
.
getInstance
(
this
)
?.
getMediaPlayer
()
mMediaPlayer
=
MediaPlayerManager
.
getInstance
(
this
)
?.
getMediaPlayer
()
floatRootView
?.
setOnClickListener
{
floatRootView
?.
setOnClickListener
{
val
intent
=
Intent
(
this
,
PlayMeditationActivity
::
class
.
java
)
val
intent
=
Intent
(
this
,
PlayMeditationActivity
::
class
.
java
)
intent
.
putExtra
(
"MEDIA_ID"
,
meditation
.
mediaId
)
intent
.
putExtra
(
"MEDIA_ID"
,
meditation
.
mediaId
)
...
@@ -120,7 +127,6 @@ class MeditationWindowService : LifecycleService() {
...
@@ -120,7 +127,6 @@ class MeditationWindowService : LifecycleService() {
}
}
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
{
ivPlayOrPause
?.
setImageResource
(
R
.
drawable
.
icon_meditation_float_pause
)
ivPlayOrPause
?.
setImageResource
(
R
.
drawable
.
icon_meditation_float_pause
)
...
@@ -180,6 +186,11 @@ class MeditationWindowService : LifecycleService() {
...
@@ -180,6 +186,11 @@ class MeditationWindowService : LifecycleService() {
meditation
.
meditationId
.
toInt
(),
meditation
.
meditationId
.
toInt
(),
meditation
.
mediaId
?:
0L
meditation
.
mediaId
?:
0L
)
)
if
(
mMediaPlayer
?.
isPlaying
==
true
)
{
ivPlayOrPause
?.
setImageResource
(
R
.
drawable
.
icon_meditation_float_play
)
}
else
{
ivPlayOrPause
?.
setImageResource
(
R
.
drawable
.
icon_meditation_float_pause
)
}
}
}
ivClose
?.
setOnClickListener
{
ivClose
?.
setOnClickListener
{
...
@@ -199,17 +210,35 @@ class MeditationWindowService : LifecycleService() {
...
@@ -199,17 +210,35 @@ class MeditationWindowService : LifecycleService() {
if
(
floatRootView
!=
null
&&
floatRootView
?.
windowToken
!=
null
)
{
if
(
floatRootView
!=
null
&&
floatRootView
?.
windowToken
!=
null
)
{
if
(
mWindowManager
!=
null
)
{
if
(
mWindowManager
!=
null
)
{
windowIsShow
=
false
windowIsShow
=
false
mTimer
.
cancel
()
mWindowManager
.
removeViewImmediate
(
floatRootView
)
mWindowManager
.
removeViewImmediate
(
floatRootView
)
}
}
}
}
}
}
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
ECLAIR
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
){
startForegroundService
(
intent
)
}
else
{
startService
(
intent
)
}
}
return
super
.
onStartCommand
(
intent
,
flags
,
startId
)
}
override
fun
startForegroundService
(
service
:
Intent
?):
ComponentName
?
{
return
super
.
startForegroundService
(
service
)
}
override
fun
onDestroy
()
{
override
fun
onDestroy
()
{
super
.
onDestroy
()
super
.
onDestroy
()
if
(
EventBus
.
getDefault
().
isRegistered
(
this
))
{
if
(
EventBus
.
getDefault
().
isRegistered
(
this
))
{
EventBus
.
getDefault
().
unregister
(
this
)
EventBus
.
getDefault
().
unregister
(
this
)
}
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
ECLAIR
)
{
stopForeground
(
true
)
}
}
}
private
fun
dp2px
(
dp
:
Float
):
Int
{
private
fun
dp2px
(
dp
:
Float
):
Int
{
...
...
m-muse/src/main/java/com/yidianling/muse/utils/MeditationFloatPermissionUtil.kt
0 → 100644
View file @
1a10f407
package
com.yidianling.muse.utils
import
android.app.Activity
import
android.content.Context
import
android.content.Intent
import
android.net.Uri
import
android.os.Build
import
android.provider.Settings
object
MeditationFloatPermissionUtil
{
const
val
REQUEST_FLOAT_CODE
=
1001
private
fun
commonROMPermissionCheck
(
context
:
Context
?):
Boolean
{
var
result
=
true
if
(
Build
.
VERSION
.
SDK_INT
>=
23
){
try
{
val
clazz
:
Class
<*>
=
Settings
::
class
.
java
val
canDrawOverlays
=
clazz
.
getDeclaredMethod
(
"canDrawOverlays"
,
Context
::
class
.
java
)
result
=
canDrawOverlays
.
invoke
(
null
,
context
)
as
Boolean
}
catch
(
e
:
Exception
){
}
}
return
result
}
fun
checkSuspendedWindowPermission
(
context
:
Activity
,
block
:()
->
Unit
){
if
(
commonROMPermissionCheck
(
context
)){
block
}
else
{
context
.
startActivityForResult
(
Intent
(
Settings
.
ACTION_MANAGE_OVERLAY_PERMISSION
).
apply
{
data
=
Uri
.
parse
(
"package:${context.packageName}"
)
},
REQUEST_FLOAT_CODE
)
}
}
}
\ No newline at end of file
m-muse/src/main/res/layout/layout_meditation_play_float_view.xml
View file @
1a10f407
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<FrameLayout
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"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:background=
"@drawable/
bg_play_meditation_float_view
"
android:background=
"@drawable/
play_float_background
"
android:layout_marginHorizontal=
"16dp"
android:layout_marginHorizontal=
"16dp"
android:layout_marginBottom=
"20dp"
android:layout_marginBottom=
"20dp"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
m-user/src/main/java/com/yidianling/user/mine/MineFragment.kt
View file @
1a10f407
...
@@ -27,6 +27,7 @@ import com.ydl.ydlcommon.utils.BuryPointUtils
...
@@ -27,6 +27,7 @@ import com.ydl.ydlcommon.utils.BuryPointUtils
import
com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.utils.YdlBuryPointUtil
import
com.ydl.ydlcommon.utils.YdlBuryPointUtil
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils.Companion.count
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils.Companion.count
import
com.ydl.ydlcommon.view.dialog.YDLShareDialog
import
com.ydl.ydlcommon.view.dialog.YDLShareDialog.Companion.style4
import
com.ydl.ydlcommon.view.dialog.YDLShareDialog.Companion.style4
import
com.yidianling.consultant.api.IConsultantService
import
com.yidianling.consultant.api.IConsultantService
import
com.yidianling.dynamic.api.IDynamicService
import
com.yidianling.dynamic.api.IDynamicService
...
@@ -53,6 +54,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
...
@@ -53,6 +54,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.functions.Consumer
import
io.reactivex.functions.Consumer
import
io.reactivex.schedulers.Schedulers
import
io.reactivex.schedulers.Schedulers
import
kotlinx.android.synthetic.main.user_mine_fragment_mine.*
import
kotlinx.android.synthetic.main.user_mine_fragment_mine.*
import
java.util.*
/**
/**
* 我的Tab
* 我的Tab
...
@@ -65,7 +67,7 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
...
@@ -65,7 +67,7 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
var
share_head
=
"http://static.ydlcdn.com/v1/images/logo320.png"
var
share_head
=
"http://static.ydlcdn.com/v1/images/logo320.png"
var
share_url
=
"http://m.yidianling.com/app"
var
share_url
=
"http://m.yidianling.com/app"
var
userInfoData
:
UserResponseBean
.
UserInfo
?
=
null
var
userInfoData
:
UserResponseBean
.
UserInfo
?
=
null
private
var
mShareDialog
:
YDLShareDialog
?
=
null
private
var
startTime
:
Long
=
0
private
var
startTime
:
Long
=
0
private
var
endTime
:
Long
=
0
private
var
endTime
:
Long
=
0
override
fun
layoutResId
():
Int
{
override
fun
layoutResId
():
Int
{
...
@@ -131,14 +133,10 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
...
@@ -131,14 +133,10 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
.
getGlobalInfo
()
?.
info
&&
null
!=
PlatformRamImpl
.
getInstance
()
.
getGlobalInfo
()
?.
info
&&
null
!=
PlatformRamImpl
.
getInstance
()
.
getGlobalInfo
()
?.
info
?.
app_share
.
getGlobalInfo
()
?.
info
?.
app_share
)
{
)
{
share_title
=
share_title
=
PlatformRamImpl
.
getInstance
().
getGlobalInfo
()
?.
info
?.
app_share
?.
title
.
toString
()
PlatformRamImpl
.
getInstance
().
getGlobalInfo
()
?.
info
?.
app_share
?.
title
.
toString
()
share_context
=
PlatformRamImpl
.
getInstance
().
getGlobalInfo
()
?.
info
?.
app_share
?.
descrip
.
toString
()
share_context
=
share_head
=
PlatformRamImpl
.
getInstance
().
getGlobalInfo
()
?.
info
?.
app_share
?.
cover_url
.
toString
()
PlatformRamImpl
.
getInstance
().
getGlobalInfo
()
?.
info
?.
app_share
?.
descrip
.
toString
()
share_url
=
PlatformRamImpl
.
getInstance
().
getGlobalInfo
()
?.
info
?.
app_share
?.
dl_url
.
toString
()
share_head
=
PlatformRamImpl
.
getInstance
().
getGlobalInfo
()
?.
info
?.
app_share
?.
cover_url
.
toString
()
share_url
=
PlatformRamImpl
.
getInstance
().
getGlobalInfo
()
?.
info
?.
app_share
?.
dl_url
.
toString
()
}
}
}
}
...
@@ -393,8 +391,7 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
...
@@ -393,8 +391,7 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
.
put
(
"mine_name"
,
"我的动态"
)
.
put
(
"mine_name"
,
"我的动态"
)
.
burryPoint
(
"mine"
)
.
burryPoint
(
"mine"
)
try
{
try
{
val
intentm
=
val
intentm
=
provide
(
IDynamicService
::
class
.
java
).
getMyTrendsActivityIntent
(
activity
)
provide
(
IDynamicService
::
class
.
java
).
getMyTrendsActivityIntent
(
activity
)
startActivity
(
intentm
)
startActivity
(
intentm
)
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
e
.
printStackTrace
()
...
@@ -421,8 +418,7 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
...
@@ -421,8 +418,7 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
BuryPointUtils
.
getInstance
().
createMap
()
BuryPointUtils
.
getInstance
().
createMap
()
.
put
(
"mine_name"
,
"预约订单"
)
.
put
(
"mine_name"
,
"预约订单"
)
.
burryPoint
(
"mine"
)
.
burryPoint
(
"mine"
)
val
h5Params3
=
val
h5Params3
=
H5Params
(
MH5_URL
+
"wb/user/order/list?needOrderHelperAlert=1"
,
null
)
H5Params
(
MH5_URL
+
"wb/user/order/list?needOrderHelperAlert=1"
,
null
)
NewH5Activity
.
start
(
activity
,
h5Params3
)
NewH5Activity
.
start
(
activity
,
h5Params3
)
}
}
...
@@ -515,10 +511,12 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
...
@@ -515,10 +511,12 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
}
}
private
fun
share
()
{
private
fun
share
()
{
val
dialog
=
mActivity
?.
let
{
activity
->
if
(
mShareDialog
==
null
)
{
style4
(
activity
,
share_title
,
share_url
,
share_context
,
share_head
)
mShareDialog
=
mActivity
?.
let
{
activity
->
style4
(
activity
,
share_title
,
share_url
,
share_context
,
share_head
)
}
}
}
d
ialog
?.
show
(
activity
?.
fragmentManager
,
"lose"
)
mShareD
ialog
?.
show
(
activity
?.
fragmentManager
,
"lose"
)
}
}
/**
/**
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/view/dialog/YDLShareDialog.kt
View file @
1a10f407
This diff is collapsed.
Click to expand it.
ydl-platform/src/main/res/layout/platform_dialog_share.xml
View file @
1a10f407
...
@@ -131,6 +131,7 @@
...
@@ -131,6 +131,7 @@
android:layout_width=
"55dp"
android:layout_width=
"55dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:visibility=
"gone"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<ImageView
<ImageView
...
@@ -248,6 +249,7 @@
...
@@ -248,6 +249,7 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/platform_dp_18"
android:layout_marginTop=
"@dimen/platform_dp_18"
android:visibility=
"gone"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
...
...
ydl-webview/src/main/java/com/ydl/event/ReloadUrlEvent.kt
0 → 100644
View file @
1a10f407
package
com.ydl.event
/**
* h5页面内访问URL
*/
class
ReloadUrlEvent
{
var
url
:
String
?
=
null
constructor
(
url
:
String
)
{
this
.
url
=
url
}
}
\ No newline at end of file
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
View file @
1a10f407
...
@@ -34,6 +34,7 @@ import com.tencent.smtt.sdk.WebView;
...
@@ -34,6 +34,7 @@ import com.tencent.smtt.sdk.WebView;
import
com.tencent.smtt.sdk.WebViewClient
;
import
com.tencent.smtt.sdk.WebViewClient
;
import
com.umeng.socialize.UMShareAPI
;
import
com.umeng.socialize.UMShareAPI
;
import
com.umeng.socialize.bean.SHARE_MEDIA
;
import
com.umeng.socialize.bean.SHARE_MEDIA
;
import
com.ydl.event.ReloadUrlEvent
;
import
com.ydl.utils.PopUtils
;
import
com.ydl.utils.PopUtils
;
import
com.ydl.utils.ProxyCheckUtils
;
import
com.ydl.utils.ProxyCheckUtils
;
import
com.ydl.utils.WebUrlParamsUtils
;
import
com.ydl.utils.WebUrlParamsUtils
;
...
@@ -1064,6 +1065,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
...
@@ -1064,6 +1065,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
}
}
}
public
void
onEvent
(
ReloadUrlEvent
event
)
{
//刷新页面
loadUrl
(
event
.
getUrl
());
shouldClearHistory
=
true
;
}
public
void
onEvent
(
UserBindPhoneEvent
event
)
{
public
void
onEvent
(
UserBindPhoneEvent
event
)
{
//刷新页面
//刷新页面
loadUrl
(
h5Params
.
getUrl
());
loadUrl
(
h5Params
.
getUrl
());
...
...
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