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
a5f63d1f
Commit
a5f63d1f
authored
May 12, 2022
by
范玉宾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
meditation/index inter debug done
parent
390ba8e0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
264 additions
and
68 deletions
+264
-68
MeditationTypeAdapter.kt
m-home/src/main/java/com/yidianling/home/MeditationTypeAdapter.kt
+5
-4
MeditationViewPagerAdapter.kt
m-home/src/main/java/com/yidianling/home/MeditationViewPagerAdapter.kt
+8
-3
IHomeBaseContract.kt
m-home/src/main/java/com/yidianling/home/constants/IHomeBaseContract.kt
+2
-0
HomeBaseHttp.kt
m-home/src/main/java/com/yidianling/home/http/HomeBaseHttp.kt
+2
-0
BaseHomeModelImpl.kt
m-home/src/main/java/com/yidianling/home/model/BaseHomeModelImpl.kt
+3
-0
HomePagerDataBean.kt
m-home/src/main/java/com/yidianling/home/model/bean/HomePagerDataBean.kt
+6
-0
MeditationModuleBean.kt
m-home/src/main/java/com/yidianling/home/model/bean/MeditationModuleBean.kt
+42
-0
YdlHomeAdapter.kt
m-home/src/ydl/java/com/yidianling/home/adapter/YdlHomeAdapter.kt
+1
-1
IHomeContract.kt
m-home/src/ydl/java/com/yidianling/home/constract/IHomeContract.kt
+4
-0
HomeHttp.kt
m-home/src/ydl/java/com/yidianling/home/http/HomeHttp.kt
+7
-0
HomePagerApi.kt
m-home/src/ydl/java/com/yidianling/home/http/HomePagerApi.kt
+7
-0
HomeModelImpl.kt
m-home/src/ydl/java/com/yidianling/home/model/HomeModelImpl.kt
+8
-0
HomePresenterImpl.kt
m-home/src/ydl/java/com/yidianling/home/presenter/HomePresenterImpl.kt
+17
-3
HomeMuseView.kt
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeMuseView.kt
+20
-50
home_muse_view.xml
m-home/src/ydl/res/layout/home_muse_view.xml
+0
-0
layout_meditation_item.xml
m-home/src/ydl/res/layout/layout_meditation_item.xml
+1
-1
build.gradle
m-muse/build.gradle
+3
-0
MeditationWheelViewUtil.java
m-muse/src/main/java/com/yidianling/muse/MeditationWheelViewUtil.java
+57
-0
MeditationTimeOffActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/MeditationTimeOffActivity.kt
+29
-3
PlayMeditationActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
+23
-2
activity_play_meditation.xml
m-muse/src/main/res/layout/activity_play_meditation.xml
+3
-0
activity_play_meditation_time_off.xml
m-muse/src/main/res/layout/activity_play_meditation_time_off.xml
+16
-1
No files found.
m-home/src/main/java/com/yidianling/home/MeditationTypeAdapter.kt
View file @
a5f63d1f
...
...
@@ -11,10 +11,11 @@ import androidx.recyclerview.widget.RecyclerView
import
com.bumptech.glide.Glide
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.home.model.MeditationTypeModel
import
com.yidianling.home.model.bean.MeditationModuleBean
class
MeditationTypeAdapter
(
private
val
context
:
Context
,
private
val
data
:
List
<
Meditation
TypeMode
l
>
private
val
data
:
List
<
Meditation
ModuleBean
.
MeditationDetai
l
>
)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
...
...
@@ -42,12 +43,12 @@ class MeditationTypeAdapter(
is
MeditationTypeViewHolder
->
{
holder
.
ivType
?.
let
{
Glide
.
with
(
context
)
.
load
(
data
[
position
].
i
mageUrl
)
.
load
(
data
[
position
].
coverI
mageUrl
)
.
into
(
it
)
}
holder
.
tvName
?.
let
{
it
.
text
=
data
[
position
].
nam
e
it
.
text
=
data
[
position
].
titl
e
}
}
is
MeditationTypeMoreViewHolder
->
{
...
...
@@ -66,7 +67,7 @@ class MeditationTypeAdapter(
override
fun
getItemId
(
position
:
Int
)
=
position
.
toLong
()
override
fun
getItemViewType
(
position
:
Int
):
Int
{
val
isMore
=
data
[
position
].
isMor
e
val
isMore
=
fals
e
return
if
(
isMore
)
{
FOOTER_TYPE
}
else
{
...
...
m-home/src/main/java/com/yidianling/home/MeditationViewPagerAdapter.kt
View file @
a5f63d1f
...
...
@@ -7,9 +7,10 @@ import android.view.ViewGroup
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
com.yidianling.home.model.MeditationTypeModel
import
com.yidianling.home.model.bean.MeditationModuleBean
class
MeditationViewPagerAdapter
(
private
val
context
:
Context
,
private
val
data
:
List
<
List
<
MeditationTypeModel
>>
)
MeditationModuleBean
)
:
RecyclerView
.
Adapter
<
MeditationViewPagerAdapter
.
MeditationViewPagerViewHolder
>()
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
MeditationViewPagerViewHolder
{
...
...
@@ -20,12 +21,16 @@ class MeditationViewPagerAdapter(private val context: Context, private val data:
override
fun
onBindViewHolder
(
holder
:
MeditationViewPagerViewHolder
,
position
:
Int
)
{
holder
.
rv
?.
also
{
rv
->
rv
.
layoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
HORIZONTAL
,
false
)
rv
.
adapter
=
MeditationTypeAdapter
(
context
,
data
[
position
])
rv
.
adapter
=
data
.
mditationListResponse
?.
get
(
position
)
?.
let
{
MeditationTypeAdapter
(
context
,
it
.
mditationResponseList
)
}
}
}
override
fun
getItemCount
():
Int
{
return
data
.
size
return
data
.
mditationListResponse
?.
size
?:
0
}
inner
class
MeditationViewPagerViewHolder
(
itemView
:
View
):
RecyclerView
.
ViewHolder
(
itemView
){
...
...
m-home/src/main/java/com/yidianling/home/constants/IHomeBaseContract.kt
View file @
a5f63d1f
...
...
@@ -178,5 +178,6 @@ class IHomeBaseContract {
* 首页问答 - 关注
*/
fun
askFocus
(
id
:
String
):
Observable
<
AskResultBean
>
}
}
\ No newline at end of file
m-home/src/main/java/com/yidianling/home/http/HomeBaseHttp.kt
View file @
a5f63d1f
...
...
@@ -101,4 +101,5 @@ class HomeBaseHttp {
val
cmd
=
AskRequestParamBean
.
FocusCmd
(
id
,
"1"
)
return
RxUtils
.
mapObservable
(
cmd
).
flatMap
{
getHomePagerApi
().
askFocus
(
it
)
}
}
}
\ No newline at end of file
m-home/src/main/java/com/yidianling/home/model/BaseHomeModelImpl.kt
View file @
a5f63d1f
...
...
@@ -87,4 +87,6 @@ open class BaseHomeModelImpl : IHomeBaseContract.Model {
return
HomeBaseHttp
.
getInstance
().
newHomeHeaderRequest
().
compose
(
RxUtils
.
resultJavaData
())
.
onErrorReturn
{
HomeHeaderBean
(
true
)
}
}
}
\ No newline at end of file
m-home/src/main/java/com/yidianling/home/model/bean/HomePagerDataBean.kt
View file @
a5f63d1f
...
...
@@ -53,6 +53,12 @@ class HomePagerDataBean() {
* 冥想模块数据
*/
var
museBean
:
MuseModuleBean
?
=
null
/**
* 冥想改版
*/
var
meditationBean
:
MeditationModuleBean
?=
null
/**
* 电台模块数据
*/
...
...
m-home/src/main/java/com/yidianling/home/model/bean/MeditationModuleBean.kt
0 → 100644
View file @
a5f63d1f
package
com.yidianling.home.model.bean
/**
* 冥想模块所有数据
* Created by xj on 2019/9/16.
*/
class
MeditationModuleBean
:
HomeItemBaseBean
{
constructor
():
super
(
false
)
constructor
(
isRealEmpty
:
Boolean
):
super
(
isRealEmpty
)
var
meditationIndexInfo
:
MeditationSlogan
?
=
null
data class
MeditationSlogan
(
val
greetings
:
String
?=
null
,
val
mditationDay
:
Int
=
0
,
val
desc
:
String
?=
null
,
val
videoLink
:
String
?=
null
,
val
uid
:
Int
)
/**
* 冥想数据
*/
var
mditationListResponse
:
ArrayList
<
MeditationList
>?
=
null
data class
MeditationList
(
val
comment
:
String
,
val
meditionType
:
Int
,
val
cateId
:
Long
,
val
mditationResponseList
:
ArrayList
<
MeditationDetail
>
)
data class
MeditationDetail
(
val
meditationId
:
Int
,
val
title
:
String
,
val
coverImageUrl
:
String
,
val
tagId
:
Int
)
}
\ No newline at end of file
m-home/src/ydl/java/com/yidianling/home/adapter/YdlHomeAdapter.kt
View file @
a5f63d1f
...
...
@@ -228,7 +228,7 @@ class YdlHomeAdapter(private val mContext: Context,
}
//壹点*冥想模块
is
HomeMuseViewHolder
->
{
holder
.
museViewView
.
initData
(
list
[
holder
.
viewType
].
m
use
Bean
)
holder
.
museViewView
.
initData
(
list
[
holder
.
viewType
].
m
editation
Bean
)
}
//心灵*电台模块
is
HomeIntelligentViewHolder
->
{
...
...
m-home/src/ydl/java/com/yidianling/home/constract/IHomeContract.kt
View file @
a5f63d1f
package
com.yidianling.home.constract
import
com.yidianling.home.constants.IHomeBaseContract
import
com.yidianling.home.model.bean.MeditationModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
io.reactivex.Observable
...
...
@@ -20,5 +21,7 @@ class IHomeContract {
* 首页冥想请求
*/
fun
museRequest
():
Observable
<
MuseModuleBean
>
fun
getMeditation
():
Observable
<
MeditationModuleBean
>
}
}
\ No newline at end of file
m-home/src/ydl/java/com/yidianling/home/http/HomeHttp.kt
View file @
a5f63d1f
...
...
@@ -2,6 +2,7 @@ package com.yidianling.home.http
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.home.model.bean.MeditationModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
io.reactivex.Observable
...
...
@@ -37,4 +38,9 @@ class HomeHttp {
fun
newMuseRequest
():
Observable
<
BaseAPIResponse
<
MuseModuleBean
>>
{
return
getHomePagerApi
().
getMuseData
()
}
fun
getMeditationInfo
():
Observable
<
BaseAPIResponse
<
MeditationModuleBean
>>{
return
getHomePagerApi
().
getMeditation
()
}
}
\ No newline at end of file
m-home/src/ydl/java/com/yidianling/home/http/HomePagerApi.kt
View file @
a5f63d1f
...
...
@@ -3,6 +3,7 @@ package com.yidianling.home.http
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.yidianling.home.model.bean.MeditationModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
io.reactivex.Observable
import
retrofit2.http.GET
...
...
@@ -21,4 +22,9 @@ interface HomePagerApi {
@GET
(
"meditation/meditation/list"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
fun
getMuseData
():
Observable
<
BaseAPIResponse
<
MuseModuleBean
>>
@GET
(
"cms/meditation/index"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
fun
getMeditation
():
Observable
<
BaseAPIResponse
<
MeditationModuleBean
>>
}
\ No newline at end of file
m-home/src/ydl/java/com/yidianling/home/model/HomeModelImpl.kt
View file @
a5f63d1f
...
...
@@ -3,6 +3,7 @@ package com.yidianling.home.model
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.yidianling.home.constract.IHomeContract
import
com.yidianling.home.http.HomeHttp
import
com.yidianling.home.model.bean.MeditationModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
...
...
@@ -26,5 +27,11 @@ class HomeModelImpl : BaseHomeModelImpl(), IHomeContract.Model {
.
onErrorReturn
{
MuseModuleBean
(
true
)
}
}
override
fun
getMeditation
():
Observable
<
MeditationModuleBean
>
{
return
HomeHttp
.
getInstance
().
getMeditationInfo
().
compose
(
RxUtils
.
resultJavaData
())
.
subscribeOn
(
Schedulers
.
io
()).
observeOn
(
AndroidSchedulers
.
mainThread
())
.
onErrorReturn
{
MeditationModuleBean
(
true
)
}
}
}
\ No newline at end of file
m-home/src/ydl/java/com/yidianling/home/presenter/HomePresenterImpl.kt
View file @
a5f63d1f
...
...
@@ -112,6 +112,12 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
homeList
.
add
(
getHomeItemFromTempData
(
it
,
HomeViewConfig
.
getOrder
().
museIndex
!!
))
}
val
meditationObservable
=
mModel
.
getMeditation
()
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
homeList
.
add
(
getHomeItemFromTempData
(
it
,
HomeViewConfig
.
getOrder
().
museIndex
!!
))
}
val
fmObservable
=
mModel
.
fmRequest
()
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
//首页电台数据
...
...
@@ -134,6 +140,7 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
if
(
HomeViewConfig
.
getOrder
().
bannerIndex
!=
null
){
mergeArrays
.
add
(
headerObservable
)
}
if
(
HomeViewConfig
.
getOrder
().
consultIndex
!=
null
){
mergeArrays
.
add
(
consultObservable
)
}
...
...
@@ -150,8 +157,11 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
mergeArrays
.
add
(
askObservable
)
}
if
(
HomeViewConfig
.
getOrder
().
museIndex
!=
null
){
mergeArrays
.
add
(
m
use
Observable
)
mergeArrays
.
add
(
m
editation
Observable
)
}
// if (HomeViewConfig.getOrder().museIndex!=null){
// mergeArrays.add(museObservable)
// }
if
(
HomeViewConfig
.
getOrder
().
fmIndex
!=
null
){
mergeArrays
.
add
(
fmObservable
)
}
...
...
@@ -297,9 +307,13 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
HomeAskBean
)
homeTempData
.
askBean
else
dataBean
mHomeAskBean
=
item
.
askBean
}
// HomeViewConfig.getOrder().museIndex -> {
// item.museBean =
// if (dataBean.isRealEmpty || dataBean !is MuseModuleBean) homeTempData.museBean else dataBean
// }
HomeViewConfig
.
getOrder
().
museIndex
->
{
item
.
m
use
Bean
=
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
M
useModuleBean
)
homeTempData
.
muse
Bean
else
dataBean
item
.
m
editation
Bean
=
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
M
editationModuleBean
)
homeTempData
.
meditation
Bean
else
dataBean
}
HomeViewConfig
.
getOrder
().
fmIndex
->
{
item
.
fmBean
=
...
...
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeMuseView.kt
View file @
a5f63d1f
...
...
@@ -20,6 +20,7 @@ import com.yidianling.home.R
import
com.yidianling.home.constract.HomeViewConfig
import
com.yidianling.home.event.IHomeEvent
import
com.yidianling.home.model.MeditationTypeModel
import
com.yidianling.home.model.bean.MeditationModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
kotlinx.android.synthetic.ydl.home_muse_view.view.*
...
...
@@ -35,7 +36,7 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
private
var
cacheList
:
ArrayList
<
HomeMuseView
>
=
ArrayList
()
private
val
meditationTitles
=
arrayOf
(
"睡眠"
,
"冥想"
,
"治愈"
)
private
val
meditationTitles
=
mutableListOf
<
String
>(
)
init
{
initView
()
...
...
@@ -53,7 +54,7 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
homeModuleMuseViewHomeCommonTitleView
.
setTitle
(
HomeViewConfig
.
getOrder
().
museTitle
)
}
fun
initData
(
bean
:
M
use
ModuleBean
?)
{
fun
initData
(
bean
:
M
editation
ModuleBean
?)
{
if
(
null
!=
bean
)
{
...
...
@@ -62,56 +63,23 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
homeEvent
?.
museMoreClick
(
Gson
().
toJson
(
bean
))
}
if
(
null
!=
bean
.
muses
)
{
if
(
bean
.
muses
?.
size
!!
>
0
)
{
muse_first
.
setOnClickListener
{
homeEvent
?.
museClick
(
bean
.
muses
!!
[
0
].
audioUrl
,
dataJson
,
muse_first_text
.
text
.
toString
())
}
}
if
(
bean
.
muses
?.
size
!!
>
1
)
{
muse_second
.
setOnClickListener
{
homeEvent
?.
museClick
(
bean
.
muses
!!
[
1
].
audioUrl
,
dataJson
,
muse_second_text
.
text
.
toString
())
}
val
greeting
=
bean
?.
meditationIndexInfo
?.
greetings
?:
"你好"
tv_time
.
text
=
greeting
val
slogan
=
if
(
bean
?.
meditationIndexInfo
?.
mditationDay
==
null
){
"无常的日子里,呼吸间拾起力量"
}
else
{
"已连续冥想${bean?.meditationIndexInfo?.mditationDay}天"
}
if
(
bean
.
muses
?.
size
!!
>
2
)
{
muse_third
.
setOnClickListener
{
homeEvent
?.
museClick
(
bean
.
muses
!!
[
2
].
audioUrl
,
dataJson
,
muse_third_text
.
text
.
toString
())
}
}
if
(
bean
.
muses
?.
size
!!
>
3
)
{
muse_forth
.
setOnClickListener
{
homeEvent
?.
museClick
(
bean
.
muses
!!
[
3
].
audioUrl
,
dataJson
,
muse_forth_text
.
text
.
toString
())
}
}
}
if
(
null
!=
bean
.
sleeps
)
{
if
(
bean
.
sleeps
?.
size
!!
>
0
)
{
sleeps_first
.
setOnClickListener
{
homeEvent
?.
museClick
(
bean
.
sleeps
!!
[
0
].
audioUrl
,
dataJson
,
sleeps_first_text
.
text
.
toString
())
}
}
if
(
bean
.
sleeps
?.
size
!!
>
1
)
{
sleeps_second
.
setOnClickListener
{
homeEvent
?.
museClick
(
bean
.
sleeps
!!
[
1
].
audioUrl
,
dataJson
,
sleeps_second_text
.
toString
())
}
}
if
(
bean
.
sleeps
?.
size
!!
>
2
)
{
sleeps_third
.
setOnClickListener
{
homeEvent
?.
museClick
(
bean
.
sleeps
!!
[
2
].
audioUrl
,
dataJson
,
sleeps_third_text
.
text
.
toString
())
}
}
if
(
bean
.
sleeps
?.
size
!!
>
3
)
{
sleeps_forth
.
setOnClickListener
{
homeEvent
?.
museClick
(
bean
.
sleeps
!!
[
3
].
audioUrl
,
dataJson
,
sleeps_forth_text
.
text
.
toString
())
}
}
}
tv_meditation_slogan
.
text
=
slogan
val
videoUrl
=
bean
?.
meditationIndexInfo
?.
videoLink
?:
"http://www.w3school.com.cn/example/html5/mov_bbb.mp4"
GlideApp
.
with
(
this
)
.
load
(
"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
)
.
load
(
videoUrl
)
.
into
(
iv_video_background
)
video_view
?.
setVideoPath
(
"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
)
video_view
?.
setVideoPath
(
videoUrl
)
video_view
?.
setOnPreparedListener
{
it
?.
setVideoScalingMode
(
MediaPlayer
.
VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
)
...
...
@@ -126,7 +94,6 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
}
video_view
?.
setOnCompletionListener
{
video_view
?.
start
()
}
val
data
=
mutableListOf
<
List
<
MeditationTypeModel
>>()
val
innerData
=
mutableListOf
<
MeditationTypeModel
>()
...
...
@@ -152,9 +119,12 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
data
.
add
(
innerData
)
}
bean
?.
mditationListResponse
?.
forEach
{
meditationTitles
.
add
(
it
.
comment
)
}
view_pager
.
adapter
=
MeditationViewPagerAdapter
(
mContext
,
data
)
view_pager
.
adapter
=
MeditationViewPagerAdapter
(
mContext
,
bean
)
tab_layout
.
addOnTabSelectedListener
(
object
:
TabLayout
.
OnTabSelectedListener
{
override
fun
onTabSelected
(
tab
:
TabLayout
.
Tab
?)
{
...
...
m-home/src/ydl/res/layout/home_muse_view.xml
View file @
a5f63d1f
This diff is collapsed.
Click to expand it.
m-home/src/ydl/res/layout/layout_meditation_item.xml
View file @
a5f63d1f
...
...
@@ -34,7 +34,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|start"
android
:text=
"溪流"
tools
:text=
"溪流"
android:textColor=
"@color/white"
android:textSize=
"14sp"
android:layout_marginStart=
"6dp"
...
...
m-muse/build.gradle
View file @
a5f63d1f
...
...
@@ -58,6 +58,9 @@ dependencies {
androidTestImplementation
'androidx.test.ext:junit:1.1.2'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.3.0'
implementation
'com.wx.wheelview:wheelview:1.3.3'
// solve build problem
// cannot access 'androidx.lifecycle.hasdefaultviewmodelproviderfactory'
// Comment out when compiling
...
...
m-muse/src/main/java/com/yidianling/muse/MeditationWheelViewUtil.java
0 → 100644
View file @
a5f63d1f
package
com
.
yidianling
.
muse
;
import
android.content.Context
;
import
android.graphics.Color
;
import
com.wx.wheelview.adapter.ArrayWheelAdapter
;
import
com.wx.wheelview.widget.WheelView
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
MeditationWheelViewUtil
{
private
List
<
String
>
hours
=
new
ArrayList
<>();
private
List
<
String
>
minutes
=
new
ArrayList
<>();
public
void
initWheelView
(
Context
context
,
WheelView
wheelViewH
,
WheelView
wheelViewM
){
createHours
();
createMinutes
();
wheelViewH
.
setWheelAdapter
(
new
ArrayWheelAdapter
(
context
));
wheelViewH
.
setWheelData
(
hours
);
WheelView
.
WheelViewStyle
style
=
new
WheelView
.
WheelViewStyle
();
style
.
textColor
=
Color
.
parseColor
(
"#80FFFFFF"
);
style
.
selectedTextColor
=
Color
.
parseColor
(
"#FFFFFF"
);
style
.
textSize
=
30
;
style
.
backgroundColor
=
Color
.
parseColor
(
"#00000000"
);
style
.
selectedTextSize
=
32
;
style
.
selectedTextZoom
=
1.2f
;
wheelViewH
.
setStyle
(
style
);
wheelViewH
.
setExtraText
(
"小时"
,
Color
.
parseColor
(
"#FFFFFFFF"
),
50
,
120
);
wheelViewM
.
setWheelAdapter
(
new
ArrayWheelAdapter
(
context
));
wheelViewM
.
setWheelData
(
minutes
);
wheelViewM
.
setStyle
(
style
);
wheelViewM
.
setExtraText
(
"分钟"
,
Color
.
parseColor
(
"#FFFFFFFF"
),
50
,
120
);
}
private
void
createHours
(){
for
(
int
i
=
0
;
i
<
24
;
i
++)
{
hours
.
add
(
""
+
i
);
}
}
private
void
createMinutes
()
{
for
(
int
i
=
0
;
i
<
60
;
i
+=
5
)
{
if
(
i
<
10
)
{
minutes
.
add
(
"0"
+
i
);
}
else
{
minutes
.
add
(
""
+
i
);
}
}
}
}
m-muse/src/main/java/com/yidianling/muse/activity/MeditationTimeOffActivity.kt
View file @
a5f63d1f
package
com.yidianling.muse.activity
import
android.content.Intent
import
android.os.Bundle
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.bean.StatusBarOptions
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.StatusBarUtils
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.yidianling.muse.MeditationWheelViewUtil
import
com.yidianling.muse.R
import
kotlinx.android.synthetic.main.activity_play_meditation_time_off.*
...
...
@@ -21,15 +24,38 @@ class MeditationTimeOffActivity:BaseActivity() {
private
fun
initView
()
{
iv_close
?.
setOnClickListener
{
finish
()
}
tv_save_setting
?.
setOnClickListener
{
ToastHelper
.
show
(
"保存设置"
)
val
hour
=
if
(
wheel_view_hour
.
selectionItem
.
equals
(
"0"
)){
""
}
else
{
wheel_view_hour
.
selectionItem
}
val
minute
=
if
(
wheel_view_minute
.
selectionItem
.
equals
(
"00"
)){
""
}
else
{
wheel_view_minute
.
selectionItem
}
LogUtil
.
d
(
"time off"
,
"hour=$hour === minute=$minute"
)
val
intent
=
Intent
()
intent
.
putExtra
(
"TIME_OFF_HOUR"
,
hour
.
toString
())
intent
.
putExtra
(
"TIME_OFF_MINUTE"
,
minute
.
toString
())
setResult
(
RESULT_OK
,
intent
)
finish
()
}
tv_cancel_time_off
?.
setOnClickListener
{
ToastHelper
.
show
(
"关闭定时"
)
val
intent
=
Intent
()
intent
.
putExtra
(
"TIME_OFF_HOUR"
,
""
)
intent
.
putExtra
(
"TIME_OFF_MINUTE"
,
""
)
setResult
(
RESULT_OK
,
intent
)
finish
()
}
...
...
@@ -39,7 +65,7 @@ class MeditationTimeOffActivity:BaseActivity() {
private
fun
initWheel
()
{
MeditationWheelViewUtil
().
initWheelView
(
this
,
wheel_view_hour
,
wheel_view_minute
)
}
...
...
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
View file @
a5f63d1f
...
...
@@ -21,6 +21,8 @@ import kotlinx.android.synthetic.main.player_control_view.*
import
java.util.*
@Route
(
path
=
"/muse/play"
)
class
PlayMeditationActivity
:
BaseActivity
()
{
...
...
@@ -50,7 +52,6 @@ class PlayMeditationActivity : BaseActivity() {
setTransparentForImageView
(
this
,
null
)
statusBarLightMode
(
this
)
super
.
onCreate
(
savedInstanceState
)
initView
()
}
...
...
@@ -118,7 +119,7 @@ class PlayMeditationActivity : BaseActivity() {
}
iv_time_off
.
setOnClickListener
{
startActivity
(
Intent
(
this
,
MeditationTimeOffActivity
::
class
.
java
)
)
startActivity
ForResult
(
Intent
(
this
,
MeditationTimeOffActivity
::
class
.
java
),
request_code
)
}
initMediaPlayer
()
...
...
@@ -269,6 +270,19 @@ class PlayMeditationActivity : BaseActivity() {
}
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
resultCode
==
RESULT_OK
&&
request_code
==
requestCode
){
val
hour
=
data
?.
extras
?.
getString
(
"TIME_OFF_HOUR"
,
""
)
val
minute
=
data
?.
extras
?.
getString
(
"TIME_OFF_MINUTE"
,
""
)
if
(!
hour
.
isNullOrEmpty
()
or
(!
minute
.
isNullOrEmpty
())){
tv_time_off
.
text
=
"$hour:$minute"
}
else
{
tv_time_off
.
text
=
""
}
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
mTimer
.
cancel
()
...
...
@@ -276,4 +290,10 @@ class PlayMeditationActivity : BaseActivity() {
MediaPlayerManager
.
getInstance
(
this
).
release
()
}
companion
object
{
const
val
request_code
=
0
x0001
}
}
\ No newline at end of file
m-muse/src/main/res/layout/activity_play_meditation.xml
View file @
a5f63d1f
...
...
@@ -139,10 +139,13 @@
app:layout_constraintStart_toEndOf=
"@id/guide_line"
/>
<TextView
android:id=
"@+id/tv_time_off"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
tools:text=
"56:32"
android:textSize=
"12sp"
android:textColor=
"@color/white"
app:layout_constraintTop_toBottomOf=
"@id/iv_time_off"
app:layout_constraintStart_toStartOf=
"@id/iv_time_off"
app:layout_constraintEnd_toEndOf=
"@id/iv_time_off"
/>
...
...
m-muse/src/main/res/layout/activity_play_meditation_time_off.xml
View file @
a5f63d1f
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
...
...
@@ -33,12 +34,26 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:layout_marginHorizontal=
"72dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<com.wx.wheelview.widget.WheelView
android:id=
"@+id/wheel_view_hour"
android:layout_width=
"match_parent"
android:layout_weight=
"1"
android:layout_margin=
"1dp"
android:layout_height=
"wrap_content"
/>
<com.wx.wheelview.widget.WheelView
android:id=
"@+id/wheel_view_minute"
android:layout_width=
"match_parent"
android:layout_weight=
"1"
android:layout_margin=
"1dp"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
...
...
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