Commit 226260c7 by 徐健
parents a364e4aa 15aa6381
...@@ -42,8 +42,8 @@ ext { ...@@ -42,8 +42,8 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.48.7.16", "m-confide" : "0.0.48.7.18",
"m-consultant" : "0.0.57.4", "m-consultant" : "0.0.57.6",
"m-fm" : "0.0.29.3", "m-fm" : "0.0.29.3",
"m-user" : "0.0.60.1", "m-user" : "0.0.60.1",
"m-home" : "0.0.19.1", "m-home" : "0.0.19.1",
...@@ -75,7 +75,7 @@ ext { ...@@ -75,7 +75,7 @@ ext {
"ydl-webview" : "0.0.38.27", "ydl-webview" : "0.0.38.27",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.48.3.5", "m-audioim" : "0.0.48.3.7",
"ydl-flutter-base": "0.0.10.9", "ydl-flutter-base": "0.0.10.9",
//以下 几乎不会动 //以下 几乎不会动
...@@ -121,7 +121,7 @@ ext { ...@@ -121,7 +121,7 @@ ext {
"ydl-webview" : "0.0.38.24", "ydl-webview" : "0.0.38.24",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.48.3.5", "m-audioim" : "0.0.48.3.7",
"ydl-flutter-base": "0.0.10.9", "ydl-flutter-base": "0.0.10.9",
//以下 几乎不会动 //以下 几乎不会动
......
...@@ -172,8 +172,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -172,8 +172,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private var headData: HeadData? = null //筛选数据 private var headData: HeadData? = null //筛选数据
private var isFromSplash = false private var isFromSplash = false
private val props1 = JSONObject() //筛选标题埋点参数 private val props1 = JSONObject() //筛选标题埋点参数
private var fromPageType: Int = 0 //从哪个页面跳转过来的 private var fromPageType: Int = 1 //从哪个页面跳转过来的
private val fromPages = arrayOf("首页搜索", "找专家", "在线专家") private val fromPages = arrayOf("首页", "搜索页面", "在线专家")
private var isRecommend = false //埋点数据 private var isRecommend = false //埋点数据
private var keyWord: String? = null //埋点数据 private var keyWord: String? = null //埋点数据
private var isDoSearch: Boolean = false //埋点判断是否通过搜索进入埋点的 private var isDoSearch: Boolean = false //埋点判断是否通过搜索进入埋点的
...@@ -380,7 +380,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -380,7 +380,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null) v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
if (fromPageType != -1) { if (fromPageType != -1) {
doctorAdapter.setEntrance(fromPages[fromPageType]) doctorAdapter.setEntrance(fromPages[fromPageType],1)
} }
} }
...@@ -1454,7 +1454,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1454,7 +1454,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_PAGE_VISIT) ActionCountUtils.count(ConsultBIConstants.ConsultSearchListEvent.APP_CONSULT_SEARCH_LIST_PAGE_VISIT)
} }
......
...@@ -57,8 +57,9 @@ import kotlinx.android.synthetic.main.consultant_layout_search_toolbar.* ...@@ -57,8 +57,9 @@ import kotlinx.android.synthetic.main.consultant_layout_search_toolbar.*
import org.json.JSONObject import org.json.JSONObject
import java.util.concurrent.Executors import java.util.concurrent.Executors
class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPresenter>(), View.OnClickListener, IExpertSearchView, class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPresenter>(),
OnCategoriesSelectedListener, OnSortItemSelectedListener, OnFilterConfirmListener, View.OnClickListener, IExpertSearchView,
OnCategoriesSelectedListener, OnSortItemSelectedListener, OnFilterConfirmListener,
SwipeRefreshLayout.OnRefreshListener { SwipeRefreshLayout.OnRefreshListener {
...@@ -68,9 +69,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -68,9 +69,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override fun initDataAndEvent() { override fun initDataAndEvent() {
var statusBarHeight = StatusBarUtils.getStatusBarHeight(context); var statusBarHeight = StatusBarUtils.getStatusBarHeight(context);
rootView.setPadding(0,statusBarHeight,0,0) rootView.setPadding(0, statusBarHeight, 0, 0)
btn_back.visibility = View.GONE btn_back.visibility = View.GONE
title_layout.setPadding(DisplayUtils.dp2px(context,15),0,0,0) title_layout.setPadding(DisplayUtils.dp2px(context, 15), 0, 0, 0)
initViews() initViews()
initData() initData()
} }
...@@ -91,7 +92,13 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -91,7 +92,13 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
} }
override fun showImage(url: String?, imgView: ImageView, width: Int, heigh: Int, ops: SimpleImageOpConfiger) { override fun showImage(
url: String?,
imgView: ImageView,
width: Int,
heigh: Int,
ops: SimpleImageOpConfiger
) {
if (isAdded) { if (isAdded) {
YDLImageCacheManager.showImage(activity, url, imgView, width, heigh, ops) YDLImageCacheManager.showImage(activity, url, imgView, width, heigh, ops)
} }
...@@ -132,7 +139,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -132,7 +139,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
private var headData: HeadData? = null //筛选数据 private var headData: HeadData? = null //筛选数据
private val props1 = JSONObject() //筛选标题埋点参数 private val props1 = JSONObject() //筛选标题埋点参数
private var fromPageType: Int = 0 //从哪个页面跳转过来的 private var fromPageType: Int = 0 //从哪个页面跳转过来的
private val fromPages = arrayOf("首页搜索", "找专家", "在线专家") private val fromPages = arrayOf("首页", "搜索页面", "在线专家")
private var isRecommend = false //埋点数据 private var isRecommend = false //埋点数据
private var keyWord: String? = null //埋点数据 private var keyWord: String? = null //埋点数据
private var isDoSearch: Boolean = false //埋点判断是否通过搜索进入埋点的 private var isDoSearch: Boolean = false //埋点判断是否通过搜索进入埋点的
...@@ -152,12 +159,18 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -152,12 +159,18 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
btn_call.setOnClickListener(this) btn_call.setOnClickListener(this)
tv_guide.setOnClickListener(this) tv_guide.setOnClickListener(this)
rl_search.setOnClickListener(this) rl_search.setOnClickListener(this)
srlContainer.setColorSchemeColors(ContextCompat.getColor(activity, R.color.consultant_main_theme)) srlContainer.setColorSchemeColors(
ContextCompat.getColor(
activity,
R.color.consultant_main_theme
)
)
srlContainer.setProgressViewOffset(false, 0, 200) srlContainer.setProgressViewOffset(false, 0, 200)
srlContainer.setOnRefreshListener(this) srlContainer.setOnRefreshListener(this)
initNetLossView() initNetLossView()
recommendListView.addViewPagerScrollStateListener(object : RecommendListView.ViewPagerScrollStateCallback { recommendListView.addViewPagerScrollStateListener(object :
RecommendListView.ViewPagerScrollStateCallback {
override fun viewPagerScroll(isScrolling: Boolean) { override fun viewPagerScroll(isScrolling: Boolean) {
//如果viewpager正在滚动,则禁止下拉刷新 //如果viewpager正在滚动,则禁止下拉刷新
srlContainer.isEnabled = !isScrolling srlContainer.isEnabled = !isScrolling
...@@ -210,7 +223,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -210,7 +223,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f) var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f) var scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f)
var scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f) var scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f)
var animator = ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY).setDuration(200) var animator =
ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY)
.setDuration(200)
animator.addListener(object : AnimatorListenerAdapter() { animator.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
image_scroll_top.visibility = View.GONE image_scroll_top.visibility = View.GONE
...@@ -227,7 +242,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -227,7 +242,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
var alpha = PropertyValuesHolder.ofFloat("alpha", 0f, 1f) var alpha = PropertyValuesHolder.ofFloat("alpha", 0f, 1f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 1f) var scaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 1f)
var scaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 1f) var scaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 1f)
var animator = ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY).setDuration(200) var animator =
ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY)
.setDuration(200)
animator.addListener(object : AnimatorListenerAdapter() { animator.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
image_scroll_top.visibility = View.VISIBLE image_scroll_top.visibility = View.VISIBLE
...@@ -244,7 +261,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -244,7 +261,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f) var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f) var scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f)
var scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f) var scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f)
var animator = ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY).setDuration(200) var animator =
ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY)
.setDuration(200)
animator.addListener(object : AnimatorListenerAdapter() { animator.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
image_scroll_top.visibility = View.GONE image_scroll_top.visibility = View.GONE
...@@ -280,9 +299,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -280,9 +299,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override fun setUserVisibleHint(isVisibleToUser: Boolean) { override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser) super.setUserVisibleHint(isVisibleToUser)
if (isVisibleToUser && isResumed) { if (isVisibleToUser && isResumed) {
showConsultAssistantDialog() showConsultAssistantDialog()
}else { } else {
hideConsultAssistantDialog() hideConsultAssistantDialog()
} }
if (isVisibleToUser && isResumed) { if (isVisibleToUser && isResumed) {
...@@ -300,12 +319,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -300,12 +319,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
private fun initNetLossView() { private fun initNetLossView() {
v_loading.setListener(object : LogoLoadingView.LogoLoadingListener { v_loading.setListener(object : LogoLoadingView.LogoLoadingListener {
override fun onDataResetClick() { override fun onDataResetClick() {
rvExperts.visibility = View.GONE rvExperts.visibility = View.GONE
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
ll_network_error.visibility = View.GONE ll_network_error.visibility = View.GONE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null) v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
refresh(false) refresh(false)
} }
...@@ -332,11 +351,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -332,11 +351,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
getPresenter().localData(initShowType) getPresenter().localData(initShowType)
//refresh(false) //refresh(false)
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null) v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
if (fromPageType != -1) { if (fromPageType != -1) {
doctorAdapter.setEntrance(fromPages[fromPageType]) doctorAdapter.setEntrance(fromPages[fromPageType], 0)
} }
} }
...@@ -348,9 +367,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -348,9 +367,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
StatusBarUtils.setTransparentForImageView(activity, null) StatusBarUtils.setTransparentForImageView(activity, null)
val statusBarHeight = StatusBarUtils.getStatusBarHeight(context) val statusBarHeight = StatusBarUtils.getStatusBarHeight(context)
val lp1 =title_layout.layoutParams as LinearLayout.LayoutParams val lp1 = title_layout.layoutParams as LinearLayout.LayoutParams
lp1.height = (RxImageTool.dp2px(48f) + statusBarHeight) lp1.height = (RxImageTool.dp2px(48f) + statusBarHeight)
title_layout.setPadding(0, statusBarHeight, 0, 0) title_layout.setPadding(0, statusBarHeight, 0, 0)
} }
} }
...@@ -366,10 +385,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -366,10 +385,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
allFilter.categories.add(cate) allFilter.categories.add(cate)
if (allFilter.categories.size == 1 && !"全部".equals(allFilter.categories[0].cateName)) { if (allFilter.categories.size == 1 && !"全部".equals(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) updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
break break
...@@ -462,10 +481,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -462,10 +481,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
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 = "主题"
} }
} }
} }
...@@ -477,7 +496,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -477,7 +496,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (hasSelectedArea) { if (hasSelectedArea) {
for ((index, bean) in headData!!.highlighter.withIndex()) { for ((index, bean) in headData!!.highlighter.withIndex()) {
if (bean.type == "2" || bean.type == "8") { if (bean.type == "2" || bean.type == "8") {
var textview =lin_filter2.getChildAt(index) as TextView var textview = lin_filter2.getChildAt(index) as TextView
textview.isSelected = false textview.isSelected = false
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
...@@ -493,16 +512,16 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -493,16 +512,16 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
allFilter.region = bean allFilter.region = bean
if (allFilter.region.value?.length ?: 0 > 4) { if (allFilter.region.value?.length ?: 0 > 4) {
tvArea.text = allFilter.region.value?.substring(0, 3) + "..." tvArea.text = allFilter.region.value?.substring(0, 3) + "..."
} else { } else {
tvArea.text = allFilter.region.value tvArea.text = allFilter.region.value
} }
updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED) updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED)
hasSelectedArea = true hasSelectedArea = true
} else { } else {
allFilter.region = RegionItem() allFilter.region = RegionItem()
tvArea.text = "地区" tvArea.text = "地区"
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL) updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
hasSelectedArea = false hasSelectedArea = false
...@@ -519,7 +538,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -519,7 +538,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (hasSelectedSort) { if (hasSelectedSort) {
for ((index, bean) in headData!!.highlighter.withIndex()) { for ((index, bean) in headData!!.highlighter.withIndex()) {
if (bean.type == "3") { if (bean.type == "3") {
var textview =lin_filter2.getChildAt(index) as TextView var textview = lin_filter2.getChildAt(index) as TextView
textview.isSelected = false textview.isSelected = false
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
...@@ -538,9 +557,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -538,9 +557,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
} }
when { when {
allFilter.reorder.value.equals("综合排序") ->tvSort.text = "排序" allFilter.reorder.value.equals("综合排序") -> tvSort.text = "排序"
allFilter.reorder.value?.length ?: 0 > 4 ->tvSort.text = allFilter.reorder.value?.substring(0, 3) + "..." allFilter.reorder.value?.length ?: 0 > 4 -> tvSort.text =
else ->tvSort.text = allFilter.reorder.value allFilter.reorder.value?.substring(0, 3) + "..."
else -> tvSort.text = allFilter.reorder.value
} }
} }
} }
...@@ -633,7 +653,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -633,7 +653,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (hasSelectedArea) { if (hasSelectedArea) {
for ((index, bean) in headData!!.highlighter.withIndex()) { for ((index, bean) in headData!!.highlighter.withIndex()) {
if (bean.type == "2" || bean.type == "8") { if (bean.type == "2" || bean.type == "8") {
var textview =lin_filter2.getChildAt(index) as TextView var textview = lin_filter2.getChildAt(index) as TextView
textview.isSelected = false textview.isSelected = false
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
...@@ -643,16 +663,20 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -643,16 +663,20 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
bean.key = hotData.id bean.key = hotData.id
bean.value = hotData.value bean.value = hotData.value
for (headBean in headData!!.region) { for (headBean in headData!!.region) {
if (TextUtils.equals(headBean.key!!.substring(0, 2), bean.key!!.substring(0, 2))) { if (TextUtils.equals(
headBean.key!!.substring(0, 2),
bean.key!!.substring(0, 2)
)
) {
allFilter.region = headBean allFilter.region = headBean
break break
} }
} }
allFilter.sub = bean allFilter.sub = bean
if (allFilter.sub.value?.length ?: 0 > 4) { if (allFilter.sub.value?.length ?: 0 > 4) {
tvArea.text = allFilter.sub.value?.substring(0, 3) + "..." tvArea.text = allFilter.sub.value?.substring(0, 3) + "..."
} else { } else {
tvArea.text = allFilter.sub.value tvArea.text = allFilter.sub.value
} }
updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED) updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED)
...@@ -661,7 +685,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -661,7 +685,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
allFilter.region = RegionItem() allFilter.region = RegionItem()
allFilter.sub = SubItem("不限", null) allFilter.sub = SubItem("不限", null)
tvArea.text = "地区" tvArea.text = "地区"
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL) updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
hasSelectedArea = false hasSelectedArea = false
...@@ -677,14 +701,14 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -677,14 +701,14 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (lin_filter2.childCount > 0) { if (lin_filter2.childCount > 0) {
//清空选中 //清空选中
for (i in 0.until(lin_filter2.childCount)) { for (i in 0.until(lin_filter2.childCount)) {
val textView =lin_filter2.getChildAt(i) as TextView val textView = lin_filter2.getChildAt(i) as TextView
textView.isSelected = false textView.isSelected = false
textView.paint.isFakeBoldText = false textView.paint.isFakeBoldText = false
} }
//重置选中状态 //重置选中状态
for ((index, other) in otherdata.withIndex()) { for ((index, other) in otherdata.withIndex()) {
for (i in 0 until lin_filter2.childCount) { for (i in 0 until lin_filter2.childCount) {
val textView =lin_filter2.getChildAt(i) as TextView val textView = lin_filter2.getChildAt(i) as TextView
if (textView.text == other.value) { if (textView.text == other.value) {
textView.isSelected = true textView.isSelected = true
textView.paint.isFakeBoldText = true textView.paint.isFakeBoldText = true
...@@ -695,7 +719,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -695,7 +719,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
//服务列表数据获取到后的回调 //服务列表数据获取到后的回调
override fun onServiceListFetched(data: MutableList<DoctorServiceItem>, page: Int, totalPage: Int) { override fun onServiceListFetched(
data: MutableList<DoctorServiceItem>,
page: Int,
totalPage: Int
) {
LogUtil.d("onServiceListFetched") LogUtil.d("onServiceListFetched")
// if (rvExperts.adapter != serviceAdapter) { // if (rvExperts.adapter != serviceAdapter) {
// rvExperts.adapter = serviceAdapter // rvExperts.adapter = serviceAdapter
...@@ -724,18 +752,22 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -724,18 +752,22 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
isRecommend = false isRecommend = false
isDoSearch = false isDoSearch = false
v_loading.visibility = View.GONE v_loading.visibility = View.GONE
ll_network_error.visibility = View.GONE ll_network_error.visibility = View.GONE
rvExperts.visibility = View.VISIBLE rvExperts.visibility = View.VISIBLE
srlContainer.isRefreshing = false srlContainer.isRefreshing = false
} }
//专家列表数据获取到后的回调 //专家列表数据获取到后的回调
override fun onDoctorListFetched(data: MutableList<DoctorServiceItem>, page: Int, totalPage: Int) { override fun onDoctorListFetched(
data: MutableList<DoctorServiceItem>,
page: Int,
totalPage: Int
) {
LogUtil.d("onDoctorListFetched") LogUtil.d("onDoctorListFetched")
if (rvExperts.adapter != doctorAdapter) { if (rvExperts.adapter != doctorAdapter) {
rvExperts.adapter = doctorAdapter rvExperts.adapter = doctorAdapter
} }
LogUtil.d("data size " + data.size) LogUtil.d("data size " + data.size)
...@@ -762,10 +794,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -762,10 +794,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
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
rvExperts.visibility = View.VISIBLE rvExperts.visibility = View.VISIBLE
srlContainer.isRefreshing = false srlContainer.isRefreshing = false
} }
...@@ -774,27 +806,30 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -774,27 +806,30 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
isRecommend = false isRecommend = false
if (curPage == 1) { if (curPage == 1) {
v_loading.setViewType(LogoLoadingView.TYPE_NET_LOSS, getString(R.string.consultant_reload_hint)) v_loading.setViewType(
v_loading.visibility = View.VISIBLE LogoLoadingView.TYPE_NET_LOSS,
getString(R.string.consultant_reload_hint)
)
v_loading.visibility = View.VISIBLE
ll_network_error.visibility = View.GONE ll_network_error.visibility = View.GONE
} else { } else {
ToastHelper.show("网络不给力") ToastHelper.show("网络不给力")
} }
srlContainer.isRefreshing = false srlContainer.isRefreshing = false
} }
override fun fetchListEmpty(msg: String?) { override fun fetchListEmpty(msg: String?) {
isDoSearch = false isDoSearch = false
isRecommend = false isRecommend = false
tv_reload.visibility = View.GONE tv_reload.visibility = View.GONE
tv_reload_hint.text = msg tv_reload_hint.text = msg
ll_network_error.visibility = View.VISIBLE ll_network_error.visibility = View.VISIBLE
iv_exception.setImageResource(R.drawable.platform_ico_img_zixun_empty) iv_exception.setImageResource(R.drawable.platform_ico_img_zixun_empty)
rvExperts.visibility = View.GONE rvExperts.visibility = View.GONE
srlContainer.isRefreshing = false srlContainer.isRefreshing = false
} }
override fun fetchFailed(msg: String?) { override fun fetchFailed(msg: String?) {
...@@ -803,17 +838,20 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -803,17 +838,20 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (msg != null) { if (msg != null) {
ToastUtil.toastShort(msg) ToastUtil.toastShort(msg)
} }
v_loading.setViewType(LogoLoadingView.TYPE_NET_LOSS, getString(R.string.consultant_reload_hint)) v_loading.setViewType(
v_loading.visibility = View.VISIBLE LogoLoadingView.TYPE_NET_LOSS,
getString(R.string.consultant_reload_hint)
)
v_loading.visibility = View.VISIBLE
ll_network_error.visibility = View.GONE ll_network_error.visibility = View.GONE
rvExperts.visibility = View.GONE rvExperts.visibility = View.GONE
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
} }
override fun showRefreshLayout() { override fun showRefreshLayout() {
srlContainer.isRefreshing = true srlContainer.isRefreshing = true
} }
...@@ -825,8 +863,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -825,8 +863,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
R.id.tvSubject -> { R.id.tvSubject -> {
props1.put("filtrate_first", "主题") props1.put("filtrate_first", "主题")
hideSoftInput() hideSoftInput()
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showSubjectPopupWindow() showSubjectPopupWindow()
}, 300); }, 300);
...@@ -834,8 +872,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -834,8 +872,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
R.id.tvArea -> { R.id.tvArea -> {
props1.put("filtrate_first", "地区") props1.put("filtrate_first", "地区")
hideSoftInput() hideSoftInput()
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showAreaPopupWindow() showAreaPopupWindow()
}, 300); }, 300);
...@@ -843,8 +881,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -843,8 +881,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
R.id.tvSort -> { R.id.tvSort -> {
props1.put("filtrate_first", "排序") props1.put("filtrate_first", "排序")
hideSoftInput() hideSoftInput()
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showSortPopupWindow() showSortPopupWindow()
}, 300); }, 300);
...@@ -852,8 +890,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -852,8 +890,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
R.id.tvFilter -> { R.id.tvFilter -> {
props1.put("filtrate_first", "筛选") props1.put("filtrate_first", "筛选")
hideSoftInput() hideSoftInput()
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showFilterPopupWindow() showFilterPopupWindow()
}, 300); }, 300);
...@@ -861,7 +899,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -861,7 +899,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
R.id.tv_guide -> { R.id.tv_guide -> {
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_CONSULT_GUIDE_CLICK) ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_CONSULT_GUIDE_CLICK)
val h5param = H5Params(HttpConfig.H5_URL+ "help/consultation/", "咨询指南") val h5param = H5Params(HttpConfig.H5_URL + "help/consultation/", "咨询指南")
h5param.isShowMenu = true h5param.isShowMenu = true
NewH5Activity.start(context, h5param) NewH5Activity.start(context, h5param)
} }
...@@ -872,19 +910,19 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -872,19 +910,19 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
R.id.rl_search -> { R.id.rl_search -> {
ARouter.getInstance() ARouter.getInstance()
.build("/consult/hot_search") .build("/consult/hot_search")
.withString(HOT_SEARCH_DOCTOR_NAME,tv_search_content.text.toString()) .withString(HOT_SEARCH_DOCTOR_NAME, tv_search_content.text.toString())
.navigation() .navigation()
} }
} }
} }
private fun scrollToTop() { private fun scrollToTop() {
if ((rvExperts.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition() > 10) { if ((rvExperts.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition() > 10) {
rvExperts.scrollToPosition(10) rvExperts.scrollToPosition(10)
rvExperts.smoothScrollToPosition(0) rvExperts.smoothScrollToPosition(0)
} else { } else {
rvExperts.smoothScrollToPosition(0) rvExperts.smoothScrollToPosition(0)
} }
} }
...@@ -911,8 +949,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -911,8 +949,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
val filterPopupWindow = FilterPopupWindow(context, headData?.filters!!, tempFilter) val filterPopupWindow = FilterPopupWindow(context, headData?.filters!!, tempFilter)
filterPopupWindow.setOnDismissListener { filterPopupWindow.setOnDismissListener {
// viewDim.visibility = View.INVISIBLE // viewDim.visibility = View.INVISIBLE
viewDim_filter.visibility = View.GONE viewDim_filter.visibility = View.GONE
if (allFilter.others.size + allFilter.enquiries.size + allFilter.ages.size + allFilter.title.size > 0 || !TextUtils.isEmpty(allFilter.priceRanges?.minPrice) || !TextUtils.isEmpty(allFilter.priceRanges?.maxPrice)) { if (allFilter.others.size + allFilter.enquiries.size + allFilter.ages.size + allFilter.title.size > 0 || !TextUtils.isEmpty(
allFilter.priceRanges?.minPrice
) || !TextUtils.isEmpty(allFilter.priceRanges?.maxPrice)
) {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_FILTERED) updateFilterTextViewStatus(tvFilter, FILTER_STATUS_FILTERED)
} else { } else {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_NORMAL) updateFilterTextViewStatus(tvFilter, FILTER_STATUS_NORMAL)
...@@ -925,7 +966,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -925,7 +966,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
filterPopupWindow.onFilterConfirmListener = this filterPopupWindow.onFilterConfirmListener = this
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN)
// viewDim.visibility = View.VISIBLE // viewDim.visibility = View.VISIBLE
viewDim_filter.visibility = View.VISIBLE viewDim_filter.visibility = View.VISIBLE
} else { } else {
ToastUtil.toastShort("数据初始化失败,请重试") ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead() getPresenter().fetchListHead()
...@@ -935,8 +976,19 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -935,8 +976,19 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//筛选确认回调 //筛选确认回调
override fun onFilterConfirmed() { override fun onFilterConfirmed() {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN)
LogUtil.d("filter: " + tempFilter.showType.value + "," + tempFilter.enquiries.map { it.value }.joinToString(",") + "," + tempFilter.ages.map { it.value }.joinToString(",") + "," + tempFilter.others.map { it.value }.joinToString(",")) LogUtil.d(
props1.put("filtrate_second", tempFilter.showType.value + "," + tempFilter.enquiries.map { it.value }.joinToString(",") + "," + tempFilter.ages.map { it.value }.joinToString(",") + "," + tempFilter.others.map { it.value }.joinToString(",")) "filter: " + tempFilter.showType.value + "," + tempFilter.enquiries.map { it.value }.joinToString(
","
) + "," + tempFilter.ages.map { it.value }.joinToString(",") + "," + tempFilter.others.map { it.value }.joinToString(
","
)
)
props1.put(
"filtrate_second",
tempFilter.showType.value + "," + tempFilter.enquiries.map { it.value }.joinToString(",") + "," + tempFilter.ages.map { it.value }.joinToString(
","
) + "," + tempFilter.others.map { it.value }.joinToString(",")
)
BuryPointUtils.buryPoint("Filtrate", props1) BuryPointUtils.buryPoint("Filtrate", props1)
...@@ -957,13 +1009,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -957,13 +1009,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (headData!!.highlighter.size > 0) { if (headData!!.highlighter.size > 0) {
for (index in 0.until(headData!!.highlighter.size)) { for (index in 0.until(headData!!.highlighter.size)) {
if (headData!!.highlighter[index].type == "4") { if (headData!!.highlighter[index].type == "4") {
var textview =lin_filter2.getChildAt(index) as TextView var textview = lin_filter2.getChildAt(index) as TextView
activity.runOnUiThread { activity.runOnUiThread {
textview.isSelected = false textview.isSelected = false
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
for (bean in allFilter.enquiries) { for (bean in allFilter.enquiries) {
if (TextUtils.equals(bean.key.toString(), headData!!.highlighter[index].id)) { if (TextUtils.equals(
bean.key.toString(),
headData!!.highlighter[index].id
)
) {
activity.runOnUiThread { activity.runOnUiThread {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -973,13 +1029,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -973,13 +1029,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
} }
if (headData!!.highlighter[index].type == "5") { if (headData!!.highlighter[index].type == "5") {
var textview =lin_filter2.getChildAt(index) as TextView var textview = lin_filter2.getChildAt(index) as TextView
activity.runOnUiThread { activity.runOnUiThread {
textview.isSelected = false textview.isSelected = false
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
for (bean in allFilter.ages) { for (bean in allFilter.ages) {
if (TextUtils.equals(bean.value.toString(), headData!!.highlighter[index].id)) { if (TextUtils.equals(
bean.value.toString(),
headData!!.highlighter[index].id
)
) {
activity.runOnUiThread { activity.runOnUiThread {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -989,13 +1049,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -989,13 +1049,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
} }
if (headData!!.highlighter[index].type == "6") { if (headData!!.highlighter[index].type == "6") {
var textview =lin_filter2.getChildAt(index) as TextView var textview = lin_filter2.getChildAt(index) as TextView
activity.runOnUiThread { activity.runOnUiThread {
textview.isSelected = false textview.isSelected = false
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
for (bean in allFilter.others) { for (bean in allFilter.others) {
if (TextUtils.equals(bean.key.toString(), headData!!.highlighter[index].id)) { if (TextUtils.equals(
bean.key.toString(),
headData!!.highlighter[index].id
)
) {
activity.runOnUiThread { activity.runOnUiThread {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -1006,13 +1070,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1006,13 +1070,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
if (headData!!.highlighter[index].type == "7") { if (headData!!.highlighter[index].type == "7") {
var textview =lin_filter2.getChildAt(index) as TextView var textview = lin_filter2.getChildAt(index) as TextView
activity.runOnUiThread { activity.runOnUiThread {
textview.isSelected = false textview.isSelected = false
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
for (bean in allFilter.title) { for (bean in allFilter.title) {
if (TextUtils.equals(bean.key.toString(), headData!!.highlighter[index].id)) { if (TextUtils.equals(
bean.key.toString(),
headData!!.highlighter[index].id
)
) {
activity.runOnUiThread { activity.runOnUiThread {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -1047,12 +1115,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1047,12 +1115,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
text = "筛选" text = "筛选"
} }
if (text?.length ?: 0 > 4) { if (text?.length ?: 0 > 4) {
tvFilter.text = text?.substring(0, 3) + "..." tvFilter.text = text?.substring(0, 3) + "..."
} else { } else {
tvFilter.text = text tvFilter.text = text
} }
} else { } else {
tvFilter.text = "筛选" tvFilter.text = "筛选"
} }
} }
...@@ -1064,7 +1132,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1064,7 +1132,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (headData?.reorder != null) { if (headData?.reorder != null) {
sortPopup = SortPopupWindow(activity, headData?.reorder!!, allFilter.reorder, this) sortPopup = SortPopupWindow(activity, headData?.reorder!!, allFilter.reorder, this)
sortPopup!!.setOnDismissListener { sortPopup!!.setOnDismissListener {
viewDim.visibility = View.INVISIBLE viewDim.visibility = View.INVISIBLE
if (allFilter.reorder != headData!!.reorder[0]) { if (allFilter.reorder != headData!!.reorder[0]) {
updateFilterTextViewStatus(tvSort, FILTER_STATUS_FILTERED) updateFilterTextViewStatus(tvSort, FILTER_STATUS_FILTERED)
} else { } else {
...@@ -1077,7 +1145,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1077,7 +1145,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
sortPopup!!.showAsDropDown(viewSep2) sortPopup!!.showAsDropDown(viewSep2)
updateFilterTextViewStatus(tvSort, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvSort, FILTER_STATUS_OPEN)
viewDim.visibility = View.VISIBLE viewDim.visibility = View.VISIBLE
} else { } else {
ToastUtil.toastShort("数据初始化失败,请重试") ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead() getPresenter().fetchListHead()
...@@ -1086,22 +1154,24 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1086,22 +1154,24 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//排序选择回调 //排序选择回调
override fun onSortItemSelected(sortItem: ReorderItem) { override fun onSortItemSelected(sortItem: ReorderItem) {
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_SORT_CLICK, sortItem.value ActionCountUtils.count(
?: "") ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_SORT_CLICK, sortItem.value
?: ""
)
if (sortItem.value.equals("综合排序")) { if (sortItem.value.equals("综合排序")) {
tvSort.text = "排序" tvSort.text = "排序"
} else if (sortItem.value?.length ?: 0 > 4) { } else if (sortItem.value?.length ?: 0 > 4) {
tvSort.text = sortItem.value?.substring(0, 3) + "..." tvSort.text = sortItem.value?.substring(0, 3) + "..."
} else { } else {
tvSort.text = sortItem.value tvSort.text = sortItem.value
} }
//判断排序选中,判断热门筛选中是否也有该排序 //判断排序选中,判断热门筛选中是否也有该排序
if (headData!!.highlighter.size > 0) { if (headData!!.highlighter.size > 0) {
for (index in 0.until(headData!!.highlighter.size)) { for (index in 0.until(headData!!.highlighter.size)) {
if (headData!!.highlighter[index].type == "3") { if (headData!!.highlighter[index].type == "3") {
var textview =lin_filter2.getChildAt(index) as TextView var textview = lin_filter2.getChildAt(index) as TextView
if (TextUtils.equals(sortItem.value, headData!!.highlighter[index].value)) { if (TextUtils.equals(sortItem.value, headData!!.highlighter[index].value)) {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -1127,82 +1197,88 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1127,82 +1197,88 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//显示地区弹窗 //显示地区弹窗
private fun showAreaPopupWindow() { private fun showAreaPopupWindow() {
if (headData?.region != null) { if (headData?.region != null) {
val regionPopupWindow = AreaPopupWindow(activity, headData?.region val regionPopupWindow = AreaPopupWindow(
?: ArrayList(), allFilter.region, allFilter.sub) activity, headData?.region
?: ArrayList(), allFilter.region, allFilter.sub
)
regionPopupWindow.showAsDropDown(viewSep2) regionPopupWindow.showAsDropDown(viewSep2)
viewDim.visibility = View.VISIBLE viewDim.visibility = View.VISIBLE
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
regionPopupWindow.setOnDismissListener { regionPopupWindow.setOnDismissListener {
viewDim.visibility = View.INVISIBLE viewDim.visibility = View.INVISIBLE
if (tvArea.text != "地区") { if (tvArea.text != "地区") {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED) updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED)
} else { } else {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL) updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
} }
} }
regionPopupWindow.onRegionSelectedListener = object : AreaPopupWindow.OnRegionSelectedListener { regionPopupWindow.onRegionSelectedListener =
override fun onRegionSelected(region: RegionItem, sub: SubItem) { object : AreaPopupWindow.OnRegionSelectedListener {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN) override fun onRegionSelected(region: RegionItem, sub: SubItem) {
allFilter.region = region updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
allFilter.sub = sub allFilter.region = region
if (region.key == null && sub.key == null) { allFilter.sub = sub
if (region.key == null && sub.key == null) {
// LogUtil.d("onRegionSelected: " + region.value) // LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value) // props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1) // BuryPointUtils.buryPoint("Filtrate", props1)
tvArea.text = "地区" tvArea.text = "地区"
} else if (region.key != null && sub.key == null) { } else if (region.key != null && sub.key == null) {
// LogUtil.d("onRegionSelected: " + region.value) // LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value) // props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1) // BuryPointUtils.buryPoint("Filtrate", props1)
if (region.value?.length ?: 0 > 4) { if (region.value?.length ?: 0 > 4) {
tvArea.text = region.value?.substring(0, 3) + "..." tvArea.text = region.value?.substring(0, 3) + "..."
} else {
tvArea.text = region.value
}
} else { } else {
tvArea.text = region.value
}
} else {
// LogUtil.d("onRegionSelected: " + sub.value) // LogUtil.d("onRegionSelected: " + sub.value)
// props1.put("filtrate_second", sub.value) // props1.put("filtrate_second", sub.value)
// BuryPointUtils.buryPoint("Filtrate", props1) // BuryPointUtils.buryPoint("Filtrate", props1)
if (sub.value?.length ?: 0 > 4) { if (sub.value?.length ?: 0 > 4) {
tvArea.text = sub.value?.substring(0, 3) + "..." tvArea.text = sub.value?.substring(0, 3) + "..."
} else { } else {
tvArea.text = sub.value tvArea.text = sub.value
}
} }
} ActionCountUtils.count(
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_AREA_CLICK, region.value + "|" + sub.value) ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_AREA_CLICK,
region.value + "|" + sub.value
//更新热门搜索显示状态 )
if (headData!!.highlighter.size > 0) {
for ((index, hot) in headData!!.highlighter!!.withIndex()) { //更新热门搜索显示状态
if (hot.type == "2" || hot.type == "8") { if (headData!!.highlighter.size > 0) {
var textview =lin_filter2.getChildAt(index) as TextView for ((index, hot) in headData!!.highlighter!!.withIndex()) {
//有选择城市 if (hot.type == "2" || hot.type == "8") {
if (!TextUtils.isEmpty(sub.key)) { var textview = lin_filter2.getChildAt(index) as TextView
if (TextUtils.equals(sub.key, hot.id)) { //有选择城市
textview.isSelected = true if (!TextUtils.isEmpty(sub.key)) {
textview.paint.isFakeBoldText = true if (TextUtils.equals(sub.key, hot.id)) {
hasSelectedArea = true textview.isSelected = true
} else { textview.paint.isFakeBoldText = true
textview.isSelected = false hasSelectedArea = true
textview.paint.isFakeBoldText = false } else {
} textview.isSelected = false
} else { textview.paint.isFakeBoldText = false
if (TextUtils.equals(region.key, hot.id)) { }
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else { } else {
textview.isSelected = false if (TextUtils.equals(region.key, hot.id)) {
textview.paint.isFakeBoldText = false textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
} }
} }
} }
} }
regionPopupWindow.dismiss()
refresh()
} }
regionPopupWindow.dismiss()
refresh()
} }
}
} else { } else {
ToastUtil.toastShort("数据初始化失败,请重试") ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead() getPresenter().fetchListHead()
...@@ -1219,7 +1295,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1219,7 +1295,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (categories != null) { if (categories != null) {
categoryPopup = CategoryPopupWindow(activity, categories, tempFilter.categories) categoryPopup = CategoryPopupWindow(activity, categories, tempFilter.categories)
categoryPopup!!.setOnDismissListener { categoryPopup!!.setOnDismissListener {
viewDim.visibility = View.INVISIBLE viewDim.visibility = View.INVISIBLE
if (allFilter.categories.size > 1 || (allFilter.categories.size == 1 && allFilter.categories[0] != headData!!.cates[0])) { if (allFilter.categories.size > 1 || (allFilter.categories.size == 1 && allFilter.categories[0] != headData!!.cates[0])) {
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED) updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
} else { } else {
...@@ -1229,7 +1305,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1229,7 +1305,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
categoryPopup!!.onSubjectsSelectedListener = this categoryPopup!!.onSubjectsSelectedListener = this
categoryPopup!!.showAsDropDown(viewSep2) categoryPopup!!.showAsDropDown(viewSep2)
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
viewDim.visibility = View.VISIBLE viewDim.visibility = View.VISIBLE
} else { } else {
ToastUtil.toastShort("数据初始化失败,请重试") ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead() getPresenter().fetchListHead()
...@@ -1242,26 +1318,33 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1242,26 +1318,33 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
* 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态 * 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态
*/ */
override fun onCategoriesSelected(categories: ArrayList<CateItem>) { override fun onCategoriesSelected(categories: ArrayList<CateItem>) {
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_THEME_CLICK, categories.map { it.cateName }.joinToString("|")) ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_THEME_CLICK,
categories.map { it.cateName }.joinToString("|")
)
if (categories.size == 1 && "全部" != categories[0].cateName) { if (categories.size == 1 && "全部" != categories[0].cateName) {
//显示选中标题 //显示选中标题
tvSubject.text = categories[0].cateName tvSubject.text = categories[0].cateName
} else { } else {
//显示主标题 //显示主标题
tvSubject.text = "主题" tvSubject.text = "主题"
} }
//判断主题选中,判断热门筛选中是否也有该主题 //判断主题选中,判断热门筛选中是否也有该主题
Executors.newCachedThreadPool().execute { Executors.newCachedThreadPool().execute {
if (headData!!.highlighter.size > 0) { if (headData!!.highlighter.size > 0) {
for (index in 0.until(headData!!.highlighter.size)) { for (index in 0.until(headData!!.highlighter.size)) {
if (headData!!.highlighter[index].type == "1") { if (headData!!.highlighter[index].type == "1") {
var textview =lin_filter2.getChildAt(index) as TextView var textview = lin_filter2.getChildAt(index) as TextView
activity.runOnUiThread { activity.runOnUiThread {
textview.isSelected = false textview.isSelected = false
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
for (bean in categories) { for (bean in categories) {
if (TextUtils.equals(bean.cateName, headData!!.highlighter[index].value)) { if (TextUtils.equals(
bean.cateName,
headData!!.highlighter[index].value
)
) {
activity.runOnUiThread { activity.runOnUiThread {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -1296,8 +1379,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1296,8 +1379,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//刷新列表 //刷新列表
private fun refresh(isShowRefresh: Boolean? = true) { private fun refresh(isShowRefresh: Boolean? = true) {
srlContainer.isRefreshing = isShowRefresh!! srlContainer.isRefreshing = isShowRefresh!!
val key =tv_search_content.text.toString() val key = tv_search_content.text.toString()
if (!TextUtils.isEmpty(key.trim())) { if (!TextUtils.isEmpty(key.trim())) {
allFilter.searchWord = key.trim() allFilter.searchWord = key.trim()
} else { } else {
...@@ -1311,7 +1394,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1311,7 +1394,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//执行搜索 //执行搜索
private fun doSearch() { private fun doSearch() {
image_scroll_top.visibility = View.GONE image_scroll_top.visibility = View.GONE
hideSoftInput(); hideSoftInput();
// keyWord = etSearch.text.toString() // keyWord = etSearch.text.toString()
// if (TextUtils.isEmpty(keyWord?.trim())) { // if (TextUtils.isEmpty(keyWord?.trim())) {
...@@ -1319,7 +1402,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1319,7 +1402,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
// return // return
// } // }
ActionCountUtils.count(ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK, keyWord ?: "") ActionCountUtils.count(
ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK,
keyWord ?: ""
)
isDoSearch = true isDoSearch = true
resetFilter() resetFilter()
refresh() refresh()
...@@ -1355,17 +1441,32 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1355,17 +1441,32 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
FILTER_STATUS_NORMAL -> { FILTER_STATUS_NORMAL -> {
tv.typeface = Typeface.defaultFromStyle(Typeface.NORMAL) tv.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
tv.setTextColor(ContextCompat.getColor(context, R.color.platform_colorTextDefault)) tv.setTextColor(ContextCompat.getColor(context, R.color.platform_colorTextDefault))
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.platform_ic_arrow_drop_down_grey_500_18dp, 0) tv.setCompoundDrawablesWithIntrinsicBounds(
0,
0,
R.drawable.platform_ic_arrow_drop_down_grey_500_18dp,
0
)
} }
FILTER_STATUS_FILTERED -> { FILTER_STATUS_FILTERED -> {
tv.typeface = Typeface.DEFAULT_BOLD tv.typeface = Typeface.DEFAULT_BOLD
tv.setTextColor(ContextCompat.getColor(context, R.color.consultant_main_theme)) tv.setTextColor(ContextCompat.getColor(context, R.color.consultant_main_theme))
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.platform_ic_arrow_drop_down_grey_500_18dp, 0) tv.setCompoundDrawablesWithIntrinsicBounds(
0,
0,
R.drawable.platform_ic_arrow_drop_down_grey_500_18dp,
0
)
} }
FILTER_STATUS_OPEN -> { FILTER_STATUS_OPEN -> {
tv.typeface = Typeface.DEFAULT_BOLD tv.typeface = Typeface.DEFAULT_BOLD
tv.setTextColor(ContextCompat.getColor(context, R.color.platform_colorTextDefault)) tv.setTextColor(ContextCompat.getColor(context, R.color.platform_colorTextDefault))
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.consultant_ic_arrow_drop_down, 0) tv.setCompoundDrawablesWithIntrinsicBounds(
0,
0,
R.drawable.consultant_ic_arrow_drop_down,
0
)
} }
} }
} }
...@@ -1383,11 +1484,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1383,11 +1484,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
*/ */
fun bury(keyworks: String, isResult: Boolean, isRecommend: Boolean, location: String) { fun bury(keyworks: String, isResult: Boolean, isRecommend: Boolean, location: String) {
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
.put("keyWord", keyworks) .put("keyWord", keyworks)
.put("hasResult", isResult) .put("hasResult", isResult)
.put("isRecommend", isRecommend) .put("isRecommend", isRecommend)
.put("location", location) .put("location", location)
.burryPoint("search") .burryPoint("search")
} }
override fun onResume() { override fun onResume() {
......
...@@ -38,8 +38,11 @@ import kotlinx.android.synthetic.main.consultant_item_tag.view.* ...@@ -38,8 +38,11 @@ import kotlinx.android.synthetic.main.consultant_item_tag.view.*
/** /**
* 专家服务列表适配器 * 专家服务列表适配器
*/ */
class ExpertSearchAdapter(private val context: Context, private val expertSearchView : IExpertSearchView, private val listData: ArrayList<DoctorServiceItem>) class ExpertSearchAdapter(
: RecyclerView.Adapter<RecyclerView.ViewHolder>() { private val context: Context,
private val expertSearchView: IExpertSearchView,
private val listData: ArrayList<DoctorServiceItem>
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
companion object { companion object {
const val NORMAL_VIEW = 0 const val NORMAL_VIEW = 0
...@@ -48,14 +51,16 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -48,14 +51,16 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
} }
//记录当前选择主题的id //记录当前选择主题的id
var cateId : String? = null var cateId: String? = null
var hasMore = true var hasMore = true
var entranceName: String? = null var entranceName: String? = null
var pageIndex: Int = 0
fun setEntrance(entranceName: String) { fun setEntrance(entranceName: String, pageIndex: Int) {
this.entranceName = entranceName this.entranceName = entranceName
this.pageIndex = pageIndex
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
...@@ -66,47 +71,46 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -66,47 +71,46 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
val headConfig = SimpleImageOpConfiger() val headConfig = SimpleImageOpConfiger()
headConfig.loadingPic = R.drawable.consultant_avatar_def_circle headConfig.loadingPic = R.drawable.consultant_avatar_def_circle
headConfig.errorPic = R.drawable.consultant_avatar_def_circle headConfig.errorPic = R.drawable.consultant_avatar_def_circle
expertSearchView.showImage(itemBean.head,holder.imgHead,holder.imgHead.width,holder.imgHead.height,headConfig) expertSearchView.showImage(
itemBean.head,
holder.imgHead,
holder.imgHead.width,
holder.imgHead.height,
headConfig
)
//姓名 //姓名
holder.tvName.text = itemBean.name holder.tvName.text = itemBean.name
// if (TextUtils.isEmpty(itemBean.famousRemark)){
// holder.group_desc.visibility = View.GONE
// }else{
// holder.group_desc.visibility = View.VISIBLE
// //描述
// holder.tvDesc.text = itemBean.famousRemark
// }
//服务中 //服务中
if (itemBean.inConsult || itemBean.isListening) { if (itemBean.inConsult || itemBean.isListening) {
holder.imgHead_online_server.visibility = View.VISIBLE holder.imgHead_online_server.visibility = View.VISIBLE
holder.chat_people_in_question.visibility = View.GONE holder.chat_people_in_question.visibility = View.GONE
holder.imgHead_online.visibility = View.GONE holder.imgHead_online.visibility = View.GONE
}else { } else {
//不是服务中且问询人数大于0 //不是服务中且问询人数大于0
if (itemBean.chatNum > 5) { if (itemBean.chatNum > 5) {
holder.chat_people_in_question.visibility = View.VISIBLE holder.chat_people_in_question.visibility = View.VISIBLE
holder.chat_people_in_question.text = "多人在问询" holder.chat_people_in_question.text = "多人在问询"
}else if (itemBean.chatNum > 0){ } else if (itemBean.chatNum > 0) {
holder.chat_people_in_question.visibility = View.VISIBLE holder.chat_people_in_question.visibility = View.VISIBLE
holder.chat_people_in_question.text = "${itemBean.chatNum}人在问询" holder.chat_people_in_question.text = "${itemBean.chatNum}人在问询"
}else { } else {
holder.chat_people_in_question.visibility = View.GONE holder.chat_people_in_question.visibility = View.GONE
} }
//可预约 //可预约
holder.imgHead_online_server.visibility = View.GONE holder.imgHead_online_server.visibility = View.GONE
if (itemBean.isTodayFree == true){ if (itemBean.isTodayFree == true) {
holder.imgHead_online.visibility = View.VISIBLE holder.imgHead_online.visibility = View.VISIBLE
}else{ } else {
holder.imgHead_online.visibility = View.GONE holder.imgHead_online.visibility = View.GONE
} }
} }
//省市 //省市
if (!TextUtils.isEmpty(itemBean.province)){ if (!TextUtils.isEmpty(itemBean.province)) {
holder.tvCity.text = itemBean.province+"·"+itemBean.city holder.tvCity.text = itemBean.province + "·" + itemBean.city
}else{ } else {
holder.tvCity.text = "" holder.tvCity.text = ""
} }
...@@ -151,20 +155,13 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -151,20 +155,13 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
holder.imgAbilityLevel.background = holder.imgAbilityLevel.background =
context.resources.getDrawable(R.drawable.consultant_expert_search_xinshou) context.resources.getDrawable(R.drawable.consultant_expert_search_xinshou)
holder.imgAbilityLevel.visibility = View.VISIBLE holder.imgAbilityLevel.visibility = View.VISIBLE
} } else {
// else if (3 == itemBean.abilityLevel){
// //精英
// holder.imgAbilityLevel.background = context.resources.getDrawable(R.drawable.consultant_expert_search_jingying)
// holder.imgAbilityLevel.visibility = View.VISIBLE
// }
else {
holder.imgAbilityLevel.visibility = View.GONE holder.imgAbilityLevel.visibility = View.GONE
} }
//活动图标 //活动图标
if (!TextUtils.isEmpty(itemBean.activityImg)) { if (!TextUtils.isEmpty(itemBean.activityImg)) {
holder.imgActivity.visibility = View.VISIBLE holder.imgActivity.visibility = View.VISIBLE
GlideApp.with(context).load(itemBean.activityImg).into(holder.imgActivity) GlideApp.with(context).load(itemBean.activityImg).into(holder.imgActivity)
// GlideApp.with(context).load("https://video.ydlcdn.com/2019/11/04/abdd3782c98939d0406080a6a80b8ea5.jpg").into(holder.imgActivity)
} else { } else {
holder.imgActivity.visibility = View.GONE holder.imgActivity.visibility = View.GONE
} }
...@@ -187,29 +184,38 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -187,29 +184,38 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
} }
} }
holder.ll_feedbackRate.removeAllViews() holder.ll_feedbackRate.removeAllViews()
for (num in 1..5){ for (num in 1..5) {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_expert_search_feedbackrate, holder.ll_feedbackRate, false) val view = LayoutInflater.from(context).inflate(
if (itemBean.feedbackRate >= num){ R.layout.consultant_expert_search_feedbackrate,
(view.imgRate as ImageView).background = context.resources.getDrawable(R.drawable.consultant_expert_search_full_star) holder.ll_feedbackRate,
}else if (itemBean.feedbackRate < num && itemBean.feedbackRate > num - 1){ false
(view.imgRate as ImageView).background = context.resources.getDrawable(R.drawable.consultant_expert_search_half_star) )
}else{ if (itemBean.feedbackRate >= num) {
(view.imgRate as ImageView).background = context.resources.getDrawable(R.drawable.consultant_expert_search_nothing_star) (view.imgRate as ImageView).background =
context.resources.getDrawable(R.drawable.consultant_expert_search_full_star)
} else if (itemBean.feedbackRate < num && itemBean.feedbackRate > num - 1) {
(view.imgRate as ImageView).background =
context.resources.getDrawable(R.drawable.consultant_expert_search_half_star)
} else {
(view.imgRate as ImageView).background =
context.resources.getDrawable(R.drawable.consultant_expert_search_nothing_star)
} }
holder.ll_feedbackRate.addView(view) holder.ll_feedbackRate.addView(view)
} }
//XXX人点评 //XXX人点评
val numSb = StringBuffer() val numSb = StringBuffer()
holder.tv_zixunOrderNum.text = numSb.append(itemBean.zixunOrderNum).append("").toString() holder.tv_zixunOrderNum.text =
numSb.append(itemBean.zixunOrderNum).append("").toString()
//咨询师简介 //咨询师简介
holder.tvTeamCertifications.text = itemBean.teamCertifications holder.tvTeamCertifications.text = itemBean.teamCertifications
//咨询师标签 //咨询师标签
holder.ll_tags.removeAllViews() holder.ll_tags.removeAllViews()
if (!TextUtils.isEmpty(itemBean.tags)){ if (!TextUtils.isEmpty(itemBean.tags)) {
val tagList = itemBean.tags!!.split("|") val tagList = itemBean.tags!!.split("|")
for (tag in tagList) { for (tag in tagList) {
if (!TextUtils.isEmpty(tag)){ if (!TextUtils.isEmpty(tag)) {
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)
view.tvTag.text = tag view.tvTag.text = tag
holder.ll_tags.addView(view) holder.ll_tags.addView(view)
} }
...@@ -218,49 +224,61 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -218,49 +224,61 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
//帮助人数 //帮助人数
val orderUser = StringBuffer() val orderUser = StringBuffer()
holder.tvOrderNum.text = orderUser.append(itemBean.zixunOrderUser).append("").toString() holder.tvOrderNum.text = orderUser.append(itemBean.zixunOrderUser).append("").toString()
// if ( 50 <= itemBean.zixunOrderNum){
// holder.tvOrderNumContent.text = "帮助"
// holder.tvSaleDurationForMonth.visibility = View.VISIBLE
// holder.tvSaleDurationForMonthContent.visibility = View.VISIBLE
// }else{
// holder.tvOrderNumContent.text = "公益解答"
// holder.tvSaleDurationForMonth.visibility = View.GONE
// holder.tvSaleDurationForMonthContent.visibility = View.GONE
// }
//私聊文案 //私聊文案
if (TextUtils.isEmpty(itemBean.chatBtnText)){ if (TextUtils.isEmpty(itemBean.chatBtnText)) {
holder.tvChat.text = "私聊" holder.tvChat.text = "私聊"
holder.tvChat.setTextColor(ContextCompat.getColor(context,R.color.consultant_confirm_text_color)) holder.tvChat.setTextColor(
holder.tvChat.background = ContextCompat.getDrawable(context,R.drawable.consultant_expert_search_chat) ContextCompat.getColor(
}else{ context,
R.color.consultant_confirm_text_color
)
)
holder.tvChat.background =
ContextCompat.getDrawable(context, R.drawable.consultant_expert_search_chat)
} else {
holder.tvChat.text = itemBean.chatBtnText holder.tvChat.text = itemBean.chatBtnText
holder.tvChat.setTextColor(ContextCompat.getColor(context,R.color.platform_color_999999)) holder.tvChat.setTextColor(
holder.tvChat.background = ContextCompat.getDrawable(context,R.drawable.consultant_expert_search_chat_rest) ContextCompat.getColor(
context,
R.color.platform_color_999999
)
)
holder.tvChat.background = ContextCompat.getDrawable(
context,
R.drawable.consultant_expert_search_chat_rest
)
} }
//服务时长 //服务时长
val durationStringBuffer = StringBuffer() val durationStringBuffer = StringBuffer()
holder.tvSaleDurationForMonth.text = durationStringBuffer.append(itemBean.allSaleDuration.toInt()).append("").toString() holder.tvSaleDurationForMonth.text =
durationStringBuffer.append(itemBean.allSaleDuration.toInt()).append("").toString()
//价格 //价格
val sb = StringBuffer() val sb = StringBuffer()
holder.tvPrice.text = sb.append("").append(itemBean.minBookingPrice).toString() holder.tvPrice.text = sb.append("").append(itemBean.minBookingPrice).toString()
//套餐 //套餐
holder.ll_products.removeAllViews() holder.ll_products.removeAllViews()
if (null != itemBean.products && !itemBean.products.isEmpty()){ if (null != itemBean.products && !itemBean.products.isEmpty()) {
for (item in itemBean.products) { for (item in itemBean.products) {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_expert_search_products_item, holder.ll_tags, false) val view = LayoutInflater.from(context).inflate(
if (1 == item.isPackage){ R.layout.consultant_expert_search_products_item,
holder.ll_tags,
false
)
if (1 == item.isPackage) {
view.tvTitle.text = "单次" view.tvTitle.text = "单次"
view.tvTitle.setTextColor(context.resources.getColor(R.color.platform_color_1DA1F2)) view.tvTitle.setTextColor(context.resources.getColor(R.color.platform_color_1DA1F2))
view.tvTitle.background = context.resources.getDrawable(R.drawable.consultant_expert_search_single) view.tvTitle.background =
context.resources.getDrawable(R.drawable.consultant_expert_search_single)
view.tvContent.text = item.name view.tvContent.text = item.name
holder.ll_products.addView(view) holder.ll_products.addView(view)
} else if (2 == item.isPackage){ } else if (2 == item.isPackage) {
view.tvTitle.text = "套餐" view.tvTitle.text = "套餐"
view.tvTitle.setTextColor(context.resources.getColor(R.color.consultant_color_FF9500)) view.tvTitle.setTextColor(context.resources.getColor(R.color.consultant_color_FF9500))
view.tvTitle.background = context.resources.getDrawable(R.drawable.consultant_expert_search_menu) view.tvTitle.background =
context.resources.getDrawable(R.drawable.consultant_expert_search_menu)
view.tvContent.text = item.name view.tvContent.text = item.name
holder.ll_products.addView(view) holder.ll_products.addView(view)
}else{ } else {
} }
} }
...@@ -277,27 +295,31 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -277,27 +295,31 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
} }
} }
override fun getItemCount(): Int = if (listData.size < ExpertSearchActivity.PAGE_SIZE && hasMore) { override fun getItemCount(): Int =
listData.size if (listData.size < ExpertSearchActivity.PAGE_SIZE && hasMore) {
} else { listData.size
listData.size + 1 } else {
} 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) {
NORMAL_VIEW -> { NORMAL_VIEW -> {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_expert_search_item_view, parent, false) val view = LayoutInflater.from(context)
NormalViewHolder(view) .inflate(R.layout.consultant_expert_search_item_view, parent, false)
} NormalViewHolder(view)
FOOT_VIEW -> { }
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_footer, parent, false) FOOT_VIEW -> {
FooterViewHolder(view) val view = LayoutInflater.from(context)
} .inflate(R.layout.consultant_item_footer, parent, false)
else -> { FooterViewHolder(view)
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_empty, parent, false) }
EmptyViewHolder(view) else -> {
} val view = LayoutInflater.from(context)
.inflate(R.layout.consultant_item_empty, parent, false)
EmptyViewHolder(view)
} }
}
override fun getItemViewType(position: Int): Int = when { override fun getItemViewType(position: Int): Int = when {
position < listData.size -> NORMAL_VIEW position < listData.size -> NORMAL_VIEW
...@@ -362,27 +384,45 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -362,27 +384,45 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
val itemBean = listData[adapterPosition] val itemBean = listData[adapterPosition]
var linkUrl = itemBean.linkUrl var linkUrl = itemBean.linkUrl
if (!TextUtils.isEmpty(cateId)){ if (!TextUtils.isEmpty(cateId)) {
linkUrl = URLUtils.appendParmas(linkUrl,"cateId",cateId) linkUrl = URLUtils.appendParmas(linkUrl, "cateId", cateId)
} }
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_DOCTOR_CLICK,itemBean.doctorId?:"")
TempH5RouteUtils.tempH5Route(linkUrl)
// var params = URLDecoder.decode( Uri.parse(linkUrl)!!.getQueryParameter("params"),"UTF-8") if (pageIndex == 0) {
// ARouter.getInstance().build("/h5/h5").withSerializable("routerParam",params).navigation() ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_DOCTOR_CLICK,
itemBean.doctorId ?: ""
)
} else {
ActionCountUtils.count(
ConsultBIConstants.ConsultSearchListEvent.APP_CONSULT_SEARCH_LIST_CONSULT_ITEM_CLICK,
itemBean.doctorId ?: ""
)
}
TempH5RouteUtils.tempH5Route(linkUrl)
} }
} }
itemView.tvChat.setOnClickListener { itemView.tvChat.setOnClickListener {
if (adapterPosition != RecyclerView.NO_POSITION) { if (adapterPosition != RecyclerView.NO_POSITION) {
//判断是否已登录 //判断是否已登录
if(!ConsultantIn.getUserImpl().isLogin()){ if (!ConsultantIn.getUserImpl().isLogin()) {
TempH5RouteUtils.tempH5Route(IYDLRouterConstant.ROUTER_MINE_LOGIN) TempH5RouteUtils.tempH5Route(IYDLRouterConstant.ROUTER_MINE_LOGIN)
return@setOnClickListener return@setOnClickListener
} }
val doctor = listData[adapterPosition] val doctor = listData[adapterPosition]
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_CHAT_CLICK,doctor.doctorId?:"") if (pageIndex == 0) {
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_CHAT_CLICK,
doctor.doctorId ?: ""
)
} else {
ActionCountUtils.count(
ConsultBIConstants.ConsultSearchListEvent.APP_CONSULT_SEARCH_LIST_CHAT_CLICK,
doctor.doctorId ?: ""
)
}
if (!TextUtils.isEmpty(doctor.uid)) { if (!TextUtils.isEmpty(doctor.uid)) {
//跳转私聊 //跳转私聊
...@@ -393,10 +433,10 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -393,10 +433,10 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
if (!TextUtils.isEmpty(entranceName)) { if (!TextUtils.isEmpty(entranceName)) {
LogUtil.d("entrance name: $entranceName") LogUtil.d("entrance name: $entranceName")
BuryPointUtils.getInstance().createMap() BuryPointUtils.getInstance().createMap()
.put("expert_entrance", entranceName?:"") .put("expert_entrance", entranceName ?: "")
.put("expert_ID", doctor.doctorId?:0) .put("expert_ID", doctor.doctorId ?: 0)
.put("expert_name", doctor.name?:"") .put("expert_name", doctor.name ?: "")
.burryPoint("Chat_click") .burryPoint("Chat_click")
} }
} }
} }
......
...@@ -32,6 +32,19 @@ class ConsultBIConstants { ...@@ -32,6 +32,19 @@ class ConsultBIConstants {
const val APP_CONSULT_LIST_CHAT_CLICK: String = APP_CONSULT_LIST_PAGE + "app_consult_list_chat_click"//每个咨询师私聊 const val APP_CONSULT_LIST_CHAT_CLICK: String = APP_CONSULT_LIST_PAGE + "app_consult_list_chat_click"//每个咨询师私聊
} }
} }
class ConsultSearchListEvent {
companion object {
private const val CONSULT_SEARCH_LIST_PAGE: String = "consul_search_list_page|"//APP咨询搜索列表页 partId
const val APP_CONSULT_SEARCH_LIST_PAGE_VISIT: String = CONSULT_SEARCH_LIST_PAGE + "consul_search_list_page_visit"//列表页浏览事件
const val APP_CONSULT_SEARCH_LIST_CONSULT_ITEM_CLICK: String = CONSULT_SEARCH_LIST_PAGE + "consult_search_list_doctor_click "//每个咨询师页面点击
const val APP_CONSULT_SEARCH_LIST_CHAT_CLICK: String = CONSULT_SEARCH_LIST_PAGE + "consult__search_list_chat_click"//每个咨询师私聊
}
}
class UserMainEvent { class UserMainEvent {
companion object { companion object {
......
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