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
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
266 additions
and
395 deletions
+266
-395
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
+2
-327
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
...
@@ -11,10 +11,11 @@ import androidx.recyclerview.widget.RecyclerView
import
com.bumptech.glide.Glide
import
com.bumptech.glide.Glide
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.home.model.MeditationTypeModel
import
com.yidianling.home.model.MeditationTypeModel
import
com.yidianling.home.model.bean.MeditationModuleBean
class
MeditationTypeAdapter
(
class
MeditationTypeAdapter
(
private
val
context
:
Context
,
private
val
context
:
Context
,
private
val
data
:
List
<
Meditation
TypeMode
l
>
private
val
data
:
List
<
Meditation
ModuleBean
.
MeditationDetai
l
>
)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
...
@@ -42,12 +43,12 @@ class MeditationTypeAdapter(
...
@@ -42,12 +43,12 @@ class MeditationTypeAdapter(
is
MeditationTypeViewHolder
->
{
is
MeditationTypeViewHolder
->
{
holder
.
ivType
?.
let
{
holder
.
ivType
?.
let
{
Glide
.
with
(
context
)
Glide
.
with
(
context
)
.
load
(
data
[
position
].
i
mageUrl
)
.
load
(
data
[
position
].
coverI
mageUrl
)
.
into
(
it
)
.
into
(
it
)
}
}
holder
.
tvName
?.
let
{
holder
.
tvName
?.
let
{
it
.
text
=
data
[
position
].
nam
e
it
.
text
=
data
[
position
].
titl
e
}
}
}
}
is
MeditationTypeMoreViewHolder
->
{
is
MeditationTypeMoreViewHolder
->
{
...
@@ -66,7 +67,7 @@ class MeditationTypeAdapter(
...
@@ -66,7 +67,7 @@ class MeditationTypeAdapter(
override
fun
getItemId
(
position
:
Int
)
=
position
.
toLong
()
override
fun
getItemId
(
position
:
Int
)
=
position
.
toLong
()
override
fun
getItemViewType
(
position
:
Int
):
Int
{
override
fun
getItemViewType
(
position
:
Int
):
Int
{
val
isMore
=
data
[
position
].
isMor
e
val
isMore
=
fals
e
return
if
(
isMore
)
{
return
if
(
isMore
)
{
FOOTER_TYPE
FOOTER_TYPE
}
else
{
}
else
{
...
...
m-home/src/main/java/com/yidianling/home/MeditationViewPagerAdapter.kt
View file @
a5f63d1f
...
@@ -7,9 +7,10 @@ import android.view.ViewGroup
...
@@ -7,9 +7,10 @@ import android.view.ViewGroup
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView
import
com.yidianling.home.model.MeditationTypeModel
import
com.yidianling.home.model.MeditationTypeModel
import
com.yidianling.home.model.bean.MeditationModuleBean
class
MeditationViewPagerAdapter
(
private
val
context
:
Context
,
private
val
data
:
class
MeditationViewPagerAdapter
(
private
val
context
:
Context
,
private
val
data
:
List
<
List
<
MeditationTypeModel
>>
)
MeditationModuleBean
)
:
RecyclerView
.
Adapter
<
MeditationViewPagerAdapter
.
MeditationViewPagerViewHolder
>()
{
:
RecyclerView
.
Adapter
<
MeditationViewPagerAdapter
.
MeditationViewPagerViewHolder
>()
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
MeditationViewPagerViewHolder
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
MeditationViewPagerViewHolder
{
...
@@ -20,12 +21,16 @@ class MeditationViewPagerAdapter(private val context: Context, private val data:
...
@@ -20,12 +21,16 @@ class MeditationViewPagerAdapter(private val context: Context, private val data:
override
fun
onBindViewHolder
(
holder
:
MeditationViewPagerViewHolder
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
MeditationViewPagerViewHolder
,
position
:
Int
)
{
holder
.
rv
?.
also
{
rv
->
holder
.
rv
?.
also
{
rv
->
rv
.
layoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
HORIZONTAL
,
false
)
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
{
override
fun
getItemCount
():
Int
{
return
data
.
size
return
data
.
mditationListResponse
?.
size
?:
0
}
}
inner
class
MeditationViewPagerViewHolder
(
itemView
:
View
):
RecyclerView
.
ViewHolder
(
itemView
){
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 {
...
@@ -178,5 +178,6 @@ class IHomeBaseContract {
* 首页问答 - 关注
* 首页问答 - 关注
*/
*/
fun
askFocus
(
id
:
String
):
Observable
<
AskResultBean
>
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 {
...
@@ -101,4 +101,5 @@ class HomeBaseHttp {
val
cmd
=
AskRequestParamBean
.
FocusCmd
(
id
,
"1"
)
val
cmd
=
AskRequestParamBean
.
FocusCmd
(
id
,
"1"
)
return
RxUtils
.
mapObservable
(
cmd
).
flatMap
{
getHomePagerApi
().
askFocus
(
it
)
}
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 {
...
@@ -87,4 +87,6 @@ open class BaseHomeModelImpl : IHomeBaseContract.Model {
return
HomeBaseHttp
.
getInstance
().
newHomeHeaderRequest
().
compose
(
RxUtils
.
resultJavaData
())
return
HomeBaseHttp
.
getInstance
().
newHomeHeaderRequest
().
compose
(
RxUtils
.
resultJavaData
())
.
onErrorReturn
{
HomeHeaderBean
(
true
)
}
.
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() {
...
@@ -53,6 +53,12 @@ class HomePagerDataBean() {
* 冥想模块数据
* 冥想模块数据
*/
*/
var
museBean
:
MuseModuleBean
?
=
null
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,
...
@@ -228,7 +228,7 @@ class YdlHomeAdapter(private val mContext: Context,
}
}
//壹点*冥想模块
//壹点*冥想模块
is
HomeMuseViewHolder
->
{
is
HomeMuseViewHolder
->
{
holder
.
museViewView
.
initData
(
list
[
holder
.
viewType
].
m
use
Bean
)
holder
.
museViewView
.
initData
(
list
[
holder
.
viewType
].
m
editation
Bean
)
}
}
//心灵*电台模块
//心灵*电台模块
is
HomeIntelligentViewHolder
->
{
is
HomeIntelligentViewHolder
->
{
...
...
m-home/src/ydl/java/com/yidianling/home/constract/IHomeContract.kt
View file @
a5f63d1f
package
com.yidianling.home.constract
package
com.yidianling.home.constract
import
com.yidianling.home.constants.IHomeBaseContract
import
com.yidianling.home.constants.IHomeBaseContract
import
com.yidianling.home.model.bean.MeditationModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
io.reactivex.Observable
import
io.reactivex.Observable
...
@@ -20,5 +21,7 @@ class IHomeContract {
...
@@ -20,5 +21,7 @@ class IHomeContract {
* 首页冥想请求
* 首页冥想请求
*/
*/
fun
museRequest
():
Observable
<
MuseModuleBean
>
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
...
@@ -2,6 +2,7 @@ package com.yidianling.home.http
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlnet.YDLHttpUtils
import
com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.home.model.bean.MeditationModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
io.reactivex.Observable
import
io.reactivex.Observable
...
@@ -37,4 +38,9 @@ class HomeHttp {
...
@@ -37,4 +38,9 @@ class HomeHttp {
fun
newMuseRequest
():
Observable
<
BaseAPIResponse
<
MuseModuleBean
>>
{
fun
newMuseRequest
():
Observable
<
BaseAPIResponse
<
MuseModuleBean
>>
{
return
getHomePagerApi
().
getMuseData
()
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
...
@@ -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
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.yidianling.home.model.bean.MeditationModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
io.reactivex.Observable
import
io.reactivex.Observable
import
retrofit2.http.GET
import
retrofit2.http.GET
...
@@ -21,4 +22,9 @@ interface HomePagerApi {
...
@@ -21,4 +22,9 @@ interface HomePagerApi {
@GET
(
"meditation/meditation/list"
)
@GET
(
"meditation/meditation/list"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
fun
getMuseData
():
Observable
<
BaseAPIResponse
<
MuseModuleBean
>>
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
...
@@ -3,6 +3,7 @@ package com.yidianling.home.model
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.yidianling.home.constract.IHomeContract
import
com.yidianling.home.constract.IHomeContract
import
com.yidianling.home.http.HomeHttp
import
com.yidianling.home.http.HomeHttp
import
com.yidianling.home.model.bean.MeditationModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
io.reactivex.Observable
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
...
@@ -26,5 +27,11 @@ class HomeModelImpl : BaseHomeModelImpl(), IHomeContract.Model {
...
@@ -26,5 +27,11 @@ class HomeModelImpl : BaseHomeModelImpl(), IHomeContract.Model {
.
onErrorReturn
{
MuseModuleBean
(
true
)
}
.
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
...
@@ -112,6 +112,12 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
homeList
.
add
(
getHomeItemFromTempData
(
it
,
HomeViewConfig
.
getOrder
().
museIndex
!!
))
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
()
val
fmObservable
=
mModel
.
fmRequest
()
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
//首页电台数据
//首页电台数据
...
@@ -134,6 +140,7 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
...
@@ -134,6 +140,7 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
if
(
HomeViewConfig
.
getOrder
().
bannerIndex
!=
null
){
if
(
HomeViewConfig
.
getOrder
().
bannerIndex
!=
null
){
mergeArrays
.
add
(
headerObservable
)
mergeArrays
.
add
(
headerObservable
)
}
}
if
(
HomeViewConfig
.
getOrder
().
consultIndex
!=
null
){
if
(
HomeViewConfig
.
getOrder
().
consultIndex
!=
null
){
mergeArrays
.
add
(
consultObservable
)
mergeArrays
.
add
(
consultObservable
)
}
}
...
@@ -150,8 +157,11 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
...
@@ -150,8 +157,11 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
mergeArrays
.
add
(
askObservable
)
mergeArrays
.
add
(
askObservable
)
}
}
if
(
HomeViewConfig
.
getOrder
().
museIndex
!=
null
){
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
){
if
(
HomeViewConfig
.
getOrder
().
fmIndex
!=
null
){
mergeArrays
.
add
(
fmObservable
)
mergeArrays
.
add
(
fmObservable
)
}
}
...
@@ -297,9 +307,13 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
...
@@ -297,9 +307,13 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
HomeAskBean
)
homeTempData
.
askBean
else
dataBean
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
HomeAskBean
)
homeTempData
.
askBean
else
dataBean
mHomeAskBean
=
item
.
askBean
mHomeAskBean
=
item
.
askBean
}
}
// HomeViewConfig.getOrder().museIndex -> {
// item.museBean =
// if (dataBean.isRealEmpty || dataBean !is MuseModuleBean) homeTempData.museBean else dataBean
// }
HomeViewConfig
.
getOrder
().
museIndex
->
{
HomeViewConfig
.
getOrder
().
museIndex
->
{
item
.
m
use
Bean
=
item
.
m
editation
Bean
=
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
M
useModuleBean
)
homeTempData
.
muse
Bean
else
dataBean
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
M
editationModuleBean
)
homeTempData
.
meditation
Bean
else
dataBean
}
}
HomeViewConfig
.
getOrder
().
fmIndex
->
{
HomeViewConfig
.
getOrder
().
fmIndex
->
{
item
.
fmBean
=
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
...
@@ -20,6 +20,7 @@ import com.yidianling.home.R
import
com.yidianling.home.constract.HomeViewConfig
import
com.yidianling.home.constract.HomeViewConfig
import
com.yidianling.home.event.IHomeEvent
import
com.yidianling.home.event.IHomeEvent
import
com.yidianling.home.model.MeditationTypeModel
import
com.yidianling.home.model.MeditationTypeModel
import
com.yidianling.home.model.bean.MeditationModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
com.yidianling.home.model.bean.MuseModuleBean
import
kotlinx.android.synthetic.ydl.home_muse_view.view.*
import
kotlinx.android.synthetic.ydl.home_muse_view.view.*
...
@@ -35,7 +36,7 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
...
@@ -35,7 +36,7 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
private
var
cacheList
:
ArrayList
<
HomeMuseView
>
=
ArrayList
()
private
var
cacheList
:
ArrayList
<
HomeMuseView
>
=
ArrayList
()
private
val
meditationTitles
=
arrayOf
(
"睡眠"
,
"冥想"
,
"治愈"
)
private
val
meditationTitles
=
mutableListOf
<
String
>(
)
init
{
init
{
initView
()
initView
()
...
@@ -53,7 +54,7 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
...
@@ -53,7 +54,7 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
homeModuleMuseViewHomeCommonTitleView
.
setTitle
(
HomeViewConfig
.
getOrder
().
museTitle
)
homeModuleMuseViewHomeCommonTitleView
.
setTitle
(
HomeViewConfig
.
getOrder
().
museTitle
)
}
}
fun
initData
(
bean
:
M
use
ModuleBean
?)
{
fun
initData
(
bean
:
M
editation
ModuleBean
?)
{
if
(
null
!=
bean
)
{
if
(
null
!=
bean
)
{
...
@@ -62,56 +63,23 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
...
@@ -62,56 +63,23 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
homeEvent
?.
museMoreClick
(
Gson
().
toJson
(
bean
))
homeEvent
?.
museMoreClick
(
Gson
().
toJson
(
bean
))
}
}
if
(
null
!=
bean
.
muses
)
{
val
greeting
=
bean
?.
meditationIndexInfo
?.
greetings
?:
"你好"
if
(
bean
.
muses
?.
size
!!
>
0
)
{
tv_time
.
text
=
greeting
muse_first
.
setOnClickListener
{
val
slogan
=
homeEvent
?.
museClick
(
bean
.
muses
!!
[
0
].
audioUrl
,
dataJson
,
muse_first_text
.
text
.
toString
())
if
(
bean
?.
meditationIndexInfo
?.
mditationDay
==
null
){
}
"无常的日子里,呼吸间拾起力量"
}
}
else
{
if
(
bean
.
muses
?.
size
!!
>
1
)
{
"已连续冥想${bean?.meditationIndexInfo?.mditationDay}天"
muse_second
.
setOnClickListener
{
homeEvent
?.
museClick
(
bean
.
muses
!!
[
1
].
audioUrl
,
dataJson
,
muse_second_text
.
text
.
toString
())
}
}
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
)
GlideApp
.
with
(
this
)
.
load
(
"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
)
.
load
(
videoUrl
)
.
into
(
iv_video_background
)
.
into
(
iv_video_background
)
video_view
?.
setVideoPath
(
"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
)
video_view
?.
setVideoPath
(
videoUrl
)
video_view
?.
setOnPreparedListener
{
video_view
?.
setOnPreparedListener
{
it
?.
setVideoScalingMode
(
MediaPlayer
.
VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
)
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
...
@@ -126,7 +94,6 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
}
}
video_view
?.
setOnCompletionListener
{
video_view
?.
start
()
}
video_view
?.
setOnCompletionListener
{
video_view
?.
start
()
}
val
data
=
mutableListOf
<
List
<
MeditationTypeModel
>>()
val
data
=
mutableListOf
<
List
<
MeditationTypeModel
>>()
val
innerData
=
mutableListOf
<
MeditationTypeModel
>()
val
innerData
=
mutableListOf
<
MeditationTypeModel
>()
...
@@ -152,9 +119,12 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
...
@@ -152,9 +119,12 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
data
.
add
(
innerData
)
data
.
add
(
innerData
)
}
}
bean
?.
mditationListResponse
?.
forEach
{
meditationTitles
.
add
(
it
.
comment
)
}
view_pager
.
adapter
=
MeditationViewPagerAdapter
(
view_pager
.
adapter
=
MeditationViewPagerAdapter
(
mContext
,
bean
)
mContext
,
data
)
tab_layout
.
addOnTabSelectedListener
(
object
:
TabLayout
.
OnTabSelectedListener
{
tab_layout
.
addOnTabSelectedListener
(
object
:
TabLayout
.
OnTabSelectedListener
{
override
fun
onTabSelected
(
tab
:
TabLayout
.
Tab
?)
{
override
fun
onTabSelected
(
tab
:
TabLayout
.
Tab
?)
{
...
...
m-home/src/ydl/res/layout/home_muse_view.xml
View file @
a5f63d1f
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
android:layout_marginStart=
"16dp"
android:layout_marginStart=
"16dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android
:text=
"下午好"
tools
:text=
"下午好"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textStyle=
"bold"
android:textStyle=
"bold"
android:textSize=
"24sp"
/>
android:textSize=
"24sp"
/>
...
@@ -66,7 +66,6 @@
...
@@ -66,7 +66,6 @@
app:layout_constraintStart_toStartOf=
"@id/tv_time"
app:layout_constraintStart_toStartOf=
"@id/tv_time"
app:layout_constraintTop_toBottomOf=
"@id/tv_time"
/>
app:layout_constraintTop_toBottomOf=
"@id/tv_time"
/>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"150dp"
android:layout_height=
"150dp"
...
@@ -76,7 +75,7 @@
...
@@ -76,7 +75,7 @@
<com.google.android.material.tabs.TabLayout
<com.google.android.material.tabs.TabLayout
android:id=
"@+id/tab_layout"
android:id=
"@+id/tab_layout"
android:layout_width=
"
16
0dp"
android:layout_width=
"
20
0dp"
android:layout_height=
"40dp"
android:layout_height=
"40dp"
android:layout_marginBottom=
"14dp"
android:layout_marginBottom=
"14dp"
style=
"@style/MeditationTabLayoutStyle"
/>
style=
"@style/MeditationTabLayoutStyle"
/>
...
@@ -90,331 +89,8 @@
...
@@ -90,331 +89,8 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</FrameLayout>
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"88dp"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<androidx.cardview.widget.CardView
android:id=
"@+id/muse_first"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginLeft=
"@dimen/platform_dp_15"
android:layout_marginRight=
"5dp"
android:layout_weight=
"1"
app:cardElevation=
"0dp"
app:cardCornerRadius=
"@dimen/platform_dp_4"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"centerCrop"
android:src=
"@drawable/home_muse_first_img"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"15dp"
android:layout_marginTop=
"13dp"
android:gravity=
"center_vertical"
android:layout_marginRight=
"@dimen/platform_dp_15"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/muse_first_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"深度睡眠"
android:maxLines=
"1"
android:ellipsize=
"end"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_16"
/>
<ImageView
android:layout_width=
"18dp"
android:layout_height=
"@dimen/platform_dp_18"
android:layout_marginLeft=
"@dimen/platform_dp_4"
android:src=
"@drawable/home_muse_play"
/>
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id=
"@+id/muse_second"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginLeft=
"5dp"
android:layout_marginRight=
"@dimen/platform_dp_15"
android:layout_weight=
"1"
app:cardElevation=
"0dp"
app:cardCornerRadius=
"@dimen/platform_dp_4"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<com.airbnb.lottie.LottieAnimationView
android:id=
"@+id/muse_animation_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:lottie_autoPlay=
"true"
app:lottie_loop=
"true"
app:lottie_imageAssetsFolder=
"images"
app:lottie_fileName=
"pinna.json"
android:scaleType=
"centerCrop"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"@dimen/platform_dp_15"
android:layout_marginTop=
"13dp"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/muse_second_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"节奏调整"
android:maxLines=
"1"
android:ellipsize=
"end"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_16"
/>
<ImageView
android:layout_width=
"18dp"
android:layout_height=
"@dimen/platform_dp_18"
android:layout_marginLeft=
"@dimen/platform_dp_4"
android:src=
"@drawable/home_muse_play"
/>
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"88dp"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<androidx.cardview.widget.CardView
android:id=
"@+id/muse_third"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginLeft=
"@dimen/platform_dp_15"
android:layout_marginRight=
"5dp"
android:layout_weight=
"1"
app:cardElevation=
"0dp"
app:cardCornerRadius=
"@dimen/platform_dp_4"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"centerCrop"
android:src=
"@drawable/home_muse_third_img"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"@dimen/platform_dp_15"
android:layout_marginTop=
"13dp"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/muse_third_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"身体扫描"
android:maxLines=
"1"
android:ellipsize=
"end"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_16"
/>
<ImageView
android:layout_width=
"18dp"
android:layout_height=
"@dimen/platform_dp_18"
android:layout_marginLeft=
"@dimen/platform_dp_4"
android:src=
"@drawable/home_muse_play"
/>
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id=
"@+id/muse_forth"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginLeft=
"5dp"
android:layout_marginRight=
"@dimen/platform_dp_15"
android:layout_weight=
"1"
app:cardElevation=
"0dp"
app:cardCornerRadius=
"@dimen/platform_dp_4"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"centerCrop"
android:src=
"@drawable/home_muse_fouth_img"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"@dimen/platform_dp_15"
android:layout_marginTop=
"13dp"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/muse_forth_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"压力缓冲"
android:maxLines=
"1"
android:ellipsize=
"end"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_16"
/>
<ImageView
android:layout_width=
"18dp"
android:layout_height=
"@dimen/platform_dp_18"
android:layout_marginLeft=
"@dimen/platform_dp_4"
android:src=
"@drawable/home_muse_play"
/>
</LinearLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/platform_dp_7"
android:orientation=
"horizontal"
android:paddingLeft=
"6.5dp"
android:paddingRight=
"6.5dp"
android:layout_marginBottom=
"16dp"
>
<RelativeLayout
android:id=
"@+id/sleeps_first"
android:layout_width=
"0dp"
android:layout_height=
"80dp"
android:layout_weight=
"1"
>
<com.ydl.ydlcommon.view.widgets.RoundImageView
android:layout_width=
"72dp"
android:layout_height=
"72dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/home_muse_circle_first"
android:layout_centerInParent=
"true"
app:pa_type=
"pa_circle"
/>
<TextView
android:id=
"@+id/sleeps_first_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"篝火"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_14"
android:textStyle=
"bold"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/sleeps_second"
android:layout_width=
"0dp"
android:layout_height=
"80dp"
android:layout_weight=
"1"
>
<com.ydl.ydlcommon.view.widgets.RoundImageView
android:layout_width=
"72dp"
android:layout_height=
"72dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/home_muse_circle_second"
android:layout_centerInParent=
"true"
app:pa_type=
"pa_circle"
/>
<TextView
android:id=
"@+id/sleeps_second_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"溪流"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_14"
android:textStyle=
"bold"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/sleeps_third"
android:layout_width=
"0dp"
android:layout_height=
"80dp"
android:layout_weight=
"1"
>
<com.ydl.ydlcommon.view.widgets.RoundImageView
android:layout_width=
"72dp"
android:layout_height=
"72dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/home_muse_circle_third"
android:layout_centerInParent=
"true"
app:pa_type=
"pa_circle"
/>
<TextView
android:id=
"@+id/sleeps_third_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"风声"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_14"
android:textStyle=
"bold"
/>
</RelativeLayout>
<RelativeLayout
android:id=
"@+id/sleeps_forth"
android:layout_width=
"0dp"
android:layout_height=
"80dp"
android:layout_weight=
"1"
>
<com.ydl.ydlcommon.view.widgets.RoundImageView
android:layout_width=
"72dp"
android:layout_height=
"72dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/home_muse_circle_fouth"
android:layout_centerInParent=
"true"
app:pa_type=
"pa_circle"
/>
<TextView
android:id=
"@+id/sleeps_forth_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"落雨"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_14"
android:textStyle=
"bold"
/>
</RelativeLayout>
</LinearLayout>
</merge>
</merge>
\ No newline at end of file
m-home/src/ydl/res/layout/layout_meditation_item.xml
View file @
a5f63d1f
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|start"
android:layout_gravity=
"bottom|start"
android
:text=
"溪流"
tools
:text=
"溪流"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"14sp"
android:textSize=
"14sp"
android:layout_marginStart=
"6dp"
android:layout_marginStart=
"6dp"
...
...
m-muse/build.gradle
View file @
a5f63d1f
...
@@ -58,6 +58,9 @@ dependencies {
...
@@ -58,6 +58,9 @@ dependencies {
androidTestImplementation
'androidx.test.ext:junit:1.1.2'
androidTestImplementation
'androidx.test.ext:junit:1.1.2'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.3.0'
implementation
'com.wx.wheelview:wheelview:1.3.3'
// solve build problem
// solve build problem
// cannot access 'androidx.lifecycle.hasdefaultviewmodelproviderfactory'
// cannot access 'androidx.lifecycle.hasdefaultviewmodelproviderfactory'
// Comment out when compiling
// 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
package
com.yidianling.muse.activity
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.bean.StatusBarOptions
import
com.ydl.ydlcommon.bean.StatusBarOptions
import
com.ydl.ydlcommon.utils.LogUtil
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.MeditationWheelViewUtil
import
com.yidianling.muse.R
import
com.yidianling.muse.R
import
kotlinx.android.synthetic.main.activity_play_meditation_time_off.*
import
kotlinx.android.synthetic.main.activity_play_meditation_time_off.*
...
@@ -21,15 +24,38 @@ class MeditationTimeOffActivity:BaseActivity() {
...
@@ -21,15 +24,38 @@ class MeditationTimeOffActivity:BaseActivity() {
private
fun
initView
()
{
private
fun
initView
()
{
iv_close
?.
setOnClickListener
{
finish
()
}
iv_close
?.
setOnClickListener
{
finish
()
}
tv_save_setting
?.
setOnClickListener
{
tv_save_setting
?.
setOnClickListener
{
ToastHelper
.
show
(
"保存设置"
)
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
()
finish
()
}
}
tv_cancel_time_off
?.
setOnClickListener
{
tv_cancel_time_off
?.
setOnClickListener
{
ToastHelper
.
show
(
"关闭定时"
)
ToastHelper
.
show
(
"关闭定时"
)
val
intent
=
Intent
()
intent
.
putExtra
(
"TIME_OFF_HOUR"
,
""
)
intent
.
putExtra
(
"TIME_OFF_MINUTE"
,
""
)
setResult
(
RESULT_OK
,
intent
)
finish
()
finish
()
}
}
...
@@ -39,7 +65,7 @@ class MeditationTimeOffActivity:BaseActivity() {
...
@@ -39,7 +65,7 @@ class MeditationTimeOffActivity:BaseActivity() {
private
fun
initWheel
()
{
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.*
...
@@ -21,6 +21,8 @@ import kotlinx.android.synthetic.main.player_control_view.*
import
java.util.*
import
java.util.*
@Route
(
path
=
"/muse/play"
)
@Route
(
path
=
"/muse/play"
)
class
PlayMeditationActivity
:
BaseActivity
()
{
class
PlayMeditationActivity
:
BaseActivity
()
{
...
@@ -50,7 +52,6 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -50,7 +52,6 @@ class PlayMeditationActivity : BaseActivity() {
setTransparentForImageView
(
this
,
null
)
setTransparentForImageView
(
this
,
null
)
statusBarLightMode
(
this
)
statusBarLightMode
(
this
)
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
initView
()
initView
()
}
}
...
@@ -118,7 +119,7 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -118,7 +119,7 @@ class PlayMeditationActivity : BaseActivity() {
}
}
iv_time_off
.
setOnClickListener
{
iv_time_off
.
setOnClickListener
{
startActivity
(
Intent
(
this
,
MeditationTimeOffActivity
::
class
.
java
)
)
startActivity
ForResult
(
Intent
(
this
,
MeditationTimeOffActivity
::
class
.
java
),
request_code
)
}
}
initMediaPlayer
()
initMediaPlayer
()
...
@@ -269,6 +270,19 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -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
()
{
override
fun
onDestroy
()
{
super
.
onDestroy
()
super
.
onDestroy
()
mTimer
.
cancel
()
mTimer
.
cancel
()
...
@@ -276,4 +290,10 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -276,4 +290,10 @@ class PlayMeditationActivity : BaseActivity() {
MediaPlayerManager
.
getInstance
(
this
).
release
()
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 @@
...
@@ -139,10 +139,13 @@
app:layout_constraintStart_toEndOf=
"@id/guide_line"
/>
app:layout_constraintStart_toEndOf=
"@id/guide_line"
/>
<TextView
<TextView
android:id=
"@+id/tv_time_off"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
tools:text=
"56:32"
tools:text=
"56:32"
android:textSize=
"12sp"
android:textColor=
"@color/white"
app:layout_constraintTop_toBottomOf=
"@id/iv_time_off"
app:layout_constraintTop_toBottomOf=
"@id/iv_time_off"
app:layout_constraintStart_toStartOf=
"@id/iv_time_off"
app:layout_constraintStart_toStartOf=
"@id/iv_time_off"
app:layout_constraintEnd_toEndOf=
"@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"?>
<?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:tools=
"http://schemas.android.com/tools"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -33,12 +34,26 @@
...
@@ -33,12 +34,26 @@
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:layout_marginHorizontal=
"72dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"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>
</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