Commit 37a9a364 by upwork.021

feat: 排序接口以及逻辑修改代码提交

parent e4ed1517
...@@ -6,7 +6,7 @@ ext { ...@@ -6,7 +6,7 @@ ext {
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.72", "m-confide" : "0.0.49.72",
"m-consultant" : "0.0.60.21", "m-consultant" : "0.0.60.26",
"m-fm" : "0.0.30.08", "m-fm" : "0.0.30.08",
"m-user" : "0.0.62.04", "m-user" : "0.0.62.04",
"m-home" : "0.0.23.44", "m-home" : "0.0.23.44",
......
...@@ -9,6 +9,7 @@ import android.content.Context ...@@ -9,6 +9,7 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.graphics.Typeface import android.graphics.Typeface
import android.os.Build import android.os.Build
import android.os.Handler
import android.text.TextUtils import android.text.TextUtils
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
...@@ -276,10 +277,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -276,10 +277,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
override fun onScrollTop() { override fun onScrollTop() {
var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f) val alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f) val scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f)
var scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f) val scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f)
var animator = val animator =
ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY) ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY)
.setDuration(200) .setDuration(200)
animator.addListener(object : AnimatorListenerAdapter() { animator.addListener(object : AnimatorListenerAdapter() {
...@@ -295,10 +296,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -295,10 +296,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
if (isBtnShow) { if (isBtnShow) {
return return
} }
var alpha = PropertyValuesHolder.ofFloat("alpha", 0f, 1f) val alpha = PropertyValuesHolder.ofFloat("alpha", 0f, 1f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 1f) val scaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 1f)
var scaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 1f) val scaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 1f)
var animator = val animator =
ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY) ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY)
.setDuration(200) .setDuration(200)
animator.addListener(object : AnimatorListenerAdapter() { animator.addListener(object : AnimatorListenerAdapter() {
...@@ -314,10 +315,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -314,10 +315,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
if (!isBtnShow) { if (!isBtnShow) {
return return
} }
var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f) val alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f) val scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f)
var scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f) val scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f)
var animator = val animator =
ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY) ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY)
.setDuration(200) .setDuration(200)
animator.addListener(object : AnimatorListenerAdapter() { animator.addListener(object : AnimatorListenerAdapter() {
...@@ -391,14 +392,15 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -391,14 +392,15 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
tv_search_content.text = mIntent.getStringExtra(EXTRA_SEARCH_WORD) tv_search_content.text = mIntent.getStringExtra(EXTRA_SEARCH_WORD)
keyWord = mIntent.getStringExtra(EXTRA_CATEGORY_NAME) ?: "" keyWord = mIntent.getStringExtra(EXTRA_CATEGORY_NAME) ?: ""
getRouterParam() getRouterParam()
allFilter.showType.key = initShowType allFilter.showType.key = initShowType
val cat = CateItem() allFilter.categoryId2List.add(initCategory)
cat.cateId = initCategory if (!TextUtils.isEmpty(keyWord)){
allFilter.categories.clear() tvSubject.text = keyWord
allFilter.categories.add(cat) updateFilterTextViewStatus(tvSubject,FILTER_STATUS_FILTERED)
}
getPresenter().fetchListHead() getPresenter().fetchListHead()
//加载本地缓存数据
// getPresenter().localData(initShowType)
refresh(false) refresh(false)
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
...@@ -412,19 +414,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -412,19 +414,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
initData(intent!!) initData(intent!!)
} }
/**
* 初始化状态栏位置
*/
private fun initStatus() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//4.4以下不支持状态栏变色
StatusBarUtils.setTransparentForImageView(this, null)
val statusBarHeight = StatusBarUtils.getStatusBarHeight(this)
val lp1 = title_layout.layoutParams as LinearLayout.LayoutParams
lp1.height = (RxImageTool.dp2px(48f) + statusBarHeight)
title_layout.setPadding(0, statusBarHeight, 0, 0)
}
}
//返回键处理,热门搜索如果可见,则隐藏,来自启动页,则打开主界面 //返回键处理,热门搜索如果可见,则隐藏,来自启动页,则打开主界面
override fun onBackPressed() { override fun onBackPressed() {
...@@ -439,34 +428,53 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -439,34 +428,53 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onHeadFetched(headData: HeadData?) { override fun onHeadFetched(headData: HeadData?) {
//头部数据获取到后初始化筛选数据 //头部数据获取到后初始化筛选数据
this.headData = headData this.headData = headData
if (initCategory != "0") { headData?.let { it ->
if (headData?.cates != null) { // allFilter.reorder = it.reorder[0]
for (cate in headData.cates) { allFilter.showType = it.filters.showType[initShowType]
if (cate.cateId == initCategory) { if (it.highlighter.size > 0) {
allFilter.categories.clear() //设置热门搜索
allFilter.categories.add(cate) initHotViews(lin_filter2, it.highlighter)
if (allFilter.categories.size == 1 && "全部" != allFilter.categories[0].cateName) { }
//显示选中标题 it.cates[0].children?.forEachIndexed { index, children->
tvSubject.text = allFilter.categories[0].cateName val type = if (children.cate_name.length>4) 2 else 1
} else { val childrenBean = ChildrenBean(children.cate_name,children.cate_id,index<=12,type)
//显示主标题 allFilter.childList.add(childrenBean)
tvSubject.text = "主题" }
} it.cates[1].children?.forEachIndexed { index, children->
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED) val type = if (children.cate_name.length>4) 2 else 1
break val childrenBean = ChildrenBean(children.cate_name,children.cate_id,index<=12,type)
} allFilter.stressList.add(childrenBean)
} }
it.cates[2].children?.forEachIndexed { index, children->
val type = if (children.cate_name.length>4) 2 else 1
val childrenBean = ChildrenBean(children.cate_name,children.cate_id,index<=12,type)
allFilter.loveEmotionList.add(childrenBean)
}
it.cates[3].children?.forEachIndexed { index, children->
val type = if (children.cate_name.length>4) 2 else 1
val childrenBean = ChildrenBean(children.cate_name,children.cate_id,index<=12,type)
allFilter.marriedFamilyList.add(childrenBean)
}
it.cates[4].children?.forEachIndexed { index, children->
val type = if (children.cate_name.length>4) 2 else 1
val childrenBean = ChildrenBean(children.cate_name,children.cate_id,index<=12,type)
allFilter.personalGrowthList.add(childrenBean)
}
it.cates[5].children?.forEachIndexed { index, children->
val type = if (children.cate_name.length>4) 2 else 1
val childrenBean = ChildrenBean(children.cate_name,children.cate_id,index<=12,type)
allFilter.interpersonalRelationshipList.add(childrenBean)
}
it.cates[6].children?.forEachIndexed { index, children->
val type = if (children.cate_name.length>4) 2 else 1
val childrenBean = ChildrenBean(children.cate_name,children.cate_id,index<=12,type)
allFilter.careerDevelopmentList.add(childrenBean)
}
it.cates[7].children?.forEachIndexed { index, children->
val type = if (children.cate_name.length>4) 2 else 1
val childrenBean = ChildrenBean(children.cate_name,children.cate_id,index<=12,type)
allFilter.mentalHealthList.add(childrenBean)
} }
initCategory = "0"
} else {
allFilter.categories.clear()
allFilter.categories.add(headData?.cates?.get(0) ?: CateItem())
}
allFilter.reorder = headData?.reorder?.get(0) ?: ReorderItem()
allFilter.showType = headData?.filters?.showType?.get(initShowType) ?: ShowTypeItem()
if (headData?.highlighter?.size ?: 0 > 0) {
//设置热门搜索
initHotViews(lin_filter2, headData!!.highlighter)
} }
} }
...@@ -477,9 +485,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -477,9 +485,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
if (view.childCount > 0) { if (view.childCount > 0) {
return return
} }
val popWidth = RxDeviceTool.getScreenWidth(mContext) for (hot in hotData) {
val mWidth = (popWidth - RxImageTool.dp2px(10f)) / hotData.size
for ((index, hot) in hotData!!.withIndex()) {
val tv = val tv =
View.inflate(mContext, R.layout.consultant_item_filter_online, null) as TextView View.inflate(mContext, R.layout.consultant_item_filter_online, null) as TextView
val textView = tv.tvFree val textView = tv.tvFree
...@@ -524,32 +530,33 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -524,32 +530,33 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private fun dealHotSelect(hotData: HighlighterItem, isAdd: Boolean) { private fun dealHotSelect(hotData: HighlighterItem, isAdd: Boolean) {
when (hotData.type) { when (hotData.type) {
"1" -> { "1" -> {
if (headData?.cates!!.size > 0) { // if (headData?.cates!!.size > 0) {
for (bean in headData?.cates!!) { // for (bean in headData?.cates!!) {
if (TextUtils.equals(hotData.id, bean.cateId.toString())) { // if (TextUtils.equals(hotData.id, bean.cateId.toString())) {
if (isAdd) { // if (isAdd) {
if (allFilter.categories.size == 1 && allFilter.categories[0].cateId == "0") { // if (allFilter.categories.size == 1 && allFilter.categories[0].cateId == "0") {
allFilter.categories.clear() // allFilter.categories.clear()
} // }
allFilter.categories.add(bean) // allFilter.categories.add(bean)
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED) // updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
} else { // } else {
allFilter.categories.remove(bean) // allFilter.categories.remove(bean)
if (allFilter.categories.size == 0) { // if (allFilter.categories.size == 0) {
allFilter.categories.add(headData?.cates?.get(0) ?: CateItem()) // allFilter.categories.add(headData?.cates?.get(0) ?: CateItem())
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_NORMAL) // updateFilterTextViewStatus(tvSubject, FILTER_STATUS_NORMAL)
} // }
} // }
} // }
} // }
if (allFilter.categories.size == 1 && "全部" != allFilter.categories[0].cateName) { // if (allFilter.categories.size == 1 && "全部" != allFilter.categories[0].cateName) {
//显示选中标题 // //显示选中标题
tvSubject.text = allFilter.categories[0].cateName // tvSubject.text = allFilter.categories[0].cateName
} else { // } else {
//显示主标题 // //显示主标题
tvSubject.text = "主题" // tvSubject.text = "主题"
} // }
} // }
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
} }
"2" -> {//省 "2" -> {//省
if (headData?.region!!.size > 0) { if (headData?.region!!.size > 0) {
...@@ -781,7 +788,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -781,7 +788,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
} }
//专家列表数据获取到后的回调 /**
* 获取专家列表数据
*/
override fun onDoctorListFetched(data: MutableList<ExpertServiceItem>, extras:Extras?,curPage:Int) { override fun onDoctorListFetched(data: MutableList<ExpertServiceItem>, extras:Extras?,curPage:Int) {
LogUtil.d("onDoctorListFetched") LogUtil.d("onDoctorListFetched")
if (rvExperts.adapter != doctorAdapter) { if (rvExperts.adapter != doctorAdapter) {
...@@ -794,18 +803,29 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -794,18 +803,29 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} else { } else {
bury(keyWord ?: "", data.size > 0, isRecommend, fromPages[fromPageType]) bury(keyWord ?: "", data.size > 0, isRecommend, fromPages[fromPageType])
} }
if (extras==null) { // 如果是第一页
hasMore = false
doctorAdapter.hasMore = false
}
if (curPage==1){ if (curPage==1){
if (data.size>=10){
hasMore = true
doctorAdapter.hasMore = true
}else{
hasMore = false
doctorAdapter.hasMore = false
}
doctorList.clear() doctorList.clear()
} }
doctorList.addAll(data)
if (data.size==0) { // data的长度为0的时候为最后一页
hasMore = false
doctorAdapter.hasMore = false
}else{
doctorList.addAll(data)
}
doctorAdapter.notifyDataSetChanged() doctorAdapter.notifyDataSetChanged()
isDoSearch = false isDoSearch = false
isRecommend = false isRecommend = false
v_loading.visibility = View.GONE v_loading.visibility = View.GONE
ll_network_error.visibility = View.GONE ll_network_error.visibility = View.GONE
...@@ -1318,32 +1338,32 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1318,32 +1338,32 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
private var categoryPopup: CategoryPopupWindow? = null private var categoryPopup: CategoryPopupWindow? = null
private var mHandler:Handler?=null
/** /**
* 显示主题弹窗 * 显示主题弹窗
*/ */
private fun showSubjectPopupWindow() { private fun showSubjectPopupWindow() {
// tempFilter.categories.clear() if (categoryPopup==null) {
// tempFilter.categories.addAll(allFilter.categories) categoryPopup = CategoryPopupWindow(this,allFilter)
// val categories = headData?.cates mHandler = Handler()
// if (categories != null) { mHandler!!.post {
// categoryPopup = CategoryPopupWindow(this, categories) categoryPopup!!.updateData()
// categoryPopup!!.setOnDismissListener { }
// viewDim.visibility = View.INVISIBLE categoryPopup!!.setOnDismissListener {
// if (allFilter.categories.size > 1 || (allFilter.categories.size == 1 && allFilter.categories[0] != headData!!.cates[0])) { viewDim.visibility = View.INVISIBLE
// updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED) ConsultAssistantDialogUtils.INSTANCE.fitRequest(this, "doctor_list", true)
// } else { }
// updateFilterTextViewStatus(tvSubject, FILTER_STATUS_NORMAL) ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity()
// } categoryPopup!!.onSubjectsSelectedListener = this
// } categoryPopup!!.showAsDropDown(viewSep2)
// categoryPopup!!.onSubjectsSelectedListener = this updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
// categoryPopup!!.showAsDropDown(viewSep2) viewDim.visibility = View.VISIBLE
// updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN) }else{
// viewDim.visibility = View.VISIBLE ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity()
// } else { categoryPopup!!.showAsDropDown(viewSep2)
// ToastUtil.toastShort("数据初始化失败,请重试") updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
// getPresenter().fetchListHead() viewDim.visibility = View.VISIBLE
// } }
} }
/** /**
...@@ -1352,57 +1372,14 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1352,57 +1372,14 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
* 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态 * 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态
*/ */
override fun onCategoriesSelected() { override fun onCategoriesSelected() {
// ActionCountUtils.count( // ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_THEME_CLICK, categories.map { it.cateName }.joinToString("|"))
// ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_THEME_CLICK,
// categories.map { it.cateName }.joinToString("|") if (allFilter.categoryId2List.size>0||allFilter.categoryId3List.size>0){
// ) updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
// if (categories.size == 1 && "全部" != categories[0].cateName) { refresh()
// //显示选中标题 }else{
// tvSubject.text = categories[0].cateName updateFilterTextViewStatus(tvSubject, FILTER_STATUS_NORMAL)
// } else { }
// //显示主标题
// tvSubject.text = "主题"
// }
// //判断主题选中,判断热门筛选中是否也有该主题
// Executors.newCachedThreadPool().execute {
// if (headData!!.highlighter.size > 0) {
// for (index in 0.until(headData!!.highlighter.size)) {
// if (headData!!.highlighter[index].type == "1") {
// var textview = lin_filter2.getChildAt(index) as TextView
// this@ExpertSearchActivity.runOnUiThread {
// textview.isSelected = false
// textview.paint.isFakeBoldText = false
// }
// for (bean in categories) {
// if (TextUtils.equals(
// bean.cateName,
// headData!!.highlighter[index].value
// )
// ) {
// this@ExpertSearchActivity.runOnUiThread {
// textview.isSelected = true
// textview.paint.isFakeBoldText = true
// }
// break
// }
// }
// }
// }
// }
// }
//
// updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
//// LogUtil.d("theme callback: " + categories.map { it.cateName }.joinToString(","))
//// props1.put("filtrate_second", categories.map { it.cateName }.joinToString(","))
//// BuryPointUtils.buryPoint("Filtrate", props1)
// allFilter.categories.clear()
// allFilter.categories.addAll(categories)
// refresh()
// if (categories.size == 1) {
// doctorAdapter?.cateId = "${categories[0].cateId}"
// } else {
// doctorAdapter?.cateId = ""
// }
} }
override fun onRefresh() { override fun onRefresh() {
...@@ -1534,6 +1511,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1534,6 +1511,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
mHandler=null
ConsultAssistantDialogUtils.INSTANCE.expertSearchResetStatus() ConsultAssistantDialogUtils.INSTANCE.expertSearchResetStatus()
} }
} }
...@@ -349,9 +349,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -349,9 +349,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
private fun initData() { private fun initData() {
allFilter.showType.key = initShowType allFilter.showType.key = initShowType
allFilter.categories.clear()
getPresenter().fetchListHead()
getPresenter().fetchListHead()
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null) v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
...@@ -739,21 +738,29 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -739,21 +738,29 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} else { } else {
bury(keyWord ?: "", data.size > 0, isRecommend, fromPages[fromPageType]) bury(keyWord ?: "", data.size > 0, isRecommend, fromPages[fromPageType])
} }
// 如果是第一页
if (curPage==1){ if (curPage==1){
hasMore = true if (data.size>=10){
doctorAdapter.hasMore = true hasMore = true
doctorAdapter.hasMore = true
}else{
hasMore = false
doctorAdapter.hasMore = false
}
doctorList.clear() doctorList.clear()
} }
if (extras==null||data.size==0) { if (data.size==0) { // data的长度为0的时候为最后一页
hasMore = false hasMore = false
doctorAdapter.hasMore = false doctorAdapter.hasMore = false
}else{
doctorList.addAll(data)
} }
doctorList.addAll(data)
doctorAdapter.notifyDataSetChanged() doctorAdapter.notifyDataSetChanged()
isDoSearch = false isDoSearch = false
isRecommend = false isRecommend = false
v_loading.visibility = View.GONE v_loading.visibility = View.GONE
ll_network_error.visibility = View.GONE ll_network_error.visibility = View.GONE
......
...@@ -222,11 +222,11 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -222,11 +222,11 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
.subscribe(Consumer { .subscribe(Consumer {
// 当前页数 // 当前页数
val curPage = (it.skip/it.limit)+1 val curPage = (it.skip/it.limit)+1
if (null != it.objects && it.objects.isNotEmpty()) { if (curPage==1&&it.objects.size==0){
mView.fetchListEmpty("没有搜到相关信息,换个关键词看看吧")
}else{
mExtras = it.extras mExtras = it.extras
mView.onDoctorListFetched(it.objects, mExtras,curPage) mView.onDoctorListFetched(it.objects, mExtras,curPage)
} else if (curPage==1&&(null == it.objects || it.objects.isEmpty())){
mView.fetchListEmpty("没有搜到相关信息,换个关键词看看吧")
} }
}, object : ThrowableConsumer() { }, object : ThrowableConsumer() {
override fun accept(msg: String) { override fun accept(msg: String) {
......
...@@ -227,23 +227,23 @@ class ExpertSearchAdapter( ...@@ -227,23 +227,23 @@ class ExpertSearchAdapter(
holder.tvTeamCertifications.text = itemBean.title holder.tvTeamCertifications.text = itemBean.title
//咨询师标签 //咨询师标签
holder.ll_tags.removeAllViews() holder.ll_tags.removeAllViews()
itemBean.tagList?.let { itemBean.feature_tags?.let {
if (it.isNotEmpty()){ if (it.isNotEmpty()){
for (tag in itemBean.tagList){ for (tag in itemBean.feature_tags){
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_tag, holder.ll_tags, false) val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_tag, holder.ll_tags, false)
tag.tagName?.let { name -> tag.tag_name.let { name ->
if (name.length>4){ if (name.length>4){
view.tvTag.text = "${name.substring(0,4)}…" view.tvTag.text = "${name.substring(0,4)}…"
}else{ }else{
view.tvTag.text = name view.tvTag.text = name
} }
} }
if (tag.isHigh==1){ if (tag.is_highlight){
view.tvTag.setBackgroundResource(R.drawable.consultant_bg_radius_line_eb892c) view.tvTag.setBackgroundResource(R.drawable.consultant_bg_radius_line_eb892c)
view.tvTag.setTextColor(ContextCompat.getColor(context,R.color.color_EB892C)) view.tvTag.setTextColor(ContextCompat.getColor(context,R.color.color_EB892C))
}else{ }else{
view.tvTag.setBackgroundResource(R.drawable.consultant_bg_radius_line_gray_1) view.tvTag.setBackgroundResource(R.drawable.consultant_bg_radius_line_gray_1)
view.tvTag.setTextColor(ContextCompat.getColor(context,R.color.platform_color_E0E0E0)) view.tvTag.setTextColor(ContextCompat.getColor(context,R.color.platform_color_666666))
} }
holder.ll_tags.addView(view) holder.ll_tags.addView(view)
} }
...@@ -320,6 +320,7 @@ class ExpertSearchAdapter( ...@@ -320,6 +320,7 @@ class ExpertSearchAdapter(
} else if (holder is FooterViewHolder) { } else if (holder is FooterViewHolder) {
LogUtil.e("${listData.size}") LogUtil.e("${listData.size}")
LogUtil.e("${hasMore}")
if (hasMore) { if (hasMore) {
holder.itemView.visibility = View.VISIBLE holder.itemView.visibility = View.VISIBLE
holder.pbLoading.visibility = View.VISIBLE holder.pbLoading.visibility = View.VISIBLE
...@@ -331,12 +332,12 @@ class ExpertSearchAdapter( ...@@ -331,12 +332,12 @@ class ExpertSearchAdapter(
} }
} }
override fun getItemCount(): Int = override fun getItemCount(): Int = listData.size + 1
if (listData.size < ExpertSearchActivity.PAGE_SIZE && hasMore) { // if (listData.size < ExpertSearchActivity.PAGE_SIZE && hasMore) {
listData.size // listData.size
} else { // } else {
listData.size + 1 // listData.size + 1
} // }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder = override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder =
when (viewType) { when (viewType) {
......
...@@ -12,7 +12,7 @@ data class ExpertBean( ...@@ -12,7 +12,7 @@ data class ExpertBean(
val skip : Int = 0, val skip : Int = 0,
val limit : Int = 0, val limit : Int = 0,
val size : Int = 10, val size : Int = 10,
val objects : MutableList<ExpertServiceItem>?, val objects : MutableList<ExpertServiceItem>,
// 分页需要 // 分页需要
val extras: Extras?) val extras: Extras?)
......
...@@ -131,10 +131,12 @@ data class ExpertServiceItem( ...@@ -131,10 +131,12 @@ data class ExpertServiceItem(
/** /**
* 新标签分类 * 新标签分类
*/ */
val tagList: ArrayList<TagBean>? val feature_tags: ArrayList<FeatureTag>?
) )
data class TagBean( data class FeatureTag(
val tagName:String?, val tag_id:Int,
val isHigh:Int val tag_name:String,
val is_highlight:Boolean, // 是否高亮
val type:String // 标签类型
) )
\ No newline at end of file
...@@ -286,43 +286,42 @@ class FilterPopupWindow(private val context: Context, private val filterData: Fi ...@@ -286,43 +286,42 @@ class FilterPopupWindow(private val context: Context, private val filterData: Fi
//用户行为数据埋点 //用户行为数据埋点
biEvent(biEventName, biEventParams) biEvent(biEventName, biEventParams)
// sb.append("&page=").append(1) // ExpertSearchDataManager.getHttp().getFilterCount(sb.toString())
ExpertSearchDataManager.getHttp().getFilterCount(sb.toString()) // .subscribeOn(Schedulers.io())
.subscribeOn(Schedulers.io()) // .compose(RxUtils.resultJavaData())
.compose(RxUtils.resultJavaData()) // .map { it }
.map { it } // .filter { true }
.filter { true } // .observeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) // .subscribe({
.subscribe({ //
// contentView.btnConfirm.text = if (it > 0) "确定" else "暂无匹配咨询师"
contentView.btnConfirm.text = if (it > 0) "确定" else "暂无匹配咨询师" // //按钮置灰/解除置灰
//按钮置灰/解除置灰 // contentView.btnConfirm.isEnabled = it > 0
contentView.btnConfirm.isEnabled = it > 0 // if (it > 0) {
if (it > 0) { // contentView.btnConfirm.setTextColor(
contentView.btnConfirm.setTextColor( // ContextCompat.getColor(
ContextCompat.getColor( // context,
context, // R.color.platform_but_text_color
R.color.platform_but_text_color // )
) // )
) // contentView.btnConfirm.background =
contentView.btnConfirm.background = // ContextCompat.getDrawable(context, R.drawable.consultant_bg_radius_5_dark)
ContextCompat.getDrawable(context, R.drawable.consultant_bg_radius_5_dark) //// contentView.btnConfirm.setTextColor(ContextCompat.getColor(context,R.color.consultant_white))
// contentView.btnConfirm.setTextColor(ContextCompat.getColor(context,R.color.consultant_white)) // } else {
} else { // contentView.btnConfirm.setTextColor(
contentView.btnConfirm.setTextColor( // ContextCompat.getColor(
ContextCompat.getColor( // context,
context, // R.color.platform_text_light_color
R.color.platform_text_light_color // )
) // )
) // contentView.btnConfirm.background =
contentView.btnConfirm.background = // ContextCompat.getDrawable(context, R.drawable.consultant_bg_radius_5_light)
ContextCompat.getDrawable(context, R.drawable.consultant_bg_radius_5_light) //// contentView.btnConfirm.setTextColor(ContextCompat.getColor(context,R.color.color_999999))
// contentView.btnConfirm.setTextColor(ContextCompat.getColor(context,R.color.color_999999)) // }
} //
// }, {
}, { // ToastHelper.show(it.message!!)
ToastHelper.show(it.message!!) // })
})
} }
private fun biEvent(biEventName: String, biEventParams: String = "") { private fun biEvent(biEventName: String, biEventParams: String = "") {
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
android:gravity="center" android:gravity="center"
android:layout_marginEnd="6dp" android:layout_marginEnd="6dp"
android:padding="3dp" android:padding="3dp"
android:textColor="@color/platform_color_999999" android:textColor="@color/platform_color_666666"
android:textSize="10sp" android:textSize="10sp"
tools:text="恋爱情感" /> tools:text="恋爱情感" />
...@@ -211,12 +211,11 @@ ...@@ -211,12 +211,11 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="44dp" android:layout_height="44dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/consultant_bg_radius_5_light" android:background="@drawable/consultant_bg_radius_5_dark"
android:gravity="center" android:gravity="center"
android:hint="暂无匹配咨询师" android:hint="确定"
android:textColor="@color/platform_but_text_color" android:textColor="@color/white"
android:textColorHint="@color/platform_color_E0E0E0" android:textColorHint="@color/platform_color_E0E0E0"
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout> </LinearLayout>
......
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