Commit 3e852281 by 徐健

用户版首頁mvp绑定view

parent fbb25365
...@@ -3,6 +3,7 @@ package com.yidianling.home.presenter ...@@ -3,6 +3,7 @@ package com.yidianling.home.presenter
import android.annotation.SuppressLint import android.annotation.SuppressLint
import com.google.gson.Gson import com.google.gson.Gson
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.SharedPreferencesEditor import com.ydl.ydlcommon.utils.SharedPreferencesEditor
...@@ -42,7 +43,8 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract ...@@ -42,7 +43,8 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
val homeList: MutableList<HomePagerDataBean> = mutableListOf() val homeList: MutableList<HomePagerDataBean> = mutableListOf()
LogUtil.d("mConsultType-loadHomeData:$mConsultType") LogUtil.d("mConsultType-loadHomeData:$mConsultType")
Observable.mergeArray( Observable.mergeArray(
mModel.headerRequest().map { it -> mModel.headerRequest()
.compose(RxUtils.applySchedulers(mView)).map { it ->
//首页头部数据 分类 & Banner //首页头部数据 分类 & Banner
homeList.add( homeList.add(
getHomeItemFromTempData( getHomeItemFromTempData(
...@@ -64,20 +66,24 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract ...@@ -64,20 +66,24 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
ModularServiceManager.provide(IConsultantService::class.java).setHotSearch(it) ModularServiceManager.provide(IConsultantService::class.java).setHotSearch(it)
} }
}, },
mModel.consultRequest(mConsultType).map { mModel.consultRequest(mConsultType)
.compose(RxUtils.applySchedulers(mView)).map {
//首页咨询数据 //首页咨询数据
homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.CONSULT_VIEW)) homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.CONSULT_VIEW))
}, },
//GoodType为空 获取默认类型 //GoodType为空 获取默认类型
mModel.confideRequest(mConfideType).map { mModel.confideRequest(mConfideType)
.compose(RxUtils.applySchedulers(mView)).map {
//首页倾述数据 //首页倾述数据
homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.CONFIDE_VIEW)) homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.CONFIDE_VIEW))
}, },
mModel.courseRequest().map { mModel.courseRequest()
.compose(RxUtils.applySchedulers(mView)).map {
//首页课程数据 //首页课程数据
homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.COURSE_VIEW)) homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.COURSE_VIEW))
}, },
mModel.testRequest().map { mModel.testRequest()
.compose(RxUtils.applySchedulers(mView)).map {
//首页测试数据 //首页测试数据
val homeTestBean = HomeTestBean() val homeTestBean = HomeTestBean()
homeTestBean.testItemList = it.data homeTestBean.testItemList = it.data
...@@ -88,7 +94,8 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract ...@@ -88,7 +94,8 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
) )
) )
}, },
mModel.askRequest().map { mModel.askRequest()
.compose(RxUtils.applySchedulers(mView)).map {
//首页问答数据 //首页问答数据
homeList.add( homeList.add(
getHomeItemFromTempData( getHomeItemFromTempData(
...@@ -97,11 +104,13 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract ...@@ -97,11 +104,13 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
) )
) )
}, },
mModel.museRequest().map { mModel.museRequest()
.compose(RxUtils.applySchedulers(mView)).map {
//首页冥想数据 //首页冥想数据
homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.MUSE_VIEW)) homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.MUSE_VIEW))
}, },
mModel.fmRequest().map { mModel.fmRequest()
.compose(RxUtils.applySchedulers(mView)).map {
//首页电台数据 //首页电台数据
homeList.add( homeList.add(
getHomeItemFromTempData( getHomeItemFromTempData(
...@@ -110,7 +119,8 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract ...@@ -110,7 +119,8 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
) )
) )
}, },
mModel.articleRequest().map { mModel.articleRequest()
.compose(RxUtils.applySchedulers(mView)).map {
//首页文章数据 //首页文章数据
homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.ARTICLE_VIEW)) homeList.add(getHomeItemFromTempData(it, YdlHomeViewHolderConstract.ARTICLE_VIEW))
homeList.add(HomePagerDataBean(YdlHomeViewHolderConstract.FOOTER_VIEW)) homeList.add(HomePagerDataBean(YdlHomeViewHolderConstract.FOOTER_VIEW))
......
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/search_hint" android:text="@string/home_search_hint"
android:textColor="#999999" android:textColor="#999999"
android:textSize="@dimen/platform_default_text_size_small" android:textSize="@dimen/platform_default_text_size_small"
android:textStyle="normal" android:textStyle="normal"
......
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