Commit 2e5b358b by upwork.021

feat: 小众病症联想词代码提交

parent 1d79f603
...@@ -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.39", "m-consultant" : "0.0.60.45",
"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.80", "m-home" : "0.0.23.80",
...@@ -92,7 +92,7 @@ ext { ...@@ -92,7 +92,7 @@ ext {
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.72", "m-confide" : "0.0.49.72",
"m-consultant" : "0.0.60.31", "m-consultant" : "0.0.60.44",
"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.41", "m-home" : "0.0.23.41",
......
...@@ -9,10 +9,7 @@ import android.content.Context ...@@ -9,10 +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.Handler import android.os.Handler
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.TextUtils import android.text.TextUtils
import android.text.style.StyleSpan
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
...@@ -236,14 +233,17 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -236,14 +233,17 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
onBackPressed() onBackPressed()
} }
doctorAdapter = ExpertSearchAdapter(this, this, doctorList) doctorAdapter = ExpertSearchAdapter(this, this, doctorList)
val layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
rvExperts.adapter = doctorAdapter
val layoutManager = LinearLayoutManager(
this,
LinearLayoutManager.VERTICAL,
false
)
rvExperts.layoutManager = layoutManager rvExperts.layoutManager = layoutManager
rvExperts.adapter = doctorAdapter
doctorAdapter.setOnClickLister(object: ExpertSearchAdapter.OnClickLister{
override fun onClick(searchWords: String) {
allFilter.searchWord = searchWords
refresh(false)
}
})
onScrollListener = object : EndlessRecyclerViewScrollListener(layoutManager) { onScrollListener = object : EndlessRecyclerViewScrollListener(layoutManager) {
private var isBtnShow: Boolean = false private var isBtnShow: Boolean = false
private var sIsScrolling = false private var sIsScrolling = false
...@@ -333,19 +333,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -333,19 +333,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
} }
} }
// rvExperts.addItemDecoration(ExpertItemDecoration(this))
rvExperts.addOnScrollListener(onScrollListener) rvExperts.addOnScrollListener(onScrollListener)
rvExperts.addOnScrollListener(YDLImageRecyclerOnScrollListener(ExpertSearchActivity@ this)) rvExperts.addOnScrollListener(YDLImageRecyclerOnScrollListener(ExpertSearchActivity@ this))
// etSearch.addTextChangedListener(object : TextWatcher {
// override fun afterTextChanged(s: Editable?) {}
//
// override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
//
// override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
//
// }
//
// })
image_scroll_top.setOnClickListener(this) image_scroll_top.setOnClickListener(this)
// initStatus() // initStatus()
...@@ -414,10 +403,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -414,10 +403,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
tv_search_content.text = searchWord tv_search_content.text = searchWord
// 判断搜索词和联想词不一样,则显示匹配结果 // 判断搜索词和联想词不一样,则显示匹配结果
if (!TextUtils.isEmpty(searchWord)&&!TextUtils.isEmpty(relatedWord)&&searchWord!=relatedWord){ if (!TextUtils.isEmpty(searchWord)&&!TextUtils.isEmpty(relatedWord)&&searchWord!=relatedWord){
cl_search_words.visibility = View.VISIBLE doctorList.add(ExpertServiceItem(true,searchWord,relatedWord))
val text = "根据匹配,为您推荐“${relatedWord}”相关词"
tv_search_related_word.text = setTextBold(text,relatedWord)
} }
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null) v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
...@@ -823,7 +811,13 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -823,7 +811,13 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
hasMore = false hasMore = false
doctorAdapter.hasMore = false doctorAdapter.hasMore = false
} }
doctorList.clear() if (doctorList.size>0){
val expertServiceItem = doctorList[0]
doctorList.clear()
doctorList.add(expertServiceItem)
}else{
doctorList.clear()
}
} }
if (data.size==0) { // data的长度为0的时候为最后一页 if (data.size==0) { // data的长度为0的时候为最后一页
...@@ -871,14 +865,23 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -871,14 +865,23 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
isDoSearch = false isDoSearch = false
isRecommend = false isRecommend = false
tv_reload.visibility = View.GONE if (doctorList.size==0||doctorList.size>0&&TextUtils.isEmpty(doctorList[0].related_word)){
tv_reload_hint.text = msg tv_reload.visibility = View.GONE
ll_network_error.visibility = View.VISIBLE tv_reload_hint.text = msg
iv_exception.setImageResource(R.drawable.platform_ico_img_zixun_empty) ll_network_error.visibility = View.VISIBLE
iv_exception.setImageResource(R.drawable.platform_ico_img_zixun_empty)
rvExperts.visibility = View.GONE rvExperts.visibility = View.GONE
dismissProgressDialog() dismissProgressDialog()
srlContainer.isRefreshing = false srlContainer.isRefreshing = false
}else{
doctorAdapter.notifyDataSetChanged()
v_loading.visibility = View.GONE
ll_network_error.visibility = View.GONE
rvExperts.visibility = View.VISIBLE
}
} }
...@@ -963,7 +966,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -963,7 +966,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
ActionCountUtils.count(YDL_USER_CONSULT_SEARCH_CLICK) ActionCountUtils.count(YDL_USER_CONSULT_SEARCH_CLICK)
ARouter.getInstance() ARouter.getInstance()
.build("/consult/hot_search") .build("/consult/hot_search")
.withString(HOT_SEARCH_DOCTOR_NAME, allFilter.searchWord) .withString(HOT_SEARCH_DOCTOR_NAME, tv_search_content.text.toString())
.navigation() .navigation()
} }
} }
...@@ -1420,30 +1423,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1420,30 +1423,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
onScrollListener.resetState() onScrollListener.resetState()
getPresenter().mExtras=null getPresenter().mExtras=null
getPresenter().fetchListData(allFilter, getPresenter().mExtras) getPresenter().fetchListData(allFilter, getPresenter().mExtras)
doctorList.clear()
rvExperts.scrollToPosition(0) rvExperts.scrollToPosition(0)
} }
//执行搜索
private fun doSearch() {
image_scroll_top.visibility = View.GONE
hideSoftInput()
// keyWord = etSearch.text.toString()
// if (TextUtils.isEmpty(keyWord?.trim())) {
// ToastUtil.toastShort(this, "请输入搜索内容")
// return
// }
ActionCountUtils.count(
ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK,
cateName ?: ""
)
isDoSearch = true
resetFilter()
refresh()
}
//重置所有筛选 //重置所有筛选
private fun resetFilter() { private fun resetFilter() {
allFilter.categories.clear() allFilter.categories.clear()
...@@ -1524,22 +1506,4 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1524,22 +1506,4 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
mHandler=null mHandler=null
ConsultAssistantDialogUtils.INSTANCE.expertSearchResetStatus() ConsultAssistantDialogUtils.INSTANCE.expertSearchResetStatus()
} }
private fun setTextBold(text: String, content: String): SpannableStringBuilder {
return if (text.contains(content)) {
val s1 = text.split(content)[0]
val s2 = text.split(content)[1]
val spannableBuilder1 = SpannableStringBuilder(s1)
val spannableBuilder2 = SpannableStringBuilder(content)
spannableBuilder2.setSpan(
StyleSpan(Typeface.BOLD),
0,
content.length,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
spannableBuilder1.append(spannableBuilder2).append(SpannableStringBuilder(s2))
} else {
SpannableStringBuilder(text)
}
}
} }
...@@ -280,16 +280,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -280,16 +280,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
rvExperts.addOnScrollListener(onScrollListener) rvExperts.addOnScrollListener(onScrollListener)
rvExperts.addOnScrollListener(YDLImageRecyclerOnScrollListener(activity)) rvExperts.addOnScrollListener(YDLImageRecyclerOnScrollListener(activity))
// etSearch.addTextChangedListener(object : TextWatcher {
// override fun afterTextChanged(s: Editable?) {}
//
// override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
//
// override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
//
// }
//
// })
image_scroll_top.setOnClickListener(this) image_scroll_top.setOnClickListener(this)
} }
...@@ -734,6 +724,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -734,6 +724,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
doctorAdapter.hasMore = false doctorAdapter.hasMore = false
} }
doctorList.clear() doctorList.clear()
// 加入头部数据并隐藏,否则点击事件position会错乱
doctorList.add(ExpertServiceItem(false,"",""))
} }
if (data.size==0) { // data的长度为0的时候为最后一页 if (data.size==0) { // data的长度为0的时候为最后一页
......
...@@ -10,13 +10,12 @@ import com.ydl.ydlcommon.modular.ModularServiceManager ...@@ -10,13 +10,12 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.mvp.base.SimplePresenter import com.ydl.ydlcommon.mvp.base.SimplePresenter
import com.ydl.ydlcommon.utils.RxLifecycleUtils import com.ydl.ydlcommon.utils.RxLifecycleUtils
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxAppTool import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.http.ExpertSearchDataManager import com.yidianling.consultant.http.ExpertSearchDataManager
import com.yidianling.consultant.model.SearchApi import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.model.bean.AllFilter import com.yidianling.consultant.model.bean.AllFilter
import com.yidianling.consultant.model.bean.Extras import com.yidianling.consultant.model.bean.Extras
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer import io.reactivex.functions.Consumer
...@@ -158,16 +157,16 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -158,16 +157,16 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
// 其它 // 其它
if (allFilter.others.isNotEmpty()) { if (allFilter.others.isNotEmpty()) {
val gender = ArrayList<String?>() val gender = ArrayList<String?>()
val bookIngStatusList = ArrayList<String>() // val bookIngStatusList = ArrayList<String>()
allFilter.others.forEach { allFilter.others.forEach {
when (it.key1) { when (it.key1) {
"gender" -> { "gender" -> {
gender.add(it.value1) gender.add(it.value1)
} }
"booking_status" -> { // "booking_status" -> {
bookIngStatusList.add("1") // bookIngStatusList.add("1")
bookIngStatusList.add("2") // bookIngStatusList.add("2")
} // }
else -> { else -> {
filterMap[it.key1] = it.value1 filterMap[it.key1] = it.value1
} }
...@@ -178,11 +177,11 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -178,11 +177,11 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
genderMap["in"] = gender genderMap["in"] = gender
filterMap["gender"] = genderMap filterMap["gender"] = genderMap
} }
if (bookIngStatusList.size>0){ // if (bookIngStatusList.size>0){
val bookStatusMap = HashMap<String, Any>() // val bookStatusMap = HashMap<String, Any>()
bookStatusMap["in"] = bookIngStatusList // bookStatusMap["in"] = bookIngStatusList
filterMap["booking_status"] = bookStatusMap // filterMap["booking_status"] = bookStatusMap
} // }
} }
map["filter"] = filterMap map["filter"] = filterMap
...@@ -198,9 +197,9 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -198,9 +197,9 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
fieldsMap["doctor_name"] = true fieldsMap["doctor_name"] = true
fieldsMap["uid"] = true fieldsMap["uid"] = true
fieldsMap["chat_status"] = true fieldsMap["chat_status"] = true
fieldsMap["consult_status"] = true // fieldsMap["consult_status"] = true
fieldsMap["listen_status"] = true // fieldsMap["listen_status"] = true
fieldsMap["booking_status"] = true // fieldsMap["booking_status"] = true
fieldsMap["gender"] = true fieldsMap["gender"] = true
fieldsMap["years"] = true fieldsMap["years"] = true
fieldsMap["head"] = true fieldsMap["head"] = true
...@@ -221,6 +220,9 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -221,6 +220,9 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
fieldsMap["chat_btn_text"] = true fieldsMap["chat_btn_text"] = true
fieldsMap["feature_tags"] = true fieldsMap["feature_tags"] = true
fieldsMap["link_url"] = true fieldsMap["link_url"] = true
fieldsMap["open_chat_agency"] = true
fieldsMap["service_status"] = true
fieldsMap["is_free_today"] = true
map["fields"] = fieldsMap map["fields"] = fieldsMap
val optionsMap = HashMap<String, Any?>() val optionsMap = HashMap<String, Any?>()
...@@ -252,6 +254,7 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -252,6 +254,7 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
} }
}, object : ThrowableConsumer() { }, object : ThrowableConsumer() {
override fun accept(msg: String) { override fun accept(msg: String) {
ToastUtil.toastShort(msg)
mView.fetchListFailed(msg) mView.fetchListFailed(msg)
} }
}) })
......
...@@ -19,8 +19,6 @@ import com.ydl.ydl_image.module.GlideApp ...@@ -19,8 +19,6 @@ import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydl_router.manager.YDLRouterParams import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseMvpActivity import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.bean.StatusBarOptions import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.IYDLRouterConstant import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.* import com.ydl.ydlcommon.utils.*
...@@ -33,12 +31,9 @@ import com.yidianling.consultant.api.IConsultantService ...@@ -33,12 +31,9 @@ import com.yidianling.consultant.api.IConsultantService
import com.yidianling.consultant.bean.* import com.yidianling.consultant.bean.*
import com.yidianling.consultant.constants.ConsultBIConstants import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.contract.IHotSearchContract import com.yidianling.consultant.contract.IHotSearchContract
import com.yidianling.consultant.http.ExpertSearchDataManager
import com.yidianling.consultant.modular.utils.ConsultAssistantEntryUtils import com.yidianling.consultant.modular.utils.ConsultAssistantEntryUtils
import com.yidianling.consultant.modular.utils.TempH5RouteUtils import com.yidianling.consultant.modular.utils.TempH5RouteUtils
import com.yidianling.consultant.presenter.HotSearchPresenterImpl import com.yidianling.consultant.presenter.HotSearchPresenterImpl
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.consultant_activity_hot_search.* import kotlinx.android.synthetic.main.consultant_activity_hot_search.*
import kotlinx.android.synthetic.main.consultant_item_expert_hot_search.view.* import kotlinx.android.synthetic.main.consultant_item_expert_hot_search.view.*
...@@ -63,6 +58,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -63,6 +58,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
private var dp42: Int = 0 private var dp42: Int = 0
override fun layoutResId(): Int { override fun layoutResId(): Int {
return R.layout.consultant_activity_hot_search return R.layout.consultant_activity_hot_search
} }
...@@ -100,7 +96,16 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -100,7 +96,16 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
} }
etSearch.setOnEditorActionListener { _, actionId, _ -> etSearch.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH) { if (actionId == EditorInfo.IME_ACTION_SEARCH) {
doSearch() // 搜索的关联词
var relatedWords = ""
if (searchSuggestList.isNotEmpty()&&searchSuggestList.size>0){
searchSuggestList[0].suggest_relations?.let {
if (it.size>0){
relatedWords = it[0]
}
}
}
doSearch(etSearch.text.toString(),relatedWords)
} }
true true
} }
...@@ -131,17 +136,24 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -131,17 +136,24 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
rv_search_words.layoutManager = LinearLayoutManager(this) rv_search_words.layoutManager = LinearLayoutManager(this)
rv_search_words.adapter = searchWordsAdapter rv_search_words.adapter = searchWordsAdapter
searchWordsAdapter.setOnItemClickListener { adapter, view, position -> searchWordsAdapter.setOnItemClickListener { adapter, view, position ->
// 搜索的关联词
var relatedWords = ""
if (searchSuggestList.isNotEmpty()&&searchSuggestList.size>0){
searchSuggestList[position].suggest_relations?.let {
relatedWords = it[0]
}
}
doSearch(searchSuggestList[position].suggest_content,relatedWords)
} }
etSearch.addTextChangedListener(object : TextWatcher { etSearch.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) { override fun afterTextChanged(s: Editable?) {
if (TextUtils.isEmpty(s)) { if (TextUtils.isEmpty(s)) {
iv_delete_icon.visibility = View.INVISIBLE iv_delete_icon.visibility = View.INVISIBLE
rv_search_words.visibility = View.GONE rv_search_words.visibility = View.GONE
getSearchWords("") getSearchWords("",false)
} else { } else {
iv_delete_icon.visibility = View.VISIBLE iv_delete_icon.visibility = View.VISIBLE
getSearchWords(s.toString()) getSearchWords(s.toString(),false)
} }
} }
...@@ -157,26 +169,40 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -157,26 +169,40 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
/** /**
* 获取搜索联想词 * 获取搜索联想词
* @param isClickWords 是否是点击历史搜索、热门搜索等进行搜索
*/ */
private fun getSearchWords(searchContent:String){ private fun getSearchWords(searchContent:String,isClickWords:Boolean){
if (!TextUtils.isEmpty(searchContent)){ if (!TextUtils.isEmpty(searchContent)){
mSearchContent = searchContent mSearchContent = searchContent
val map = HashMap<String, Any>() val map = HashMap<String, Any>()
map["content"] = searchContent map["content"] = searchContent
mPresenter.getSearchWords(map) mPresenter.getSearchWords(map,searchContent,isClickWords)
}else{ }else{
rv_search_words.visibility = View.GONE rv_search_words.visibility = View.GONE
} }
} }
override fun getSearchWordsSuccess(searchWordsBean: SearchWordsBean) { override fun getSearchWordsSuccess(searchWordsBean: SearchWordsBean,searchContent:String,isClickWords:Boolean) {
searchSuggestList.clear() if (isClickWords){
if (!searchWordsBean.search_suggests.isNullOrEmpty()){ // 搜索的关联词
rv_search_words.visibility = View.VISIBLE var relatedWords = ""
searchSuggestList.addAll(searchWordsBean.search_suggests) if (!searchWordsBean.search_suggests.isNullOrEmpty()&&searchWordsBean.search_suggests.size>0){
searchWordsAdapter.notifyDataAndSetSearchWord(mSearchContent) searchWordsBean.search_suggests[0].suggest_relations?.let {
if (it.size>0){
relatedWords = it[0]
}
}
}
doSearch(searchContent,relatedWords)
}else{ }else{
rv_search_words.visibility = View.GONE searchSuggestList.clear()
if (!searchWordsBean.search_suggests.isNullOrEmpty()){
rv_search_words.visibility = View.VISIBLE
searchSuggestList.addAll(searchWordsBean.search_suggests)
searchWordsAdapter.notifyDataAndSetSearchWord(mSearchContent)
}else{
rv_search_words.visibility = View.GONE
}
} }
} }
...@@ -220,8 +246,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -220,8 +246,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
.inflate(R.layout.consultant_item_expert_hot_search, flHotSearch, false) .inflate(R.layout.consultant_item_expert_hot_search, flHotSearch, false)
view.tvHotSearch.text = keywordData[index].keyword view.tvHotSearch.text = keywordData[index].keyword
view.setOnClickListener { view.setOnClickListener {
etSearch.setText(keywordData[index].keyword) getSearchWords(keywordData[index].keyword!!,true)
doSearch()
} }
flHotSearch.addView(view) flHotSearch.addView(view)
} }
...@@ -253,8 +278,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -253,8 +278,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
} }
} }
view.setOnClickListener { view.setOnClickListener {
etSearch.setText(hotSearchExpert[index].name) getSearchWords(etSearch.text.toString(),true)
doSearch()
} }
flHotExpert.addView(view) flHotExpert.addView(view)
} }
...@@ -263,9 +287,6 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -263,9 +287,6 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
//刷新 banner //刷新 banner
private fun refreshBanner(focusList: MutableList<HotSearchFocusItemBean>?) { private fun refreshBanner(focusList: MutableList<HotSearchFocusItemBean>?) {
if (null == focusList) { if (null == focusList) {
// if (bannerList.isEmpty()) {
// bannerList.add("https://h2.yidianling.com/ct/list")
// }
card_view.visibility = View.GONE card_view.visibility = View.GONE
} }
if (null != focusList && focusList.isNotEmpty()) { if (null != focusList && focusList.isNotEmpty()) {
...@@ -319,8 +340,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -319,8 +340,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
break break
} }
view.setOnClickListener { view.setOnClickListener {
etSearch.setText(historyStr) getSearchWords(historyStr,true)
doSearch()
} }
fl_search_history.addView(view) fl_search_history.addView(view)
} }
...@@ -339,13 +359,13 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -339,13 +359,13 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
/** /**
* 搜索 * 搜索
*/ */
private fun doSearch() { private fun doSearch(searchWords:String,relatedWords:String) {
val view = this.currentFocus val view = this.currentFocus
if (view != null) { if (view != null) {
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(view.windowToken, 0) imm.hideSoftInputFromWindow(view.windowToken, 0)
} }
val searchWords = etSearch.text.toString()
ActionCountUtils.count(ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK,searchWords) ActionCountUtils.count(ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK,searchWords)
if (!TextUtils.isEmpty(searchWords)) { if (!TextUtils.isEmpty(searchWords)) {
historyList.remove(searchWords) historyList.remove(searchWords)
...@@ -355,13 +375,6 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -355,13 +375,6 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
Gson().toJson(historyList) Gson().toJson(historyList)
) )
} }
// 搜索的关联词
var relatedWords = ""
if (searchSuggestList.isNotEmpty()){
searchSuggestList[0].suggest_relations?.let {
relatedWords = it[0]
}
}
ExpertSearchActivity.startSearch(this, searchWords,"14",relatedWords) ExpertSearchActivity.startSearch(this, searchWords,"14",relatedWords)
finish() finish()
} }
......
...@@ -2,14 +2,18 @@ package com.yidianling.consultant.adapter ...@@ -2,14 +2,18 @@ package com.yidianling.consultant.adapter
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import androidx.core.content.ContextCompat import android.graphics.Typeface
import androidx.appcompat.app.AppCompatActivity import android.text.SpannableStringBuilder
import androidx.recyclerview.widget.RecyclerView import android.text.Spanned
import android.text.TextUtils import android.text.TextUtils
import android.text.style.StyleSpan
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.ydl.webview.H5Params import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.config.SimpleImageOpConfiger import com.ydl.ydl_image.config.SimpleImageOpConfiger
...@@ -19,7 +23,6 @@ import com.ydl.ydlcommon.utils.LogUtil ...@@ -19,7 +23,6 @@ import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.URLUtils import com.ydl.ydlcommon.utils.URLUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.consultant.ExpertSearchActivity
import com.yidianling.consultant.IExpertSearchView import com.yidianling.consultant.IExpertSearchView
import com.yidianling.consultant.R import com.yidianling.consultant.R
import com.yidianling.consultant.constants.ConsultBIConstants import com.yidianling.consultant.constants.ConsultBIConstants
...@@ -27,11 +30,13 @@ import com.yidianling.consultant.model.bean.ExpertServiceItem ...@@ -27,11 +30,13 @@ import com.yidianling.consultant.model.bean.ExpertServiceItem
import com.yidianling.consultant.modular.utils.TempH5RouteUtils import com.yidianling.consultant.modular.utils.TempH5RouteUtils
import com.yidianling.consultant.router.ConsultantIn import com.yidianling.consultant.router.ConsultantIn
import kotlinx.android.synthetic.main.consultant_expert_search_feedbackrate.view.* import kotlinx.android.synthetic.main.consultant_expert_search_feedbackrate.view.*
import kotlinx.android.synthetic.main.consultant_expert_search_header_view.view.*
import kotlinx.android.synthetic.main.consultant_expert_search_item_view.view.* import kotlinx.android.synthetic.main.consultant_expert_search_item_view.view.*
import kotlinx.android.synthetic.main.consultant_expert_search_products_item.view.* import kotlinx.android.synthetic.main.consultant_expert_search_products_item.view.*
import kotlinx.android.synthetic.main.consultant_item_empty.view.* import kotlinx.android.synthetic.main.consultant_item_empty.view.*
import kotlinx.android.synthetic.main.consultant_item_footer.view.* import kotlinx.android.synthetic.main.consultant_item_footer.view.*
import kotlinx.android.synthetic.main.consultant_item_tag.view.* import kotlinx.android.synthetic.main.consultant_item_tag.view.*
import kotlinx.android.synthetic.main.consultant_layout_search_content.*
import java.math.BigDecimal import java.math.BigDecimal
/** /**
...@@ -44,25 +49,63 @@ class ExpertSearchAdapter( ...@@ -44,25 +49,63 @@ class ExpertSearchAdapter(
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { ) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
companion object { companion object {
const val HEADER_VIEW = 3
const val NORMAL_VIEW = 0 const val NORMAL_VIEW = 0
const val FOOT_VIEW = 1 const val FOOT_VIEW = 1
const val EMPTY_VIEW = 2 const val EMPTY_VIEW = 2
} }
interface OnClickLister {
fun onClick(searchWords:String)
}
private lateinit var mOnClickLister: OnClickLister
fun setOnClickLister(lister: OnClickLister) {
mOnClickLister = lister
}
//记录当前选择主题的id //记录当前选择主题的id
var cateId: String?=null var cateId: String? = null
var hasMore = true var hasMore = true
var pageIndex: Int = 0 var pageIndex: Int = 0
private var clickCount=0 // 搜索结果提示标签点击次数
fun setEntrance( pageIndex: Int) { fun setEntrance(pageIndex: Int) {
this.pageIndex = pageIndex this.pageIndex = pageIndex
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is NormalViewHolder) { if (holder is HeaderViewHolder) { // 搜索结果提示头部
if (listData.size>0){
if (listData[0].is_head_view){
if (clickCount==0){
holder.clSearchWords.visibility = View.VISIBLE
var text = "根据匹配,为您推荐“${listData[0].related_word}”相关词"
holder.tvSearchRelatedWord.text = setTextBold(text,listData[0].related_word)
holder.tvSearchWord.text = listData[0].search_content
holder.tvSearchWord.setOnClickListener {
mOnClickLister.onClick(holder.tvSearchWord.text.toString())
++clickCount
if (clickCount==1){
text = "以下是“${listData[0].search_content}”的搜索结果"
holder.tvSearchRelatedWord.text = setTextBold(text,listData[0].search_content)
holder.tvSearchTips.text = "你要找的是不是"
holder.tvSearchWord.text = listData[0].related_word
}else if (clickCount==2){ // 第二次点击搜索标签隐藏搜索匹配结果提示
listData.removeAt(0)
}
}
}
}else {
holder.clSearchWords.visibility = View.GONE
// listData.removeAt(0)
}
}
} else if (holder is NormalViewHolder) {
val itemBean = listData[position] val itemBean = listData[position]
//头像 //头像
val headConfig = SimpleImageOpConfiger() val headConfig = SimpleImageOpConfiger()
...@@ -79,7 +122,7 @@ class ExpertSearchAdapter( ...@@ -79,7 +122,7 @@ class ExpertSearchAdapter(
holder.tvName.text = itemBean.doctor_name holder.tvName.text = itemBean.doctor_name
//服务中 //服务中
if (itemBean.consult_status==2 || itemBean.listen_status==2) { if (itemBean.open_chat_agency == 2 && itemBean.service_status == 2) {
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
...@@ -100,7 +143,7 @@ class ExpertSearchAdapter( ...@@ -100,7 +143,7 @@ class ExpertSearchAdapter(
} }
//可预约 //可预约
holder.imgHead_online_server.visibility = View.GONE holder.imgHead_online_server.visibility = View.GONE
if (itemBean.booking_status <4) { if (itemBean.is_free_today== 1) {
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
...@@ -140,7 +183,7 @@ class ExpertSearchAdapter( ...@@ -140,7 +183,7 @@ class ExpertSearchAdapter(
holder.imgFightEpidemicIcon.visibility = View.VISIBLE holder.imgFightEpidemicIcon.visibility = View.VISIBLE
} }
if(itemBean.joinActivity==true ){ if (itemBean.joinActivity == true) {
//活动图标 //活动图标
if (!TextUtils.isEmpty(itemBean.activityImg)) { if (!TextUtils.isEmpty(itemBean.activityImg)) {
holder.imgActivity.visibility = View.VISIBLE holder.imgActivity.visibility = View.VISIBLE
...@@ -148,7 +191,7 @@ class ExpertSearchAdapter( ...@@ -148,7 +191,7 @@ class ExpertSearchAdapter(
} else { } else {
holder.imgActivity.visibility = View.GONE holder.imgActivity.visibility = View.GONE
} }
}else{ } else {
holder.imgActivity.visibility = View.GONE holder.imgActivity.visibility = View.GONE
} }
...@@ -183,7 +226,7 @@ class ExpertSearchAdapter( ...@@ -183,7 +226,7 @@ class ExpertSearchAdapter(
holder.imgActivity.visibility = View.GONE holder.imgActivity.visibility = View.GONE
} }
//新驻图标 //新驻图标
if (itemBean.is_new_enter!=null&&itemBean.is_new_enter!!) { if (itemBean.is_new_enter != null && itemBean.is_new_enter!!) {
if (null != itemBean.icons && !TextUtils.isEmpty(itemBean.icons.new_enter_icon)) { if (null != itemBean.icons && !TextUtils.isEmpty(itemBean.icons.new_enter_icon)) {
expertSearchView.showImage( expertSearchView.showImage(
itemBean.icons.new_enter_icon, itemBean.icons.new_enter_icon,
...@@ -228,22 +271,33 @@ class ExpertSearchAdapter( ...@@ -228,22 +271,33 @@ class ExpertSearchAdapter(
//咨询师标签 //咨询师标签
holder.ll_tags.removeAllViews() holder.ll_tags.removeAllViews()
itemBean.feature_tags?.let { itemBean.feature_tags?.let {
if (it.isNotEmpty()){ if (it.isNotEmpty()) {
for (tag in itemBean.feature_tags){ 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.tag_name.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.is_highlight){ 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(
}else{ ContextCompat.getColor(
context,
R.color.color_EB892C
)
)
} 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_666666)) view.tvTag.setTextColor(
ContextCompat.getColor(
context,
R.color.platform_color_666666
)
)
} }
holder.ll_tags.addView(view) holder.ll_tags.addView(view)
} }
...@@ -261,7 +315,12 @@ class ExpertSearchAdapter( ...@@ -261,7 +315,12 @@ class ExpertSearchAdapter(
R.color.platform_but_text_color R.color.platform_but_text_color
) )
) )
holder.tvChat.setTextColor(ContextCompat.getColor(context,R.color.platform_but_text_color)) holder.tvChat.setTextColor(
ContextCompat.getColor(
context,
R.color.platform_but_text_color
)
)
holder.tvChat.background = holder.tvChat.background =
ContextCompat.getDrawable(context, R.drawable.consultant_expert_search_chat) ContextCompat.getDrawable(context, R.drawable.consultant_expert_search_chat)
} else { } else {
...@@ -279,7 +338,8 @@ class ExpertSearchAdapter( ...@@ -279,7 +338,8 @@ class ExpertSearchAdapter(
} }
//服务时长 //服务时长
val durationStringBuffer = StringBuffer() val durationStringBuffer = StringBuffer()
holder.tvSaleDurationForMonth.text = durationStringBuffer.append(itemBean.sum_service_time.toInt()).append("").toString() holder.tvSaleDurationForMonth.text =
durationStringBuffer.append(itemBean.sum_service_time.toInt()).append("").toString()
//价格 //价格
val price = BigDecimal(itemBean.min_price) val price = BigDecimal(itemBean.min_price)
// 去掉末尾无用的.00 // 去掉末尾无用的.00
...@@ -316,8 +376,6 @@ class ExpertSearchAdapter( ...@@ -316,8 +376,6 @@ class ExpertSearchAdapter(
} }
} }
} }
} else if (holder is FooterViewHolder) { } else if (holder is FooterViewHolder) {
LogUtil.e("${listData.size}") LogUtil.e("${listData.size}")
LogUtil.e("${hasMore}") LogUtil.e("${hasMore}")
...@@ -325,29 +383,35 @@ class ExpertSearchAdapter( ...@@ -325,29 +383,35 @@ class ExpertSearchAdapter(
holder.itemView.visibility = View.VISIBLE holder.itemView.visibility = View.VISIBLE
holder.pbLoading.visibility = View.VISIBLE holder.pbLoading.visibility = View.VISIBLE
holder.tvHint.text = context.getString(R.string.consultant_loading) holder.tvHint.text = context.getString(R.string.consultant_loading)
} else{ } else {
holder.pbLoading.visibility = View.GONE holder.pbLoading.visibility = View.GONE
holder.tvHint.text = context.getString(R.string.platform_no_more) holder.tvHint.text = context.getString(R.string.platform_no_more)
} }
} }
} }
override fun getItemCount(): Int = listData.size + 1 override fun getItemCount(): Int =
// if (listData.size < ExpertSearchActivity.PAGE_SIZE && hasMore) { // if (listData.size < ExpertSearchActivity.PAGE_SIZE && hasMore) {
// listData.size if (listData.size==1) {
// } 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) {
HEADER_VIEW -> {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_expert_search_header_view, parent, false)
HeaderViewHolder(view)
}
NORMAL_VIEW -> { NORMAL_VIEW -> {
val view = LayoutInflater.from(context) val view = LayoutInflater.from(context)
.inflate(R.layout.consultant_expert_search_item_view, parent, false) .inflate(R.layout.consultant_expert_search_item_view, parent, false)
NormalViewHolder(view) NormalViewHolder(view)
} }
FOOT_VIEW -> { FOOT_VIEW -> {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_footer, parent, false) val view = LayoutInflater.from(context)
.inflate(R.layout.consultant_item_footer, parent, false)
FooterViewHolder(view) FooterViewHolder(view)
} }
else -> { else -> {
...@@ -357,64 +421,96 @@ class ExpertSearchAdapter( ...@@ -357,64 +421,96 @@ class ExpertSearchAdapter(
} }
} }
override fun getItemViewType(position: Int): Int = when { override fun getItemViewType(position: Int): Int =
position < listData.size -> NORMAL_VIEW when {
!hasMore && listData.size == 0 -> EMPTY_VIEW position==0 ->{
else -> FOOT_VIEW HEADER_VIEW
} }
position>0&&position < listData.size -> {
NORMAL_VIEW
}
!hasMore && listData.size == 0 -> {
EMPTY_VIEW
}
else -> FOOT_VIEW
}
inner class NormalViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { inner class NormalViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
//头像 //头像
val imgHead = itemView.imgHead!! val imgHead = itemView.imgHead!!
val cv_head_view = itemView.cv_head_view!! val cv_head_view = itemView.cv_head_view!!
//专家姓名 //专家姓名
val tvName = itemView.tvName!! val tvName = itemView.tvName!!
//活动图标 //活动图标
val imgActivity = itemView.img_activity!! val imgActivity = itemView.img_activity!!
//优质图标 //优质图标
val imgAbilityLevel = itemView.imgAbilityLevel!! val imgAbilityLevel = itemView.imgAbilityLevel!!
//公益图标 //公益图标
val imgServiceFree = itemView.imgServiceFree!! val imgServiceFree = itemView.imgServiceFree!!
//新驻图标 //新驻图标
val imgNewEnter = itemView.imgNewEnter!! val imgNewEnter = itemView.imgNewEnter!!
//荣誉标签 //荣誉标签
val ll_honor_layout = itemView.ll_honor_layout!! val ll_honor_layout = itemView.ll_honor_layout!!
//好评率 //好评率
val ll_feedbackRate = itemView.ll_feedbackRate!! val ll_feedbackRate = itemView.ll_feedbackRate!!
//xxx人点评 //xxx人点评
val tv_zixunOrderNum = itemView.tv_zixunOrderNum!! val tv_zixunOrderNum = itemView.tv_zixunOrderNum!!
//咨询师简介 //咨询师简介
val tvTeamCertifications = itemView.tvTeamCertifications!! val tvTeamCertifications = itemView.tvTeamCertifications!!
//咨询师标签 //咨询师标签
val ll_tags = itemView.ll_tags!! val ll_tags = itemView.ll_tags!!
//帮助人数 //帮助人数
val tvOrderNum = itemView.tvOrderNum!! val tvOrderNum = itemView.tvOrderNum!!
//帮助人数文案 //帮助人数文案
val tvOrderNumContent = itemView.tvOrderNumContent val tvOrderNumContent = itemView.tvOrderNumContent
//服务时长 //服务时长
val tvSaleDurationForMonth = itemView.tvSaleDurationForMonth!! val tvSaleDurationForMonth = itemView.tvSaleDurationForMonth!!
//月售时长文案 //月售时长文案
val tvSaleDurationForMonthContent = itemView.tvSaleDurationForMonthContent val tvSaleDurationForMonthContent = itemView.tvSaleDurationForMonthContent
//价格 //价格
val tvPrice = itemView.tvPrice!! val tvPrice = itemView.tvPrice!!
val tvPriceContent = itemView.tvPriceContent!! val tvPriceContent = itemView.tvPriceContent!!
val tv_money_symbol = itemView.tv_money_symbol!! val tv_money_symbol = itemView.tv_money_symbol!!
//服务套餐 //服务套餐
val ll_products = itemView.ll_products!! val ll_products = itemView.ll_products!!
//私聊按钮 //私聊按钮
val tvChat = itemView.tvChat!! val tvChat = itemView.tvChat!!
//个人铭言整个布局 //个人铭言整个布局
val group_desc = itemView.group_desc!! val group_desc = itemView.group_desc!!
//个人铭言 //个人铭言
val tvDesc = itemView.tvDesc!! val tvDesc = itemView.tvDesc!!
//省市 //省市
val tvCity = itemView.tvCity!! val tvCity = itemView.tvCity!!
//今日是否可约 //今日是否可约
val imgHead_online = itemView.imgHead_online!! val imgHead_online = itemView.imgHead_online!!
//服务中(咨询中或者聆听中) //服务中(咨询中或者聆听中)
val imgHead_online_server = itemView.imgHead_online_server!! val imgHead_online_server = itemView.imgHead_online_server!!
//多少人在问询 //多少人在问询
val chat_people_in_question = itemView.people_in_question!! val chat_people_in_question = itemView.people_in_question!!
// 抗疫先锋图标 // 抗疫先锋图标
val imgFightEpidemicIcon = itemView.img_fightEpidemicIcon val imgFightEpidemicIcon = itemView.img_fightEpidemicIcon
...@@ -431,7 +527,13 @@ class ExpertSearchAdapter( ...@@ -431,7 +527,13 @@ class ExpertSearchAdapter(
TempH5RouteUtils.tempH5Route(linkUrl) TempH5RouteUtils.tempH5Route(linkUrl)
// 埋点 // 埋点
ActionCountUtils.baiDuCountSign3(ConsultBIConstants.PART_ID_CONSULT_COUNSELOR_LIST_PAGE,ConsultBIConstants.ConsultEvent.POSITION_CONSULT_COUNSELOR_CARD_CLICK,itemBean.id?:"","app","") ActionCountUtils.baiDuCountSign3(
ConsultBIConstants.PART_ID_CONSULT_COUNSELOR_LIST_PAGE,
ConsultBIConstants.ConsultEvent.POSITION_CONSULT_COUNSELOR_CARD_CLICK,
itemBean.id ?: "",
"app",
""
)
} }
} }
...@@ -450,7 +552,7 @@ class ExpertSearchAdapter( ...@@ -450,7 +552,7 @@ class ExpertSearchAdapter(
) )
} }
//判断是否已登录 //判断是否已登录
if (!ConsultantIn.getUserImpl().loginByOneKeyLogin(context,true)) { if (!ConsultantIn.getUserImpl().loginByOneKeyLogin(context, true)) {
return@setOnClickListener return@setOnClickListener
} }
...@@ -467,6 +569,13 @@ class ExpertSearchAdapter( ...@@ -467,6 +569,13 @@ class ExpertSearchAdapter(
} }
} }
inner class HeaderViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val clSearchWords = itemView.cl_search_words
val tvSearchRelatedWord = itemView.tv_search_related_word
val tvSearchTips = itemView.tv_search_tips
val tvSearchWord = itemView.tv_search_word
}
inner class FooterViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { inner class FooterViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val pbLoading = itemView.pbLoading!! val pbLoading = itemView.pbLoading!!
val tvHint = itemView.tvHint!! val tvHint = itemView.tvHint!!
...@@ -482,4 +591,22 @@ class ExpertSearchAdapter( ...@@ -482,4 +591,22 @@ class ExpertSearchAdapter(
} }
} }
} }
private fun setTextBold(text: String, content: String): SpannableStringBuilder {
return if (text.contains(content)) {
val s1 = text.split(content)[0]
val s2 = text.split(content)[1]
val spannableBuilder1 = SpannableStringBuilder(s1)
val spannableBuilder2 = SpannableStringBuilder(content)
spannableBuilder2.setSpan(
StyleSpan(Typeface.BOLD),
0,
content.length,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
spannableBuilder1.append(spannableBuilder2).append(SpannableStringBuilder(s2))
} else {
SpannableStringBuilder(text)
}
}
} }
\ No newline at end of file
...@@ -31,7 +31,7 @@ class IHotSearchContract { ...@@ -31,7 +31,7 @@ class IHotSearchContract {
/** /**
* 联想词请求成功结果 * 联想词请求成功结果
*/ */
fun getSearchWordsSuccess(searchWordsBean: SearchWordsBean) fun getSearchWordsSuccess(searchWordsBean: SearchWordsBean,searchContent:String,isClickWords:Boolean)
} }
interface Presenter : IPresenter<View> { interface Presenter : IPresenter<View> {
...@@ -48,7 +48,7 @@ class IHotSearchContract { ...@@ -48,7 +48,7 @@ class IHotSearchContract {
/** /**
* 获取联想词 * 获取联想词
*/ */
fun getSearchWords(map:HashMap<String,Any>) fun getSearchWords(map:HashMap<String,Any>,searchContent:String,isClickWords:Boolean)
} }
interface Model : IModel { interface Model : IModel {
......
...@@ -95,18 +95,25 @@ data class ExpertServiceItem( ...@@ -95,18 +95,25 @@ data class ExpertServiceItem(
* 标签图片 * 标签图片
*/ */
val icons: ExpertSearchTagsIconBean?, val icons: ExpertSearchTagsIconBean?,
/** // /**
* 今日是否可约 // * 今日是否可约
*/ // */
val booking_status: Int, // val booking_status: Int,
/** // /**
* 咨询状态 1-待服务 2-服务中 // * 咨询状态 1-待服务 2-服务中
*/ // */
var consult_status: Int, // var consult_status: Int,
/** // /**
* 倾诉状态 1-待服务 2-服务中 // * 倾诉状态 1-待服务 2-服务中
*/ // */
var listen_status: Int, // var listen_status: Int,
var open_chat_agency:Int,
var service_status:Int,
var is_free_today:Int,
/** /**
* 私聊人数 * 私聊人数
*/ */
...@@ -131,8 +138,27 @@ data class ExpertServiceItem( ...@@ -131,8 +138,27 @@ data class ExpertServiceItem(
/** /**
* 新标签分类 * 新标签分类
*/ */
val feature_tags: ArrayList<FeatureTag>? val feature_tags: ArrayList<FeatureTag>?,
)
/**
* 是否是头部headView
*/
val is_head_view:Boolean=false,
/**
* 搜索词
*/
val search_content:String,
/**
* 联想词
*/
val related_word:String
) {
constructor(is_head_view: Boolean,search_content: String,related_word:String) : this("","","","","",
1,1,1,"",false,true,
1f,false,0,"","","",1f,1f,
null,null,1,1,1,1,
"","","","",null,is_head_view,search_content,related_word)
}
data class FeatureTag( data class FeatureTag(
val tag_id:String, val tag_id:String,
......
//package com.yidianling.consultant.model.bean
//
//import com.google.gson.annotations.SerializedName
//
//data class ServiceItem(
//
// @field:SerializedName("doctor_uid")
// val doctorUid: Int = 0,
//
// @field:SerializedName("city")
// val city: String? = null,
//
// @field:SerializedName("product_name")
// val productName: String? = null,
//
// @field:SerializedName("tags")
// val tags: List<String?> = ArrayList(),
//
// @field:SerializedName("uid")
// val uid: Int? = null,
//
// @field:SerializedName("doctor_id")
// val doctorId: Int? = null,
//
// @field:SerializedName("feedback_rate")
// val feedbackRate: String? = null,
//
// @field:SerializedName("doctor_head")
// val doctorHead: String? = null,
//
// @field:SerializedName("province")
// val province: String? = null,
//
//
// @field:SerializedName("doctor_name")
// val doctorName: String? = null,
//
// @field:SerializedName("m_url")
// val mUrl: String? = null,
//
// @field:SerializedName("h_url")
// val hUrl: String? = null,
//
// @field:SerializedName("is_online")
// val isOnline: Int = 0 //1在线,2离线
//)
\ No newline at end of file
//package com.yidianling.consultant.model.bean;
//
//import com.chad.library.adapter.base.entity.MultiItemEntity;
//
///**
// * Created by Ykai on 2022/5/18.
// */
//
//public class SortBean implements MultiItemEntity {
// public String name;
// int type;
// public boolean isVisible; // 是否显示
// public boolean isSelected; // 是否选中
//
//
// public SortBean(String name, int type){
// this.name = name;
// this.type = type;
// isVisible = true;
// }
//
// @Override
// public int getItemType() {
// return type;
// }
//}
...@@ -4,7 +4,6 @@ import android.annotation.SuppressLint ...@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.text.TextUtils import android.text.TextUtils
import com.google.gson.Gson import com.google.gson.Gson
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.mvp.base.BasePresenter import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.utils.RxLifecycleUtils import com.ydl.ydlcommon.utils.RxLifecycleUtils
...@@ -17,7 +16,6 @@ import com.yidianling.consultant.model.HotSearchModelImpl ...@@ -17,7 +16,6 @@ import com.yidianling.consultant.model.HotSearchModelImpl
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
/** /**
* @author yuanwai * @author yuanwai
...@@ -62,6 +60,7 @@ class HotSearchPresenterImpl : BasePresenter<IHotSearchContract.View, IHotSearch ...@@ -62,6 +60,7 @@ class HotSearchPresenterImpl : BasePresenter<IHotSearchContract.View, IHotSearch
/** /**
* 搜索页接口 * 搜索页接口
*/ */
@SuppressLint("CheckResult")
override fun searchData() { override fun searchData() {
mModel.searchData().map { it } mModel.searchData().map { it }
.filter { it != null } .filter { it != null }
...@@ -78,14 +77,14 @@ class HotSearchPresenterImpl : BasePresenter<IHotSearchContract.View, IHotSearch ...@@ -78,14 +77,14 @@ class HotSearchPresenterImpl : BasePresenter<IHotSearchContract.View, IHotSearch
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
override fun getSearchWords(map:HashMap<String,Any>) { override fun getSearchWords(map:HashMap<String,Any>,searchContent:String,isClickWords:Boolean) {
mModel.getSearchWords(map) mModel.getSearchWords(map)
.debounce(500L, TimeUnit.MILLISECONDS) // .debounce(500L, TimeUnit.MILLISECONDS)
.compose(RxLifecycleUtils.bindToLifecycle(mView)) .compose(RxLifecycleUtils.bindToLifecycle(mView))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer { .subscribe(Consumer {
mView.getSearchWordsSuccess(it) mView.getSearchWordsSuccess(it,searchContent,isClickWords)
}, object : ThrowableConsumer() { }, object : ThrowableConsumer() {
override fun accept(msg: String) { override fun accept(msg: String) {
ToastUtil.toastShort(msg) ToastUtil.toastShort(msg)
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_search_words"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="19dp"
android:paddingEnd="19dp"
android:visibility="gone"
>
<TextView
android:id="@+id/tv_search_related_word"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/platform_color_242424"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:textSize="15sp"
android:fontFamily="sans-serif"
android:layout_marginTop="14dp"
android:includeFontPadding="false"
tools:text="根据匹配,为您推荐恋爱情感相关词" />
<TextView
android:id="@+id/tv_search_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_search_word"
app:layout_constraintBottom_toBottomOf="@id/tv_search_word"
android:textSize="15sp"
android:textColor="@color/platform_color_666666"
android:fontFamily="sans-serif"
android:includeFontPadding="false"
android:text="仍搜索" />
<TextView
android:id="@+id/tv_search_word"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@id/tv_search_tips"
app:layout_constraintTop_toBottomOf="@id/tv_search_related_word"
android:layout_marginTop="9dp"
android:layout_marginStart="6dp"
android:textSize="14sp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:textColor="@color/platform_color_242424"
android:includeFontPadding="false"
android:background="@drawable/consultant_stroke_ebebeb_solid_f9f9f9_r_4"
tools:text="恋爱情感"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
\ No newline at end of file
...@@ -82,65 +82,6 @@ ...@@ -82,65 +82,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="6dp" android:layout_height="6dp"
android:background="@drawable/consult_fillter_bg" /> android:background="@drawable/consult_fillter_bg" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_search_words"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="19dp"
android:paddingEnd="19dp"
android:visibility="gone"
>
<TextView
android:id="@+id/tv_search_related_word"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/platform_color_242424"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:textSize="15sp"
android:fontFamily="sans-serif"
android:layout_marginTop="14dp"
android:includeFontPadding="false"
tools:text="根据匹配,为您推荐恋爱情感相关词" />
<TextView
android:id="@+id/tv_search_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_search_word"
app:layout_constraintBottom_toBottomOf="@id/tv_search_word"
android:textSize="15sp"
android:textColor="@color/platform_color_666666"
android:fontFamily="sans-serif"
android:includeFontPadding="false"
android:text="仍搜索" />
<TextView
android:id="@+id/tv_search_word"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@id/tv_search_tips"
app:layout_constraintTop_toBottomOf="@id/tv_search_related_word"
android:layout_marginTop="9dp"
android:layout_marginStart="6dp"
android:textSize="14sp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:textColor="@color/platform_color_242424"
android:includeFontPadding="false"
android:background="@drawable/consultant_stroke_ebebeb_solid_f9f9f9_r_4"
tools:text="恋爱情感"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- <View-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:background="@color/platform_color_EBEBEB" />-->
</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