Commit 3038c91f by 万齐军

feat: data class 修改

parent ffc414d4
package com.ydl.confide.home package com.ydl.confide.home
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.net.Uri import android.net.Uri
...@@ -34,7 +33,6 @@ import com.ydl.confide.home.modular.service.ConfideWebServiceImpl ...@@ -34,7 +33,6 @@ import com.ydl.confide.home.modular.service.ConfideWebServiceImpl
import com.ydl.confide.home.presenter.ConfideHomePresenterImpl import com.ydl.confide.home.presenter.ConfideHomePresenterImpl
import com.ydl.confide.home.util.ConfideHomeUtils import com.ydl.confide.home.util.ConfideHomeUtils
import com.ydl.confide.home.widget.FilterItemDecoration import com.ydl.confide.home.widget.FilterItemDecoration
import com.ydl.confide.intro.VideoViewModel
import com.ydl.confide.router.PhoneCallIn import com.ydl.confide.router.PhoneCallIn
import com.ydl.webview.H5Params import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity import com.ydl.webview.NewH5Activity
...@@ -131,8 +129,14 @@ class ConfideHomeActivity : ...@@ -131,8 +129,14 @@ class ConfideHomeActivity :
private fun initParam() { private fun initParam() {
allFiltersBean = ConfideHomeAllFiltersBean( allFiltersBean = ConfideHomeAllFiltersBean(
page, page,
ConfideHomeFiterItemBean("1", ""), ConfideHomeFiterItemBean().apply {
ConfideHomeFiterItemBean("-1", ""), id = "-1"
name = ""
},
ConfideHomeFiterItemBean().apply {
id = "-1"
name = ""
},
ArrayList(), ArrayList(),
ArrayList() ArrayList()
) )
......
...@@ -7,5 +7,7 @@ package com.ydl.confide.home.bean ...@@ -7,5 +7,7 @@ package com.ydl.confide.home.bean
* @Company 壹点灵 * @Company 壹点灵
* @date 2018/10/15 * @date 2018/10/15
*/ */
data class ConfideHomeBodyGroupItemBean(val title : String?, class ConfideHomeBodyGroupItemBean {
val data : ArrayList<ConfideHomeFiterItemBean>?) var title: String? = null
\ No newline at end of file var data: ArrayList<ConfideHomeFiterItemBean>? = null
}
\ No newline at end of file
...@@ -7,12 +7,14 @@ package com.ydl.confide.home.bean ...@@ -7,12 +7,14 @@ package com.ydl.confide.home.bean
* @Company 壹点灵 * @Company 壹点灵
* @date 2018/9/22 * @date 2018/9/22
*/ */
data class ConfideHomeFiterItemBean( class ConfideHomeFiterItemBean {
/** /**
* 筛选id * 筛选id
*/ */
var id : String?, var id: String? = null
/**
* 筛选名称 /**
*/ * 筛选名称
var name : String?) */
\ No newline at end of file var name: String? = null
}
\ No newline at end of file
...@@ -349,9 +349,9 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -349,9 +349,9 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
return return
} }
var sortPopup: ConfideHomeSortPopupWindow? = null var sortPopup: ConfideHomeSortPopupWindow? = null
if (bodyBean.group != null && !bodyBean.group.isEmpty() && null != bodyBean.group[0].data && !bodyBean.group[0].data!!.isEmpty()) { if (bodyBean.group != null && !bodyBean.group!!.isEmpty() && null != bodyBean.group!![0].data && !bodyBean.group!![0].data!!.isEmpty()) {
ConfideHomeUtils.synchroTextDrawable(mContext!!, 1, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter) ConfideHomeUtils.synchroTextDrawable(mContext!!, 1, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter)
sortPopup = ConfideHomeSortPopupWindow(mContext!!, bodyBean.group[0].data!!, allFiltersBean!!.selectSort!!, object : ConfideHomeSortPopupWindow.OnSortItemSelectedListener { sortPopup = ConfideHomeSortPopupWindow(mContext!!, bodyBean.group!![0].data!!, allFiltersBean!!.selectSort!!, object : ConfideHomeSortPopupWindow.OnSortItemSelectedListener {
override fun onSortItemSelected(sortItem: ConfideHomeFiterItemBean) { override fun onSortItemSelected(sortItem: ConfideHomeFiterItemBean) {
//更改小图标 //更改小图标
...@@ -384,17 +384,17 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -384,17 +384,17 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* @param mConfideAdapter section适配器 * @param mConfideAdapter section适配器
*/ */
override fun showSexAgePopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter) { override fun showSexAgePopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter) {
if (null == bodyBean || ((null == bodyBean.group || bodyBean.group.isEmpty()) && (null == bodyBean.group!![0].data || bodyBean.group[0].data!!.isEmpty()))) { if (null == bodyBean || ((null == bodyBean.group || bodyBean.group!!.isEmpty()) && (null == bodyBean.group!![0].data || bodyBean.group!![0].data!!.isEmpty()))) {
ToastUtil.toastShort( "数据初始化失败,请重新下拉刷新") ToastUtil.toastShort( "数据初始化失败,请重新下拉刷新")
return return
} }
val sexData = ArrayList<ConfideHomeFiterItemBean>() val sexData = ArrayList<ConfideHomeFiterItemBean>()
if (null != bodyBean.group[0].data) { if (null != bodyBean.group!![0].data) {
sexData.addAll(bodyBean.group[0].data!!) sexData.addAll(bodyBean.group!![0].data!!)
} }
val ageData = ArrayList<ConfideHomeFiterItemBean>() val ageData = ArrayList<ConfideHomeFiterItemBean>()
if (1 < bodyBean.group.size && null != bodyBean.group[1].data) { if (1 < bodyBean.group!!.size && null != bodyBean.group!![1].data) {
ageData.addAll(bodyBean.group[1].data!!) ageData.addAll(bodyBean.group!![1].data!!)
} }
val categoryPopup = ConfideHomeSexAgePopupWindow(mContext!!, sexData, ageData, allFiltersBean) val categoryPopup = ConfideHomeSexAgePopupWindow(mContext!!, sexData, ageData, allFiltersBean)
ConfideHomeUtils.synchroStyle(mContext!!, 2, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter) ConfideHomeUtils.synchroStyle(mContext!!, 2, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter)
...@@ -435,8 +435,8 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -435,8 +435,8 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* @param mConfideAdapter section适配器 * @param mConfideAdapter section适配器
*/ */
override fun showGoodPopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter) { override fun showGoodPopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter) {
if (bodyBean != null && null != bodyBean.group && !bodyBean.group.isEmpty() && null != bodyBean.group[0].data && !bodyBean.group[0].data!!.isEmpty()) { if (bodyBean != null && null != bodyBean.group && !bodyBean.group!!.isEmpty() && null != bodyBean.group!![0].data && !bodyBean.group!![0].data!!.isEmpty()) {
val categoryPopup = ConfideHomeGoodPopupWindow(mContext!!, bodyBean.group[0].data!!, allFiltersBean.selectGoodData!!) val categoryPopup = ConfideHomeGoodPopupWindow(mContext!!, bodyBean.group!![0].data!!, allFiltersBean.selectGoodData!!)
ConfideHomeUtils.synchroStyle(mContext!!, 3, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter) ConfideHomeUtils.synchroStyle(mContext!!, 3, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter)
categoryPopup!!.setOnDismissListener { categoryPopup!!.setOnDismissListener {
if (allFiltersBean.selectGoodData!!.size > 1 || (allFiltersBean.selectGoodData!!.size == 1 && allFiltersBean!!.selectGoodData!![0] != bodyBean.group!![0].data!![0])) { if (allFiltersBean.selectGoodData!!.size > 1 || (allFiltersBean.selectGoodData!!.size == 1 && allFiltersBean!!.selectGoodData!![0] != bodyBean.group!![0].data!![0])) {
......
...@@ -2,14 +2,14 @@ package com.ydl.confide.home.popwindow ...@@ -2,14 +2,14 @@ package com.ydl.confide.home.popwindow
import android.content.Context import android.content.Context
import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.BitmapDrawable
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.PopupWindow import android.widget.PopupWindow
import android.widget.TextView import android.widget.TextView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.R import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
...@@ -65,7 +65,10 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH ...@@ -65,7 +65,10 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH
dismiss() dismiss()
} }
view.btnReset.setOnClickListener { view.btnReset.setOnClickListener {
selectSex = ConfideHomeFiterItemBean("-1","") selectSex = ConfideHomeFiterItemBean().apply {
id = "-1"
name = ""
}
mAllFiltersBean!!.selectSex = selectSex mAllFiltersBean!!.selectSex = selectSex
initSexData(view,mAllFiltersBean!!) initSexData(view,mAllFiltersBean!!)
sexAgeAdapter?.cleanSelectedGoods() sexAgeAdapter?.cleanSelectedGoods()
...@@ -81,7 +84,8 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH ...@@ -81,7 +84,8 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH
private fun initData(sexData: ArrayList<ConfideHomeFiterItemBean>,ageData : ArrayList<ConfideHomeFiterItemBean>,allFiltersBean: ConfideHomeAllFiltersBean){ private fun initData(sexData: ArrayList<ConfideHomeFiterItemBean>,ageData : ArrayList<ConfideHomeFiterItemBean>,allFiltersBean: ConfideHomeAllFiltersBean){
//初始化已选择性别数据 //初始化已选择性别数据
if (null == selectSex){ if (null == selectSex){
selectSex = ConfideHomeFiterItemBean("-1","") selectSex = ConfideHomeFiterItemBean().apply { id="-1"
name=""}
} }
if (null != allFiltersBean.selectSex){ if (null != allFiltersBean.selectSex){
selectSex!!.id = allFiltersBean.selectSex!!.id selectSex!!.id = allFiltersBean.selectSex!!.id
......
...@@ -202,11 +202,11 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH ...@@ -202,11 +202,11 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH
*/ */
private fun setConfideTag(bodyBean: ConfideHomeBodyBean) { private fun setConfideTag(bodyBean: ConfideHomeBodyBean) {
flowlayout_tag.removeAllViews() flowlayout_tag.removeAllViews()
if (null == bodyBean.confidedTag || bodyBean.confidedTag.isEmpty()) { if (null == bodyBean.confidedTag || bodyBean.confidedTag!!.isEmpty()) {
return return
} }
var i = 0 var i = 0
for (tag in bodyBean.confidedTag) { for (tag in bodyBean.confidedTag!!) {
if (i > 4) break if (i > 4) break
var params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dp16) var params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dp16)
params.setMargins(0, 0, dp4, 0) params.setMargins(0, 0, dp4, 0)
......
...@@ -242,12 +242,12 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con ...@@ -242,12 +242,12 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
// } // }
private fun setConfideTag(bodyBean: ConfideHomeBodyBean) { private fun setConfideTag(bodyBean: ConfideHomeBodyBean) {
if (null == bodyBean.confidedTag || bodyBean.confidedTag.isEmpty()) { if (null == bodyBean.confidedTag || bodyBean.confidedTag!!.isEmpty()) {
return return
} }
var i = 0 var i = 0
val sb = StringBuilder() val sb = StringBuilder()
for (tag in bodyBean.confidedTag) { for (tag in bodyBean.confidedTag!!) {
if (i > 4) break if (i > 4) break
sb.append(tag).append(" | ") sb.append(tag).append(" | ")
i++ i++
......
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