Commit b4e9ad37 by 霍志良

feat:首页数据修改

parent a8d106fc
...@@ -9,7 +9,7 @@ ext { ...@@ -9,7 +9,7 @@ ext {
"m-consultant" : "0.0.60.11", "m-consultant" : "0.0.60.11",
"m-fm" : "0.0.30.04", "m-fm" : "0.0.30.04",
"m-user" : "0.0.62.01", "m-user" : "0.0.62.01",
"m-home" : "0.0.22.95", "m-home" : "0.0.23.10",
"m-im" : "0.0.21.18", "m-im" : "0.0.21.18",
"m-dynamic" : "0.0.7.35", "m-dynamic" : "0.0.7.35",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
...@@ -93,7 +93,7 @@ ext { ...@@ -93,7 +93,7 @@ ext {
"m-consultant" : "0.0.60.11", "m-consultant" : "0.0.60.11",
"m-fm" : "0.0.30.07", "m-fm" : "0.0.30.07",
"m-user" : "0.0.62.01", "m-user" : "0.0.62.01",
"m-home" : "0.0.22.95", "m-home" : "0.0.22.98",
"m-im" : "0.0.21.18", "m-im" : "0.0.21.18",
"m-dynamic" : "0.0.7.35", "m-dynamic" : "0.0.7.35",
"m-article" : "0.0.0.8", "m-article" : "0.0.0.8",
......
...@@ -13,6 +13,7 @@ import com.yidianling.home.constract.HomeViewConfig ...@@ -13,6 +13,7 @@ import com.yidianling.home.constract.HomeViewConfig
import com.yidianling.home.event.HomeImpl import com.yidianling.home.event.HomeImpl
import com.yidianling.home.model.bean.* import com.yidianling.home.model.bean.*
import com.yidianling.home.ui.view.* import com.yidianling.home.ui.view.*
import kotlin.properties.Delegates
/** /**
...@@ -61,20 +62,19 @@ class YdlHomeAdapter(private val mContext: Context, ...@@ -61,20 +62,19 @@ class YdlHomeAdapter(private val mContext: Context,
/* /*
倾诉免费标识 倾诉免费标识
* */ * */
var listenFree:Boolean?=false var listenFree :Boolean?=false
fun updateItems(list: MutableList<HomePagerDataBean>) { fun updateItems(list: MutableList<HomePagerDataBean>) {
if (null == this.list || this.list!!.isEmpty()) { this.list.clear()
this.list = ArrayList()
} else {
this.list.clear()
}
this.list.addAll(list) this.list.addAll(list)
this.listenFree= list[0]?.headerBean?.listenFree this.listenFree= list[0]?.headerBean?.listenFree!!
//重置标记位 //重置标记位
confidePosition = -1 confidePosition = -1
consultPosition = -1 consultPosition = -1
updateConfideFreeData(null)
notifyDataSetChanged() notifyDataSetChanged()
LogUtil.e("aaaaaaaaupdateItems"+listenFree)
} }
...@@ -88,6 +88,21 @@ class YdlHomeAdapter(private val mContext: Context, ...@@ -88,6 +88,21 @@ class YdlHomeAdapter(private val mContext: Context,
list[confidePosition].confideBean = data list[confidePosition].confideBean = data
this.confideSelectPosition = selectPosition this.confideSelectPosition = selectPosition
notifyItemChanged(confidePosition) notifyItemChanged(confidePosition)
LogUtil.e("aaaaaaaaupdateConfideData"+listenFree)
}
/**
* 更新倾诉免费标识
*/
fun updateConfideFreeData(data: HomeHeaderBean?) {
if (data!=null){
list[1].headerBean = data
}
notifyItemChanged(1)
LogUtil.e("aaaaaaaaupdateupdateConfideFreeData"+listenFree)
} }
/** /**
...@@ -100,6 +115,7 @@ class YdlHomeAdapter(private val mContext: Context, ...@@ -100,6 +115,7 @@ class YdlHomeAdapter(private val mContext: Context,
list[consultPosition].consultBean = data list[consultPosition].consultBean = data
this.consultSelectPosition = selectPosition this.consultSelectPosition = selectPosition
notifyItemChanged(consultPosition) notifyItemChanged(consultPosition)
LogUtil.e("aaaaaaaaupdateConsultData"+listenFree)
notifyItemChanged(1) notifyItemChanged(1)
} }
...@@ -110,6 +126,8 @@ class YdlHomeAdapter(private val mContext: Context, ...@@ -110,6 +126,8 @@ class YdlHomeAdapter(private val mContext: Context,
fun updateAskData(data: HomeAskBean, position: Int) { fun updateAskData(data: HomeAskBean, position: Int) {
list[position].askBean = data list[position].askBean = data
// notifyItemChanged(position) // notifyItemChanged(position)
LogUtil.e("aaaaaaaupdateAskData"+listenFree)
} }
override fun getItemViewType(position: Int): Int { override fun getItemViewType(position: Int): Int {
...@@ -122,6 +140,7 @@ class YdlHomeAdapter(private val mContext: Context, ...@@ -122,6 +140,7 @@ class YdlHomeAdapter(private val mContext: Context,
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
LogUtil.e("aaaaaaaaaa"+viewType+listenFree)
when (viewType) { when (viewType) {
//顶部ViewPager与分类模块 //顶部ViewPager与分类模块
HomeViewConfig.getOrder().bannerIndex -> { HomeViewConfig.getOrder().bannerIndex -> {
......
...@@ -307,6 +307,8 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm ...@@ -307,6 +307,8 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
} }
override fun homeHeadResponse(homeHeaderBean: HomeHeaderBean) { override fun homeHeadResponse(homeHeaderBean: HomeHeaderBean) {
//更新倾述列表数据
adapter?.updateConfideFreeData(homeHeaderBean)
//展示活动数据 //展示活动数据
val act = homeHeaderBean.activityResponse val act = homeHeaderBean.activityResponse
...@@ -363,7 +365,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm ...@@ -363,7 +365,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
home_swipe_refresh_layout.isRefreshing = false home_swipe_refresh_layout.isRefreshing = false
//更新首页数据 //更新首页数据
adapter?.updateItems(list) adapter?.updateItems(list)
adapter?.notifyDataSetChanged()
if (!TextUtils.isEmpty(list[0].headerBean?.doctorName)) { if (!TextUtils.isEmpty(list[0].headerBean?.doctorName)) {
doctorName = list[0].headerBean?.doctorName!! doctorName = list[0].headerBean?.doctorName!!
initSearchBar() initSearchBar()
...@@ -527,6 +529,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm ...@@ -527,6 +529,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
isFromCreate = false isFromCreate = false
mPresenter?.loadHomeData() mPresenter?.loadHomeData()
} else { } else {
mPresenter?.loadHomeData()
mPresenter?.getConsultData(consultLastSelectType, consultLastSelectPosition) mPresenter?.getConsultData(consultLastSelectType, consultLastSelectPosition)
mPresenter?.getConfideData(confideLastSelectType, confideLastSelectPosition) mPresenter?.getConfideData(confideLastSelectType, confideLastSelectPosition)
} }
......
...@@ -8,6 +8,7 @@ import android.widget.LinearLayout ...@@ -8,6 +8,7 @@ import android.widget.LinearLayout
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.yidianling.common.tools.LogUtil
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
...@@ -31,6 +32,7 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -31,6 +32,7 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
} }
private fun initView() { private fun initView() {
LogUtil.e("aaaaa"+listenFree)
val params = RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) val params = RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = params layoutParams = params
View.inflate(mContext, R.layout.home_button_banner_view, this) View.inflate(mContext, R.layout.home_button_banner_view, this)
......
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