Commit ba7006df by 刘鹏

Merge branch 'feat/lp/lp_home_muse' into 'd/v4.0.55_xlzx'

心理咨询首页接入冥想

See merge request app_android_lib/YDL-Component!281
parents b6b30d3c 8eb00844
......@@ -14,7 +14,7 @@ buildscript {
ydlrouter_version = '1.2.3'
constrait_support_version = '1.0.2'
componentVersion = "0.3.0.12"
componentVersion = "0.3.0.11-SNAPSHOT"
}
repositories {
mavenCentral()
......
package com.yidianling.home
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.yidianling.home.test", appContext.packageName)
}
}
......@@ -1048,6 +1048,9 @@
"type": 10004
},
{
"type": 10005
},
{
"courseBean": {
"pageNum": 1,
"pageSize": 3,
......@@ -1303,7 +1306,7 @@
}
]
},
"type": 10005
"type": 10006
},
{
"askBean": {
......@@ -5568,8 +5571,9 @@
}
]
},
"type": 10006
"type": 10007
},
{ "type": 1000101},
{
"articleBean": {
"list": [
......@@ -5740,9 +5744,9 @@
}
]
},
"type": 10007
"type": 10008
},
{
"type": 10008
"type": 10009
}
]
\ No newline at end of file
......@@ -21,7 +21,6 @@ import com.yidianling.home.R
import com.yidianling.home.constants.HomeBIConstants
import com.yidianling.home.model.bean.MeditationModuleBean
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.ydl.home_fragment.*
class MeditationTypeAdapter(
private val context: Context,
......
......@@ -102,4 +102,7 @@ class HomeBaseHttp {
return RxUtils.mapObservable(cmd).flatMap { getHomePagerApi().askFocus(it) }
}
fun getMeditationInfo(): Observable<BaseAPIResponse<MeditationModuleBean>> {
return getHomePagerApi().getMeditation()
}
}
\ No newline at end of file
......@@ -111,5 +111,8 @@ interface HomeBasePagerApi {
@POST("sq-active/focus")
fun askFocus(@FieldMap params: Map<String, String>): Observable<BaseResponse<AskResultBean>>
@GET("cms/meditation/index")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getMeditation(): Observable<BaseAPIResponse<MeditationModuleBean>>
}
\ No newline at end of file
package com.yidianling.home.ui.view
package com.yidianling.home.view
import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.yidianling.home.R
import kotlinx.android.synthetic.ydl.home_common_title_view.view.*
import kotlinx.android.synthetic.main.home_common_title_view.view.*
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
......
package com.yidianling.home.ui.view
package com.yidianling.home.view
import android.annotation.SuppressLint
import android.content.Context
......@@ -21,10 +21,8 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.home.adapter.MeditationViewPagerAdapter
import com.yidianling.home.R
import com.yidianling.home.constants.HomeBIConstants
import com.yidianling.home.constract.HomeViewConfig
import com.yidianling.home.event.IHomeEvent
import com.yidianling.home.model.bean.MeditationModuleBean
import kotlinx.android.synthetic.ydl.home_muse_view.view.*
import kotlinx.android.synthetic.main.home_muse_view.view.*
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
......@@ -33,7 +31,7 @@ import kotlinx.android.synthetic.ydl.home_muse_view.view.*
* @Company 壹点灵
* @date 2019/09/10
*/
class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEvent?) :
class HomeMuseView(private val mContext: Context) :
LinearLayout(mContext) {
private val meditationTitles = mutableListOf<String>()
......@@ -51,7 +49,7 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
)
layoutParams = params
View.inflate(mContext, R.layout.home_muse_view, this)
homeModuleMuseViewHomeCommonTitleView.setTitle(HomeViewConfig.getOrder().museTitle)
homeModuleMuseViewHomeCommonTitleView.setTitle("助眠·冥想")
}
fun initData(bean: MeditationModuleBean?) {
......
......@@ -7,7 +7,7 @@
android:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleMuseViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white_60">#99FFFFFF</color>
</resources>
......@@ -10,7 +10,14 @@
<item name="colorPrimaryDark">@color/platform_main_theme</item>
<item name="colorAccent">@color/platform_main_theme</item>
</style>
<style name="MeditationTabLayoutStyle" parent="Widget.Design.TabLayout">
<item name="tabIndicatorColor">@color/white</item>
<item name="tabIndicatorHeight">2dp</item>
<item name="tabIndicatorFullWidth">false</item>
<item name="tabSelectedTextColor">@color/white</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@color/white_60</item>
</style>
</resources>
\ No newline at end of file
package com.yidianling.home
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
package com.yidianling.home.adapter
import android.content.Context
import android.graphics.Color
import android.media.MediaPlayer
import androidx.recyclerview.widget.RecyclerView
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.data.PlatformDataManager
import com.yidianling.home.R
import com.yidianling.home.constract.YdlHomeViewHolderConstract
import com.yidianling.home.event.HomeImpl
......@@ -17,6 +17,8 @@ import com.yidianling.home.model.bean.HomeConfideBean
import com.yidianling.home.model.bean.HomeConsultBean
import com.yidianling.home.model.bean.HomePagerDataBean
import com.yidianling.home.ui.view.*
import com.yidianling.home.view.HomeMuseView
import kotlinx.android.synthetic.main.home_muse_view.view.*
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
......@@ -126,6 +128,11 @@ class YdlHomeAdapter(
YdlHomeViewHolderConstract.ASSUAGE_GRIEF_VIEW -> {
return HomeAssuageGriefViewHolder(HomeAssuageGriefView(mContext, homeEvent))
}
//壹点*冥想模块
YdlHomeViewHolderConstract.MUSE_VIEW -> {
return HomeMuseViewHolder(HomeMuseView(mContext))
}
//文章*阅读模块
YdlHomeViewHolderConstract.ARTICLE_VIEW -> {
return HomeArticleViewHolder(HomeArticleView(mContext, homeEvent))
......@@ -157,21 +164,6 @@ class YdlHomeAdapter(
list[position].headerBean?.askCategoryData
)
}
//倾诉*排解模块
// is HomeConfideViewHolder -> {
// if (!TextUtils.isEmpty(ffrom) && ffrom.endsWith("huawei")) {
// val parm = holder.itemView.layoutParams
// parm.height = 0
// holder.itemView.layoutParams = parm
// } else {
// holder.confideViewView.setTitle(
// list[position].headerBean?.listenCategoryDate,
// confideSelectPosition
// )
// holder.confideViewView.setConfideExpertInfoView(list[position].confideBean?.body)
// confidePosition = position
// }
// }
//课程*成长模块
is HomeCourseViewHolder -> {
holder.courseViewView.initData(list[position].courseBean?.list)
......@@ -202,6 +194,17 @@ class YdlHomeAdapter(
is HomeTestViewHolder -> {
holder.testView.initData(list[position].testListBean)
}
is HomeMuseViewHolder -> {
holder.museViewView.video_view?.setOnInfoListener { mp, what, extra ->
if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START) {
holder.museViewView.video_view?.setBackgroundColor(Color.TRANSPARENT)
}
true
}
holder.museViewView.video_view?.start()
holder.museViewView.initData(list[position].meditationBean)
}
}
}
......@@ -255,6 +258,10 @@ class YdlHomeAdapter(
*/
inner class HomeArticleViewHolder(val articleViewView: HomeArticleView) :
RecyclerView.ViewHolder(articleViewView)
/**
* 解忧*问答模块 ViewHolder
*/
inner class HomeMuseViewHolder(val museViewView: HomeMuseView) : RecyclerView.ViewHolder(museViewView)
/**
* 底部提示语模块 ViewHolder
......
......@@ -62,6 +62,6 @@ class IHomeContract {
*/
fun getCoupons(uid: String): Observable<BaseResponse<List<CouponBean>>>
fun getMeditation(): Observable<MeditationModuleBean>
}
}
\ No newline at end of file
......@@ -29,26 +29,32 @@ class YdlHomeViewHolderConstract {
* 测试模块
*/
val TEST_VIEW = 10004
/**
* 冥想模块
*/
val MUSE_VIEW = 10005
/**
* 课程*成长模块
*/
val COURSE_VIEW = 10005
val COURSE_VIEW = 10006
/**
* 解忧*问答模块
*/
val ASSUAGE_GRIEF_VIEW = 10006
val ASSUAGE_GRIEF_VIEW = 10007
/**
* 文章*阅读模块
*/
val ARTICLE_VIEW = 10007
val ARTICLE_VIEW = 10008
/**
* 底部提示语模块
*/
val FOOTER_VIEW = 10008
val FOOTER_VIEW = 10009
/**
* 倾诉*排解模块
*/
val CONFIDE_VIEW = 1000100
}
}
\ No newline at end of file
......@@ -2,9 +2,13 @@ package com.yidianling.home.model
import com.yidianling.home.http.HomeHttp
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils
import com.yidianling.home.constract.IHomeContract
import com.yidianling.home.http.HomeBaseHttp
import com.yidianling.home.model.bean.*
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
......@@ -26,5 +30,9 @@ class HomeModelImpl: BaseHomeModelImpl(), IHomeContract.Model {
return HomeHttp.getInstance().getCoupons(uid)
}
override fun getMeditation(): Observable<MeditationModuleBean> {
return HomeBaseHttp.getInstance().getMeditationInfo().compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.onErrorReturn { MeditationModuleBean(true) }
}
}
\ No newline at end of file
......@@ -145,10 +145,15 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
if (dataBean.isRealEmpty || dataBean !is HomeAskBean) homeTempData.askBean else dataBean
mHomeAskBean = item.askBean
}
YdlHomeViewHolderConstract.MUSE_VIEW -> {
item.meditationBean =
if (dataBean.isRealEmpty || dataBean !is MeditationModuleBean) homeTempData.meditationBean else dataBean
}
YdlHomeViewHolderConstract.ARTICLE_VIEW -> {
item.articleBean =
if (dataBean.isRealEmpty || dataBean !is HomeArticleBean) homeTempData.articleBean else dataBean
}
}
return item
}
......@@ -220,6 +225,11 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
)
)
},
mModel.getMeditation()
.compose(RxUtils.applySchedulers(mView)).map {
//首页问答数据
homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.MUSE_VIEW))
},
mModel.askRequest()
.compose(RxUtils.applySchedulers(mView)).map {
//首页问答数据
......@@ -243,7 +253,7 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
mView.homeDataFail(msg)
}
}, Action {
if (homeList.size != 9){
if (homeList.size != 10){
mView.homeDataFail("")
return@Action
}
......
......@@ -14,7 +14,8 @@ import com.yidianling.home.constract.HomeViewConfig
import com.yidianling.home.event.HomeImpl
import com.yidianling.home.model.bean.*
import com.yidianling.home.ui.view.*
import kotlinx.android.synthetic.ydl.home_muse_view.view.*
import com.yidianling.home.view.HomeMuseView
import kotlinx.android.synthetic.main.home_muse_view.view.*
/**
......@@ -178,7 +179,7 @@ class YdlHomeAdapter(private val mContext: Context,
}
//壹点*冥想模块
HomeViewConfig.getOrder().museIndex -> {
return HomeMuseViewHolder(HomeMuseView(mContext, homeEvent),viewType)
return HomeMuseViewHolder(HomeMuseView(mContext), viewType)
}
//底部提示语模块
else -> {
......@@ -301,7 +302,7 @@ class YdlHomeAdapter(private val mContext: Context,
/**
* 文章*阅读模块 ViewHolder
*/
inner class HomeMuseViewHolder(val museViewView: HomeMuseView,val viewType:Int) : RecyclerView.ViewHolder(museViewView)
inner class HomeMuseViewHolder(val museViewView: HomeMuseView, val viewType:Int) : RecyclerView.ViewHolder(museViewView)
/**
* 文章*阅读模块 ViewHolder
......
......@@ -22,6 +22,6 @@ class IHomeContract {
*/
fun museRequest(): Observable<MuseModuleBean>
fun getMeditation():Observable<MeditationModuleBean>
fun getMeditation(): Observable<MeditationModuleBean>
}
}
\ No newline at end of file
......@@ -39,8 +39,5 @@ class HomeHttp {
return getHomePagerApi().getMuseData()
}
fun getMeditationInfo():Observable<BaseAPIResponse<MeditationModuleBean>>{
return getHomePagerApi().getMeditation()
}
}
\ No newline at end of file
......@@ -23,8 +23,5 @@ interface HomePagerApi {
@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
......@@ -2,6 +2,7 @@ package com.yidianling.home.model
import com.ydl.ydlcommon.data.http.RxUtils
import com.yidianling.home.constract.IHomeContract
import com.yidianling.home.http.HomeBaseHttp
import com.yidianling.home.http.HomeHttp
import com.yidianling.home.model.bean.MeditationModuleBean
import com.yidianling.home.model.bean.MuseModuleBean
......@@ -28,7 +29,7 @@ class HomeModelImpl : BaseHomeModelImpl(), IHomeContract.Model {
}
override fun getMeditation(): Observable<MeditationModuleBean> {
return HomeHttp.getInstance().getMeditationInfo().compose(RxUtils.resultJavaData())
return HomeBaseHttp.getInstance().getMeditationInfo().compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.onErrorReturn { MeditationModuleBean(true) }
}
......
......@@ -47,10 +47,9 @@ import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.home_muse_view.*
import kotlinx.android.synthetic.ydl.home_fragment.*
import kotlinx.android.synthetic.ydl.home_fragment.tab_layout
import kotlinx.android.synthetic.ydl.home_muse_view.*
import kotlinx.android.synthetic.ydl.home_muse_view.view.*
import java.util.concurrent.TimeUnit
......
......@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleArticleViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
......
......@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleAssuageGriefViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
......
......@@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleConfideViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
......
......@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleCourseViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
......
......@@ -4,7 +4,7 @@
android:layout_height="wrap_content"
>
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleIntelligentViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
......
......@@ -4,7 +4,7 @@
android:layout_height="wrap_content"
>
<com.yidianling.home.ui.view.HomeCommonTitleView
<com.yidianling.home.view.HomeCommonTitleView
android:id="@+id/homeModuleIntelligentViewHomeCommonTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="white_60">#99FFFFFF</color>
<color name="white">#FFFFFF</color>
<color name="home_confide_61CEAC">#61CEAC</color>
......
......@@ -11,13 +11,5 @@
<item name="android:windowIsTranslucent">true</item>
</style>
<style name="MeditationTabLayoutStyle" parent="Widget.Design.TabLayout">
<item name="tabIndicatorColor">@color/white</item>
<item name="tabIndicatorHeight">2dp</item>
<item name="tabIndicatorFullWidth">false</item>
<item name="tabSelectedTextColor">@color/white</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@color/white_60</item>
</style>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment