Commit f1271f4c by 霍志良

feat:金刚位全部分类页跳转

parent 6328d9be
...@@ -7,17 +7,22 @@ ...@@ -7,17 +7,22 @@
android:name=".ExpertSearchActivity" android:name=".ExpertSearchActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/consultant_NoTitleTheme"/> android:theme="@style/consultant_NoTitleTheme" />
<activity
android:name=".ExpertEightCategoryActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/consultant_NoTitleTheme" />
<activity <activity
android:name=".HotSearchActivity" android:name=".HotSearchActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/consultant_NoTitleTheme"/> android:theme="@style/consultant_NoTitleTheme" />
<activity <activity
android:name=".ConsultAssistantCenterActivity" android:name=".ConsultAssistantCenterActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/consultant_Transparent"/> android:theme="@style/consultant_Transparent" />
<activity android:name=".preview.GridPreviewActivity" <activity android:name=".preview.GridPreviewActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
......
package com.yidianling.consultant
import android.annotation.SuppressLint
import android.view.WindowManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.model.bean.ChildrenBean
import com.yidianling.consultant.router.ConsultantIn
import com.yidianling.consultant.ui.view.topView.EightCategoryView
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.consultant_layout_eight_category.*
import kotlinx.android.synthetic.main.consultant_layout_search_toolbar.*
@Route(path = "/consult/eightcategory")
class ExpertEightCategoryActivity : BaseActivity() {
override fun layoutResId(): Int {
return R.layout.consultant_layout_eight_category
}
@SuppressLint("CheckResult")
override fun initDataAndEvent() {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE or WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
showProgressDialog()
SearchApi.getSearchApi()
.searchEightCategoryHotWord()
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
dismissProgressDialog()
var mutableList = mutableListOf<MutableList<ChildrenBean>>()
resp.forEach {
it.children?.let { it1 -> mutableList.add(it1) }
}
mutableList.forEachIndexed { index, item ->
item.forEachIndexed { inin, childrenBean ->
if (inin < 8) {
childrenBean.isVisible = true
}
if (inin == 8) {
return@forEachIndexed
}
}
}
val eightCategoryView = EightCategoryView(this, true)
eightCategoryView.setData(mutableList, null, null, true)
eight_view_ll.addView(eightCategoryView)
}, { t ->
dismissProgressDialog()
})
btn_back.setOnClickListener {
onBackPressed()
}
btn_call.setOnClickListener {
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_ONLINE_CUSTOMER_CLICK)
ConsultantIn.startP2PXiaoYi(this)
}
tv_guide.setOnClickListener {
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_CONSULT_GUIDE_CLICK)
val h5param = H5Params(HttpConfig.H5_URL + "help/consultation/", "咨询指南")
h5param.isShowMenu = true
NewH5Activity.start(this, h5param)
}
rl_search.setOnClickListener {
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.YDL_USER_CONSULT_SEARCH_CLICK,
tv_search_content.hint.toString()
)
ARouter.getInstance()
.build("/consult/hot_search")
.withString(
ExpertSearchActivity.HOT_SEARCH_DOCTOR_NAME,
tv_search_content.text.toString()
)
.navigation()
}
}
}
\ No newline at end of file
...@@ -83,6 +83,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -83,6 +83,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private var locationRegionItem: RegionItem? = null private var locationRegionItem: RegionItem? = null
private var locationList: ArrayList<SubItem>? = arrayListOf() private var locationList: ArrayList<SubItem>? = arrayListOf()
private var locationHistoryList: ArrayList<RegionItem>? = arrayListOf() private var locationHistoryList: ArrayList<RegionItem>? = arrayListOf()
private lateinit var eightcategoryPopup: EightCategoryPopupWindow
override fun showImage(url: String?, imgView: ImageView) { override fun showImage(url: String?, imgView: ImageView) {
YDLImageCacheManager.showImage(ExpertSearchActivity@ this, url, imgView) YDLImageCacheManager.showImage(ExpertSearchActivity@ this, url, imgView)
} }
...@@ -213,6 +215,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -213,6 +215,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private val doctorList = ArrayList<ExpertServiceItem>() private val doctorList = ArrayList<ExpertServiceItem>()
private var hasMore = true private var hasMore = true
private var initCategory = "0" private var initCategory = "0"
private var initCategoryCateid3 = "0"
private var initShowType: Int = 1 private var initShowType: Int = 1
var mapFilter: Map<String, Any>? = null var mapFilter: Map<String, Any>? = null
...@@ -411,6 +414,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -411,6 +414,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
mapFilter = mIntent.getSerializableExtra(GO_CRITERIA) as HashMap<String, Any> mapFilter = mIntent.getSerializableExtra(GO_CRITERIA) as HashMap<String, Any>
} }
initCategory = mIntent.getStringExtra("cateId") ?: "" initCategory = mIntent.getStringExtra("cateId") ?: ""
initCategoryCateid3 = mIntent.getStringExtra("cateid3in") ?: ""
if (!TextUtils.isEmpty(initCategoryCateid3) && initCategoryCateid3 != "0") {
allFilter.categoryId3List.add(initCategoryCateid3)
}
if (mIntent.getStringExtra("cateTitle") != null) { if (mIntent.getStringExtra("cateTitle") != null) {
cateName = mIntent.getStringExtra("cateTitle") cateName = mIntent.getStringExtra("cateTitle")
} }
...@@ -1025,7 +1032,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1025,7 +1032,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
hideSoftInput() hideSoftInput()
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showSubjectPopupWindow() // showSubjectPopupWindow()
showeightCategoryPopupWindow()
}, 300) }, 300)
} }
...@@ -1665,6 +1673,22 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1665,6 +1673,22 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
/** /**
* 显示八大类弹窗
*/
private fun showeightCategoryPopupWindow() {
eightcategoryPopup = EightCategoryPopupWindow(this, allFilter)
eightcategoryPopup.setListener(this)
eightcategoryPopup.setOnDismissListener {
viewDim.visibility = View.INVISIBLE
ConsultAssistantDialogUtils.INSTANCE.fitRequest(this, "doctor_list", true)
}
ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity()
eightcategoryPopup.showAsDropDown(viewSep2)
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
viewDim.visibility = View.VISIBLE
}
/**
* 主题选择确认回调 * 主题选择确认回调
* *
* 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态 * 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态
......
...@@ -45,6 +45,13 @@ class CategoryDetailAdapter( ...@@ -45,6 +45,13 @@ class CategoryDetailAdapter(
outAdapterClicklistener.outAdapterClick(position, textPosition) outAdapterClicklistener.outAdapterClick(position, textPosition)
} }
}) })
if (categoryDetailList[position].size > 9) {
holder.collapse_hide.visibility = View.VISIBLE
holder.arrow_collapse_hide.visibility = View.VISIBLE
} else {
holder.collapse_hide.visibility = View.GONE
holder.arrow_collapse_hide.visibility = View.GONE
}
if (categoryNamelList[position].collapse) { if (categoryNamelList[position].collapse) {
eightCategoryAdapter.setAllVisible() eightCategoryAdapter.setAllVisible()
holder.collapse_hide.text = "收起" holder.collapse_hide.text = "收起"
......
...@@ -86,9 +86,6 @@ class CategoryDetailTextAdapter( ...@@ -86,9 +86,6 @@ class CategoryDetailTextAdapter(
this.textAdapterOnclickListener = adapterOnclickListener this.textAdapterOnclickListener = adapterOnclickListener
} }
/**
* 设置大于第12个之后的标签全部显示
*/
fun setAllVisible() { fun setAllVisible() {
categoryDetailList.forEach { bean -> categoryDetailList.forEach { bean ->
bean.isVisible = true bean.isVisible = true
...@@ -97,12 +94,9 @@ class CategoryDetailTextAdapter( ...@@ -97,12 +94,9 @@ class CategoryDetailTextAdapter(
isVisible = true isVisible = true
} }
/**
* 设置大于第12个之后的标签全部隐藏
*/
fun setGone() { fun setGone() {
categoryDetailList.forEachIndexed { index, bean -> categoryDetailList.forEachIndexed { index, bean ->
if (index > 12) { if (index > 8) {
bean.isVisible = false bean.isVisible = false
} }
} }
......
package com.yidianling.consultant.adapter package com.yidianling.consultant.adapter
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater import android.view.LayoutInflater
...@@ -16,6 +17,7 @@ import kotlinx.android.synthetic.main.eight_category_list_item.view.* ...@@ -16,6 +17,7 @@ import kotlinx.android.synthetic.main.eight_category_list_item.view.*
class EightCategoryAdapter( class EightCategoryAdapter(
private val context: Context, private val context: Context,
private val eightCateList: MutableList<EightCategoryBean>, private val eightCateList: MutableList<EightCategoryBean>,
private val singleMultiple: Boolean
) : RecyclerView.Adapter<EightCategoryAdapter.ViewHolder>() { ) : RecyclerView.Adapter<EightCategoryAdapter.ViewHolder>() {
lateinit var onLeftClickListener: OnLeftClickListener lateinit var onLeftClickListener: OnLeftClickListener
override fun getItemCount(): Int = eightCateList.size override fun getItemCount(): Int = eightCateList.size
...@@ -26,15 +28,35 @@ class EightCategoryAdapter( ...@@ -26,15 +28,35 @@ class EightCategoryAdapter(
return ViewHolder(itemView) return ViewHolder(itemView)
} }
override fun onBindViewHolder(holder: ViewHolder, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.eight_name.text = eightCateList[position].string holder.eight_name.text = eightCateList[position].string
holder.itemView.setOnClickListener { holder.itemView.setOnClickListener {
onLeftClickListener.onLeftClick(position) onLeftClickListener.onLeftClick(position)
} }
if (eightCateList[position].selected) { if (eightCateList[position].selected) {
holder.itemView.setBackgroundColor(ContextCompat.getColor(context, R.color.white)) holder.itemView.setBackgroundColor(ContextCompat.getColor(context, R.color.white))
holder.eight_name.setTextColor(
ContextCompat.getColor(
context,
R.color.platform_main_theme
)
)
if (singleMultiple) {
holder.single_selected_tag.visibility = View.VISIBLE
} else { } else {
holder.single_selected_tag.visibility = View.INVISIBLE
}
} else {
holder.eight_name.setTextColor(
ContextCompat.getColor(
context,
R.color.platform_color_242424
)
)
holder.single_selected_tag.visibility = View.INVISIBLE
holder.itemView.setBackgroundColor( holder.itemView.setBackgroundColor(
ContextCompat.getColor( ContextCompat.getColor(
context, context,
...@@ -45,7 +67,7 @@ class EightCategoryAdapter( ...@@ -45,7 +67,7 @@ class EightCategoryAdapter(
if (eightCateList[position].hasData) { if (eightCateList[position].hasData) {
holder.multiple_choise.visibility = View.VISIBLE holder.multiple_choise.visibility = View.VISIBLE
} else { } else {
holder.multiple_choise.visibility = View.GONE holder.multiple_choise.visibility = View.INVISIBLE
} }
} }
...@@ -61,6 +83,7 @@ class EightCategoryAdapter( ...@@ -61,6 +83,7 @@ class EightCategoryAdapter(
val eight_name = itemView.eight_name val eight_name = itemView.eight_name
val multiple_choise = itemView.multiple_choise val multiple_choise = itemView.multiple_choise
val single_selected_tag = itemView.single_selected_tag
} }
} }
\ No newline at end of file
...@@ -7,10 +7,7 @@ import com.ydl.ydlcommon.data.http.BaseAPIResponse ...@@ -7,10 +7,7 @@ import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.consultant.bean.* import com.yidianling.consultant.bean.*
import com.yidianling.consultant.model.bean.ExpertBean import com.yidianling.consultant.model.bean.*
import com.yidianling.consultant.model.bean.FunctionWordBean
import com.yidianling.consultant.model.bean.HeadData
import com.yidianling.consultant.model.bean.PromptPaymentBean
import io.reactivex.Observable import io.reactivex.Observable
import retrofit2.http.* import retrofit2.http.*
...@@ -42,6 +39,11 @@ interface SearchApi { ...@@ -42,6 +39,11 @@ interface SearchApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA) @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun searchConditions(@Query("cateSource") cateSource: Int): Observable<BaseAPIResponse<HeadData>> fun searchConditions(@Query("cateSource") cateSource: Int): Observable<BaseAPIResponse<HeadData>>
//查询八大类目包括
@GET("consult/search/v3/mix-cates")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun searchEightCategoryHotWord(): Observable<BaseAPIResponse<MutableList<CateItem>>>
//查询功能词、底纹词 //查询功能词、底纹词
//(1热门词,2底纹词,3跳转词) //(1热门词,2底纹词,3跳转词)
@POST("function/word/queryList") @POST("function/word/queryList")
......
...@@ -51,8 +51,8 @@ class EightCategoryPopupWindow(context: Context, allFilter: AllFilter) : ...@@ -51,8 +51,8 @@ class EightCategoryPopupWindow(context: Context, allFilter: AllFilter) :
fun setListener(onSubjectsSelectedListener: OnCategoriesSelectedListener) { fun setListener(onSubjectsSelectedListener: OnCategoriesSelectedListener) {
this.onSubjectsSelectedListener = onSubjectsSelectedListener this.onSubjectsSelectedListener = onSubjectsSelectedListener
val eightCategoryView = EightCategoryView(context) val eightCategoryView = EightCategoryView(context, false)
eightCategoryView.setData(mutableList, mAllFilter, onSubjectsSelectedListener) eightCategoryView.setData(mutableList, mAllFilter, onSubjectsSelectedListener, false)
view.eight_category_fl.addView(eightCategoryView) view.eight_category_fl.addView(eightCategoryView)
} }
......
package com.yidianling.consultant.ui.view.topView package com.yidianling.consultant.ui.view.topView
import android.app.Activity
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.util.Log
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSmoothScroller
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.yidianling.common.tools.LogUtil import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.R import com.yidianling.consultant.R
import com.yidianling.consultant.adapter.CategoryDetailAdapter import com.yidianling.consultant.adapter.CategoryDetailAdapter
...@@ -25,28 +28,37 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis ...@@ -25,28 +28,37 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
EightCategoryAdapter.OnLeftClickListener { EightCategoryAdapter.OnLeftClickListener {
constructor(context: Context) : super(context) { constructor(context: Context, singleMultiple: Boolean) : super(context) {
mContext = context mContext = context
initView() initView(singleMultiple)
} }
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { constructor(context: Context, attrs: AttributeSet, singleMultiple: Boolean) : super(
context,
attrs
) {
mContext = context mContext = context
initView() initView(singleMultiple)
} }
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super( constructor(
context: Context,
attrs: AttributeSet,
defStyle: Int,
singleMultiple: Boolean
) : super(
context, context,
attrs, attrs,
defStyle defStyle
) { ) {
mContext = context mContext = context
initView() initView(singleMultiple)
} }
private var mContext: Context? = null private var mContext: Context? = null
private var mutableList: MutableList<MutableList<ChildrenBean>>? = null private var mutableList: MutableList<MutableList<ChildrenBean>>? = null
private lateinit var mAllfilter: AllFilter private lateinit var mAllfilter: AllFilter
private var singleMultiple: Boolean = false
private var eightCategoryListBean = mutableListOf( private var eightCategoryListBean = mutableListOf(
EightCategoryBean("亲子教育", false, false, false), EightCategoryBean("亲子教育", false, false, false),
EightCategoryBean("情绪压力", false, false, false), EightCategoryBean("情绪压力", false, false, false),
...@@ -62,13 +74,24 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis ...@@ -62,13 +74,24 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
private val signList = ArrayList<String>() // 用于埋点 private val signList = ArrayList<String>() // 用于埋点
var onSubjectsSelectedListener: OnCategoriesSelectedListener? = null var onSubjectsSelectedListener: OnCategoriesSelectedListener? = null
var isDrag = false var isDrag = false
private fun initView() { var leftmanager: LinearLayoutManager = LinearLayoutManager(context)
private fun initView(singleMultiple: Boolean) {
View.inflate(mContext, R.layout.consultant_layout_category_view, this)
if (singleMultiple) {
layoutParams = LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
} else {
layoutParams = LayoutParams( layoutParams = LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
RxImageTool.dp2px(466f) RxImageTool.dp2px(466f)
) )
ll_view.layoutParams = LinearLayout.LayoutParams(
View.inflate(mContext, R.layout.consultant_layout_category_view, this) LinearLayout.LayoutParams.MATCH_PARENT,
RxImageTool.dp2px(400f)
)
}
// 重置 // 重置
btn_reset.setOnClickListener { btn_reset.setOnClickListener {
reset() reset()
...@@ -76,7 +99,6 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis ...@@ -76,7 +99,6 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
// 确定 // 确定
btnConfirm.setOnClickListener { btnConfirm.setOnClickListener {
onSubjectsSelectedListener?.onCategoriesSelected(signList) onSubjectsSelectedListener?.onCategoriesSelected(signList)
} }
} }
...@@ -95,20 +117,27 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis ...@@ -95,20 +117,27 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
fun setData( fun setData(
mutableList: MutableList<MutableList<ChildrenBean>>, mutableList: MutableList<MutableList<ChildrenBean>>,
mAllFilter: AllFilter, mAllFilter: AllFilter?,
onSubjectsSelectedListener: OnCategoriesSelectedListener onSubjectsSelectedListener: OnCategoriesSelectedListener?,
singleMultiple: Boolean
) { ) {
this.mutableList = mutableList this.mutableList = mutableList
this.mAllfilter = mAllFilter mAllFilter?.let { this.mAllfilter = it }
if (singleMultiple) {
eightCategoryListBean.add(0, EightCategoryBean("热门推荐", false, false, false))
}
this.onSubjectsSelectedListener = onSubjectsSelectedListener this.onSubjectsSelectedListener = onSubjectsSelectedListener
eightCategoryAdapter = mContext?.let { EightCategoryAdapter(it, eightCategoryListBean) }!! this.singleMultiple = singleMultiple
ComputeSelected(mutableList, mAllFilter)
eightCategoryAdapter =
mContext?.let { EightCategoryAdapter(it, eightCategoryListBean, singleMultiple) }!!
eightCategoryAdapter.setleftClick(this) eightCategoryAdapter.setleftClick(this)
eight_category.layoutManager = LinearLayoutManager(mContext) eight_category.layoutManager = LinearLayoutManager(mContext)
eight_category.adapter = eightCategoryAdapter eight_category.adapter = eightCategoryAdapter
categoryRightAdapter = CategoryDetailAdapter(mContext!!, mutableList, eightCategoryListBean) categoryRightAdapter = CategoryDetailAdapter(mContext!!, mutableList, eightCategoryListBean)
val manager = LinearLayoutManager(mContext) leftmanager = LinearLayoutManager(mContext)
category_detail.layoutManager = manager category_detail.layoutManager = leftmanager
category_detail.adapter = categoryRightAdapter category_detail.adapter = categoryRightAdapter
categoryRightAdapter.setOutClicklistener(this) categoryRightAdapter.setOutClicklistener(this)
category_detail.setOnScrollListener(object : RecyclerView.OnScrollListener() { category_detail.setOnScrollListener(object : RecyclerView.OnScrollListener() {
...@@ -122,7 +151,7 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis ...@@ -122,7 +151,7 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
if (!isDrag) { if (!isDrag) {
var firstVisibleItem: Int = manager.findFirstVisibleItemPosition() var firstVisibleItem: Int = leftmanager.findFirstVisibleItemPosition()
eightCategoryListBean.forEachIndexed { index, eightCategoryBean -> eightCategoryListBean.forEachIndexed { index, eightCategoryBean ->
eightCategoryListBean[index].selected = index == firstVisibleItem eightCategoryListBean[index].selected = index == firstVisibleItem
} }
...@@ -132,12 +161,30 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis ...@@ -132,12 +161,30 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
}) })
} }
private fun ComputeSelected(
mutableList: MutableList<MutableList<ChildrenBean>>,
mAllFilter: AllFilter?
) {
mutableList.forEachIndexed { index, mutable ->
mutable.forEachIndexed { indexin, childrenBean ->
if (mAllFilter?.categoryId3List?.contains(childrenBean.cate_id) == true) {
childrenBean.isSelected = true
eightCategoryListBean.get(index).hasData = true
return@ComputeSelected
}
}
}
}
override fun outAdapterClick(outPosition: Int, inPosition: Int) { override fun outAdapterClick(outPosition: Int, inPosition: Int) {
//之前的老数据多选分类页。 //之前的老数据多选分类页。
if (!singleMultiple) {
if (inPosition == 0) { if (inPosition == 0) {
if (mutableList?.get(outPosition)?.get(0)?.isSelected!!) { if (mutableList?.get(outPosition)?.get(0)?.isSelected!!) {
mutableList?.get(outPosition)?.get(0)?.isSelected = false mutableList?.get(outPosition)?.get(0)?.isSelected = false
mAllfilter.categoryId2List.remove(mutableList?.get(outPosition)?.get(0)?.cate_id) mAllfilter.categoryId2List.remove(
mutableList?.get(outPosition)?.get(0)?.cate_id
)
signList.remove(eightCategoryListBean[outPosition].string) signList.remove(eightCategoryListBean[outPosition].string)
} else { } else {
mutableList?.get(outPosition)?.forEachIndexed { index, _ -> mutableList?.get(outPosition)?.forEachIndexed { index, _ ->
...@@ -158,12 +205,15 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis ...@@ -158,12 +205,15 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
} }
} }
} else { } else {
if (!mutableList?.get(outPosition)?.get(inPosition)?.isSelected!! && mutableList?.get( if (!mutableList?.get(outPosition)
?.get(inPosition)?.isSelected!! && mutableList?.get(
outPosition outPosition
)?.get(0)?.isSelected!! )?.get(0)?.isSelected!!
) { ) {
mutableList?.get(outPosition)?.get(0)?.isSelected = false mutableList?.get(outPosition)?.get(0)?.isSelected = false
mAllfilter.categoryId2List.remove(mutableList?.get(outPosition)?.get(0)?.cate_id) mAllfilter.categoryId2List.remove(
mutableList?.get(outPosition)?.get(0)?.cate_id
)
signList.remove(eightCategoryListBean[outPosition].string) signList.remove(eightCategoryListBean[outPosition].string)
} }
mutableList?.get(outPosition)?.get(inPosition)?.isSelected = mutableList?.get(outPosition)?.get(inPosition)?.isSelected =
...@@ -174,7 +224,8 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis ...@@ -174,7 +224,8 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
it it
) )
} }
mutableList?.get(outPosition)?.get(inPosition)?.cate_name?.let { signList.add(it) } mutableList?.get(outPosition)
?.get(inPosition)?.cate_name?.let { signList.add(it) }
} else { } else {
mAllfilter.categoryId3List.remove( mAllfilter.categoryId3List.remove(
mutableList?.get(outPosition)?.get(inPosition)?.cate_id mutableList?.get(outPosition)?.get(inPosition)?.cate_id
...@@ -193,6 +244,20 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis ...@@ -193,6 +244,20 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
} }
eightCategoryAdapter.notifyDataSetChanged() eightCategoryAdapter.notifyDataSetChanged()
categoryRightAdapter.notifyDataSetChanged() categoryRightAdapter.notifyDataSetChanged()
} else {
//单选跳转咨询列表页
ARouter.getInstance().build("/consult/list")
.withInt(IYDLRouterConstant.EXTRA_SHOWTYPE, 0)
.withString("cateid3in", mutableList?.get(outPosition)?.get(inPosition)?.cate_id)
.withString(
IYDLRouterConstant.EXTRA_CATETITLE,
mutableList?.get(outPosition)?.get(inPosition)?.cate_name
)
.navigation()
(context as BaseActivity).finish()
}
} }
override fun onLeftClick(leftPosition: Int) { override fun onLeftClick(leftPosition: Int) {
...@@ -201,6 +266,8 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis ...@@ -201,6 +266,8 @@ class EightCategoryView : LinearLayout, CategoryDetailAdapter.OutAdapterClicklis
} }
eightCategoryAdapter.notifyDataSetChanged() eightCategoryAdapter.notifyDataSetChanged()
isDrag = true isDrag = true
category_detail.scrollToPosition(leftPosition) val smoothScroller: LinearSmoothScroller = LinearTopSmoothScroller(context)
smoothScroller.targetPosition = leftPosition
leftmanager.startSmoothScroll(smoothScroller)
} }
} }
\ No newline at end of file
package com.yidianling.consultant.ui.view.topView
import android.content.Context
import androidx.recyclerview.widget.LinearSmoothScroller
class LinearTopSmoothScroller(context: Context?) : LinearSmoothScroller(context) {
override fun getVerticalSnapPreference(): Int {
return SNAP_TO_START
}
}
\ No newline at end of file
...@@ -8,18 +8,19 @@ ...@@ -8,18 +8,19 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="400dp"> android:id="@+id/ll_view"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/eight_category" android:id="@+id/eight_category"
android:layout_width="90dp" android:layout_width="90dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"></androidx.recyclerview.widget.RecyclerView> android:orientation="vertical" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/category_detail" android:id="@+id/category_detail"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"></androidx.recyclerview.widget.RecyclerView> android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
layout="@layout/consultant_layout_search_toolbar"
android:layout_width="match_parent"
android:layout_height="48dp" />
<LinearLayout
android:id="@+id/eight_view_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<View <View
android:id="@+id/single_selected_tag" android:id="@+id/single_selected_tag"
android:layout_width="3dp" android:layout_width="3dp"
android:layout_height="@dimen/platform_dp_20" android:layout_height="@dimen/platform_dp_15"
android:background="@color/platform_main_theme" android:background="@color/platform_main_theme"
android:visibility="gone"></View> android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/multiple_choise" android:id="@+id/multiple_choise"
...@@ -19,6 +23,9 @@ ...@@ -19,6 +23,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/alert_selected" android:background="@drawable/alert_selected"
android:backgroundTint="@color/platform_main_theme" android:backgroundTint="@color/platform_main_theme"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:visibility="gone"> android:visibility="gone">
</ImageView> </ImageView>
...@@ -31,8 +38,12 @@ ...@@ -31,8 +38,12 @@
android:layout_marginTop="@dimen/platform_dp_15" android:layout_marginTop="@dimen/platform_dp_15"
android:layout_marginBottom="@dimen/platform_dp_15" android:layout_marginBottom="@dimen/platform_dp_15"
android:textColor="@color/color_242424" android:textColor="@color/color_242424"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14"
tools:text="情绪压力"> tools:text="情绪压力">
</TextView> </TextView>
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file \ No newline at end of file
...@@ -271,11 +271,15 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -271,11 +271,15 @@ open class HomeBaseImpl : IHomeBaseEvent {
} else if (data.goType.equals("h5")) { } else if (data.goType.equals("h5")) {
NewH5Activity.start(mContext, H5Params(data.goUrl.toString(), "")) NewH5Activity.start(mContext, H5Params(data.goUrl.toString(), ""))
} else if (data.goType.equals("special_categories")) { } else if (data.goType.equals("special_categories")) {
ARouter.getInstance().build("/consult/list") //全部
.withInt(IYDLRouterConstant.EXTRA_SHOWTYPE, 0) ARouter.getInstance().build("/consult/eightcategory")
.withString(IYDLRouterConstant.EXTRA_CATETITLE, data.title)
.withSerializable(IYDLRouterConstant.GO_CRITERIA, data.goCriteriaMap)
.navigation() .navigation()
// ARouter.getInstance().build("/consult/list")
// .withInt(IYDLRouterConstant.EXTRA_SHOWTYPE, 0)
// .withString(IYDLRouterConstant.EXTRA_CATETITLE, data.title)
// .withSerializable(IYDLRouterConstant.GO_CRITERIA, data.goCriteriaMap)
// .navigation()
} else { } else {
ARouter.getInstance().build("/consult/list") ARouter.getInstance().build("/consult/list")
.withInt(IYDLRouterConstant.EXTRA_SHOWTYPE, 0) .withInt(IYDLRouterConstant.EXTRA_SHOWTYPE, 0)
......
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