Commit 9c71c8be by 徐健

修复快速切换首页和其他页面导致得首页数据加载异常问题

parent 79079b9e
......@@ -15,7 +15,6 @@ import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;
import com.ydl.audioim.YDLavManager;
import com.ydl.component.BuildConfig;
import com.ydl.component.MainActivity;
import com.ydl.media.audio.PlayService;
......
......@@ -44,10 +44,10 @@ ext {
//第三步 若干
"m-confide" : "0.0.41.1",
"m-consultant" : "0.0.51.1",
"m-consultant" : "0.0.51.3",
"m-fm" : "0.0.23.3",
"m-user" : "0.0.40.3",
"m-home" : "0.0.6.6",
"m-home" : "0.0.6.18",
"m-muse" : "0.0.20.3",
"m-tests" : "0.0.15.2",
......
......@@ -151,7 +151,7 @@ public class ExpertSearchBigShotBean {
private int id;
private int parentId;
private int iamgeType;
private int imageType;
private int isShow;
private String createTime;
private String updateTime;
......@@ -174,12 +174,12 @@ public class ExpertSearchBigShotBean {
this.parentId = parentId;
}
public int getIamgeType() {
return iamgeType;
public int getImageType() {
return imageType;
}
public void setIamgeType(int iamgeType) {
this.iamgeType = iamgeType;
public void setImageType(int iamgeType) {
this.imageType = iamgeType;
}
public int getIsShow() {
......
......@@ -152,7 +152,7 @@ public class ExpertSearchRecommandBean {
private int id;
private int parentId;
private int iamgeType;
private int imageType;
private int isShow;
private String createTime;
private String updateTime;
......@@ -175,12 +175,12 @@ public class ExpertSearchRecommandBean {
this.parentId = parentId;
}
public int getIamgeType() {
return iamgeType;
public int getImageType() {
return imageType;
}
public void setIamgeType(int iamgeType) {
this.iamgeType = iamgeType;
public void setImageType(int iamgeType) {
this.imageType = iamgeType;
}
public int getIsShow() {
......
......@@ -3,5 +3,5 @@ package com.yidianling.consultant.bean
class ExpertSearchTopShowBean (
var doctorSpecialTopics: ArrayList<ExpertSearchBigShotBean>,
var sceneSpecialTopic: ArrayList<ExpertSearchRecommandBean>
var sceneSpecialTopics: ArrayList<ExpertSearchRecommandBean>
)
......@@ -79,7 +79,7 @@ class RecommendListView : LinearLayout {
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
if (null != mContext) {
mSceneSpecialTopicList.addAll(it.sceneSpecialTopic)
mSceneSpecialTopicList.addAll(it.sceneSpecialTopics)
mDoctorSpecialTopicsList.addAll(it.doctorSpecialTopics)
setData()
}
......
......@@ -105,7 +105,7 @@ class IHomeBaseContract {
/**
*获取咨询列表
*/
fun getConsultData(type: String, selectPosition: Int)
fun getConsultData(type: String, selectPosition: Int, isCancelHome: Boolean = true)
/**
* 首页问答 - 点赞
......
......@@ -58,9 +58,9 @@ abstract class BaseHomePresenterImpl< V : IHomeBaseContract.View,M : IHomeBaseC
//首页缓存版本号
var HOME_PAGER_DATA_CACHE_VERISON = "HOME_PAGER_DATA_CACHE_VERISON"
private var mConsultDisposable: Disposable? = null
private var mConfideDisposable: Disposable? = null
private var mHomeDisposable: Disposable? = null
var mConsultDisposable: Disposable? = null
var mConfideDisposable: Disposable? = null
var mHomeDisposable: Disposable? = null
var mConfideType: String = ""
var mConsultType: String = ""
......@@ -151,10 +151,13 @@ abstract class BaseHomePresenterImpl< V : IHomeBaseContract.View,M : IHomeBaseC
/**
*获取咨询列表
*/
override fun getConsultData(type: String, selectPosition: Int) {
override fun getConsultData(type: String, selectPosition: Int, isCancelHome: Boolean) {
disposeConsult()
disposeHome()
if (isCancelHome) {
disposeHome()
}
mConsultType = type
......
......@@ -161,7 +161,7 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
disposeHome()
val homeList: MutableList<HomePagerDataBean> = mutableListOf()
LogUtil.d("mConsultType-loadHomeData:$mConsultType")
Observable.mergeArray(
mHomeDisposable = Observable.mergeArray(
mModel.headerRequest()
.compose(RxUtils.applySchedulers(mView))
.map { it ->
......@@ -183,7 +183,7 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
if (it.consultCategoryData != null && it.consultCategoryData!!.isNotEmpty()) {
//咨询分类和缓存分类不一致,重新加载咨询列表数据
if (it.consultCategoryData!![0].id.toString() != mConsultType) {
getConsultData("${it.consultCategoryData!![0].id}", 0)
getConsultData("${it.consultCategoryData!![0].id}", 0, false)
}
}
// homeList.add(HomePagerDataBean(YdlHomeViewHolderConstract.BUTTON_BANNER_VIEW))
......
......@@ -61,7 +61,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
//设置红包、原价
setPrice(bean)
this.setOnClickListener {
val url = URLUtils.appendParmas(bean.hUrl, "cateId", cateId)
val url = URLUtils.appendParmas(bean.linkUrl, "cateId", cateId)
homeEvent!!.consultItemClick(url, bean.doctorId)
}
}
......
......@@ -20,6 +20,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Action
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.util.*
import java.util.concurrent.TimeUnit
/**
......@@ -42,7 +44,7 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
disposeHome()
val homeList: MutableList<HomePagerDataBean> = mutableListOf()
LogUtil.d("mConsultType-loadHomeData:$mConsultType")
Observable.mergeArray(
mHomeDisposable = Observable.mergeArray(
mModel.headerRequest()
.compose(RxUtils.applySchedulers(mView)).map { it ->
//首页头部数据 分类 & Banner
......@@ -57,7 +59,7 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
if (it.consultCategoryData != null && it.consultCategoryData!!.isNotEmpty()) {
//咨询分类和缓存分类不一致,重新加载咨询列表数据
if (it.consultCategoryData!![0].id.toString() != mConsultType) {
getConsultData("${it.consultCategoryData!![0].id}", 0)
getConsultData("${it.consultCategoryData!![0].id}", 0, false)
}
}
homeList.add(HomePagerDataBean(YdlHomeViewHolderConstract.BUTTON_BANNER_VIEW))
......@@ -130,6 +132,7 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
.subscribe(Consumer {}, object : ThrowableConsumer() {
override fun accept(msg: String) {
mView.homeDataFail(msg)
mHomeDisposable?.dispose()
}
}, Action {
homeList.sortWith(compareBy { it.type })
......
......@@ -66,6 +66,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
* tablayou上次选中的tab下标
*/
private var confideLastSelectPosition = 0
private var confideLastSelectType = ""
/**
* TabLayout.OnTabSelectedListener
*/
......@@ -75,6 +76,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
* 咨询tablayout上次选中的下标
*/
private var consultLastSelectPosition = 0
private var consultLastSelectType= ""
/**
* 悬浮tablayout监听事件
*/
......@@ -207,7 +209,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
*/
override fun getConfideData(type: String, selectPosition: Int) {
confideLastSelectPosition = selectPosition
// tab_layout.getTabAt(confideLastSelectPosition)!!.select()
confideLastSelectType = type
mPresenter?.getConfideData(type, selectPosition)
}
......@@ -216,7 +218,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
*/
override fun getConsultData(type: String, selectPosition: Int) {
consultLastSelectPosition = selectPosition
// tab_consultLayout.getTabAt(consultLastSelectPosition)
consultLastSelectType = type
mPresenter?.getConsultData(type, selectPosition)
}
......@@ -296,10 +298,9 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
if (bean.type == YdlHomeViewHolderConstract.PAGER_BANNER_VIEW) {
initTabLayout(bean.headerBean!!.listenCategoryDate)
initConsultTabLayout(bean.headerBean!!.consultCategoryData)
consultLastSelectType = bean.headerBean!!.consultCategoryData!![0].id.toString()
}
}
//每次全局更新后重置下标位
consultLastSelectPosition = 0
}
/**
......@@ -419,7 +420,8 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
super.onResume()
if (userVisibleHint) {
ActionCountUtils.count(HomeBIConstants.YDL_USER_MAIN_PAGE_VISIT)
mPresenter?.loadHomeData()
mPresenter?.getConsultData(consultLastSelectType, consultLastSelectPosition)
mPresenter?.getConfideData(confideLastSelectType, confideLastSelectPosition)
showConsultAssistantDialog()
}
......
......@@ -46,7 +46,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
//设置头像
setHead(bean)
//设置名称
tv_consult_name.text = bean.doctorName
tv_consult_name.text = bean.name
//咨询师标签
tag_view.initData(StringUtils.strToList(bean.tags))
//设置向TA倾诉人数
......@@ -58,7 +58,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
//设置红包、原价
setPrice(bean)
this.setOnClickListener {
val url = URLUtils.appendParmas(bean.hUrl,"cateId",cateId)
val url = URLUtils.appendParmas(bean.linkUrl,"cateId",cateId)
homeEvent!!.consultItemClick(url,bean.doctorId)
}
}
......@@ -71,7 +71,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
op.errorPic = R.drawable.platform_head_place_hold_pic
op.loadingPic = R.drawable.platform_head_place_hold_pic
op.transform = 0
YDLImageCacheManager.showImage(mContext, bean.doctorHead, img_consult_head, op)
YDLImageCacheManager.showImage(mContext, bean.head, img_consult_head, op)
}
/**
......@@ -118,7 +118,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
}
private fun setPrice(bodyBean: HomeConsultBean.ListBean) {
val confideFee = bodyBean.serviceFee
val confideFee = bodyBean.minBookingPrice
val sb = StringBuffer()
tv_price.text = sb.append("¥").append(confideFee).toString()
}
......
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