Commit a68b3493 by 霍志良

feat:心理咨询代码修改

parent 0897b40c
...@@ -154,7 +154,7 @@ class YdlHomeAdapter( ...@@ -154,7 +154,7 @@ class YdlHomeAdapter(
//顶部预约专家,即时倾诉,心理课堂,心理测试按钮模块 //顶部预约专家,即时倾诉,心理课堂,心理测试按钮模块
is HomeButtonBannerViewHolder -> { is HomeButtonBannerViewHolder -> {
holder.buttonBannerView.initData( holder.buttonBannerView.initData(
list[position].headerBean?.askCategoryData list[position].headerBean?.goldList
) )
} }
//倾诉*排解模块 //倾诉*排解模块
......
...@@ -54,7 +54,7 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -54,7 +54,7 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
fun initData( fun initData(
homeCategory: List<HomeHeaderBean.AskCategoryDataBean>? homeCategory: List<HomeHeaderBean.CategoryGoldListDataBean>?
) { ) {
homeEvent?.let { home_category_view.setEvent(it) } homeEvent?.let { home_category_view.setEvent(it) }
home_category_view.initData(homeCategory) home_category_view.initData(homeCategory)
......
...@@ -30,7 +30,8 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent) ...@@ -30,7 +30,8 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent)
/** /**
* 数据缓存 * 数据缓存
*/ */
var mDataList: ArrayList<HomeHeaderBean.AskCategoryDataBean>? = null var mDataList: ArrayList<HomeHeaderBean.CategoryGoldListDataBean>? = null
/** /**
* 分类view宽度 * 分类view宽度
*/ */
...@@ -113,7 +114,7 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent) ...@@ -113,7 +114,7 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent)
} }
fun initData( fun initData(
askCategoryDataBean: List<HomeHeaderBean.AskCategoryDataBean>?, askCategoryDataBean: List<HomeHeaderBean.CategoryGoldListDataBean>?,
homeSaleData: List<HomeHeaderBean.HomeSaleDataBean>? homeSaleData: List<HomeHeaderBean.HomeSaleDataBean>?
) { ) {
if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) { if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) {
...@@ -136,17 +137,16 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent) ...@@ -136,17 +137,16 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent)
* 判断数据是否变化 * 判断数据是否变化
*/ */
private fun getChange( private fun getChange(
bean: List<HomeHeaderBean.AskCategoryDataBean>?, bean: List<HomeHeaderBean.CategoryGoldListDataBean>?,
cacheBean: List<HomeHeaderBean.AskCategoryDataBean>? cacheBean: List<HomeHeaderBean.CategoryGoldListDataBean>?
): Boolean { ): Boolean {
if (bean?.size != cacheBean?.size) { if (bean?.size != cacheBean?.size) {
return true return true
} }
for (index in 0 until bean?.size!!) { for (index in 0 until bean?.size!!) {
if (!bean[index].url.equals(cacheBean!![index].url) if (!bean[index].icon.equals(cacheBean!![index].icon)
|| !bean[index].coverUrl.equals(cacheBean!![index].coverUrl) || !bean[index].title.equals(cacheBean!![index].title)
|| !bean[index].cateTitle.equals(cacheBean!![index].cateTitle) || bean[index].id != cacheBean!![index].id
|| bean[index].cateId != cacheBean!![index].cateId
) { ) {
return true return true
} }
...@@ -218,9 +218,9 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent) ...@@ -218,9 +218,9 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent)
*/ */
private fun bindIconData( private fun bindIconData(
imageView: ImageView, imageView: ImageView,
categoryBean: HomeHeaderBean.AskCategoryDataBean categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) { ) {
GlideApp.with(context).load(categoryBean.coverUrl) GlideApp.with(context).load(categoryBean.icon)
.centerCrop().into(imageView) .centerCrop().into(imageView)
} }
...@@ -249,8 +249,11 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent) ...@@ -249,8 +249,11 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent)
/** /**
* 设置文本 * 设置文本
*/ */
private fun bindTextData(textView: TextView, categoryBean: HomeHeaderBean.AskCategoryDataBean) { private fun bindTextData(
textView.text = categoryBean.cateTitle textView: TextView,
categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) {
textView.text = categoryBean.title
} }
/** /**
......
...@@ -30,7 +30,8 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -30,7 +30,8 @@ class HomeModuleCategoryView : FrameLayout {
/** /**
* 数据缓存 * 数据缓存
*/ */
var mDataList: ArrayList<HomeHeaderBean.AskCategoryDataBean>? = null var mDataList: ArrayList<HomeHeaderBean.CategoryGoldListDataBean>? = null
/** /**
* 分类view宽度 * 分类view宽度
*/ */
...@@ -126,7 +127,7 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -126,7 +127,7 @@ class HomeModuleCategoryView : FrameLayout {
dp15 = RxImageTool.dip2px(4f) dp15 = RxImageTool.dip2px(4f)
} }
fun initData(askCategoryDataBean: List<HomeHeaderBean.AskCategoryDataBean>?) { fun initData(askCategoryDataBean: List<HomeHeaderBean.CategoryGoldListDataBean>?) {
if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) { if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) {
visibility = View.GONE visibility = View.GONE
return return
...@@ -146,17 +147,16 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -146,17 +147,16 @@ class HomeModuleCategoryView : FrameLayout {
* 判断数据是否变化 * 判断数据是否变化
*/ */
private fun getChange( private fun getChange(
bean: List<HomeHeaderBean.AskCategoryDataBean>?, bean: List<HomeHeaderBean.CategoryGoldListDataBean>?,
cacheBean: List<HomeHeaderBean.AskCategoryDataBean>? cacheBean: List<HomeHeaderBean.CategoryGoldListDataBean>?
): Boolean { ): Boolean {
if (bean?.size != cacheBean?.size) { if (bean?.size != cacheBean?.size) {
return true return true
} }
for (index in 0 until bean?.size!!) { for (index in 0 until bean?.size!!) {
if (!bean[index].url.equals(cacheBean!![index].url) if (!bean[index].icon.equals(cacheBean!![index].icon)
|| !bean[index].coverUrl.equals(cacheBean!![index].coverUrl) || !bean[index].title.equals(cacheBean!![index].title)
|| !bean[index].cateTitle.equals(cacheBean!![index].cateTitle) || bean[index].id != cacheBean!![index].id
|| bean[index].cateId != cacheBean!![index].cateId
) { ) {
return true return true
} }
...@@ -282,8 +282,11 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -282,8 +282,11 @@ class HomeModuleCategoryView : FrameLayout {
/** /**
* 设置文本 * 设置文本
*/ */
private fun bindTextData(textView: TextView, categoryBean: HomeHeaderBean.AskCategoryDataBean) { private fun bindTextData(
textView.text = categoryBean.cateTitle textView: TextView,
categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) {
textView.text = categoryBean.title
} }
/** /**
...@@ -291,9 +294,9 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -291,9 +294,9 @@ class HomeModuleCategoryView : FrameLayout {
*/ */
private fun bindIconData( private fun bindIconData(
imageView: ImageView, imageView: ImageView,
categoryBean: HomeHeaderBean.AskCategoryDataBean categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) { ) {
GlideApp.with(context).load(categoryBean.coverUrl) GlideApp.with(context).load(categoryBean.icon)
.centerCrop().into(imageView) .centerCrop().into(imageView)
} }
} }
\ 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