Commit 1d79f603 by upwork.021

feat: 代码提交

parent 0f00af89
......@@ -6,10 +6,10 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.72",
"m-consultant" : "0.0.60.31",
"m-consultant" : "0.0.60.39",
"m-fm" : "0.0.30.08",
"m-user" : "0.0.62.04",
"m-home" : "0.0.23.44",
"m-home" : "0.0.23.80",
"m-im" : "0.0.21.33",
"m-dynamic" : "0.0.7.37",
"m-article" : "0.0.0.10",
......@@ -35,7 +35,7 @@ ext {
//mdt 组件
"ydl-tuicore" : "0.0.22",
//第一步
"ydl-platform" : "0.0.40.97",
"ydl-platform" : "0.0.41.25",
//第二步 若干
"ydl-webview" : "0.0.38.62",
......@@ -46,7 +46,7 @@ ext {
//以下 几乎不会动
"router" : "0.0.1",
"ydl-net" : "0.0.3.93",
"ydl-net" : "0.0.3.94",
"ydl-utils" : "0.0.3.3",
]
ydl_app = [
......@@ -130,7 +130,7 @@ ext {
//以下 几乎不会动
"router" : "0.0.1",
"ydl-net" : "0.0.3.93",
"ydl-net" : "0.0.3.94",
"ydl-utils" : "0.0.3.3",
]
......
......@@ -9,7 +9,10 @@ import android.content.Context
import android.content.Intent
import android.graphics.Typeface
import android.os.Handler
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.TextUtils
import android.text.style.StyleSpan
import android.view.View
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
......@@ -91,7 +94,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun initDataAndEvent() {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE or WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
initViews()
initData(intent)
initData(intent,false)
rl_hot_fix_for_huawei.visibility = View.VISIBLE
}
......@@ -108,6 +111,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
const val HOT_SEARCH_DOCTOR_NAME = "hot_search_doctor_name"
private const val EXTRA_IS_SHOW_HOT = "isInitShowHot"
private const val EXTRA_SEARCH_WORD = "searchWord"
private const val EXTRA_RELATED_WORD = "related_word"
private const val EXTRA_IS_FROM_SPLASH = "isFromSplash"
private const val FILTER_STATUS_NORMAL = 0 //默认筛选状态
private const val FILTER_STATUS_FILTERED = 1 //非默认筛选状态
......@@ -145,11 +149,14 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
/**
* 搜索页面过来的sign2为14 仅用于埋点
* 搜索页面过来的
* @param sign2为14 仅用于埋点
* @param relatedWord 搜索内容的关联词
*/
fun startSearch(context: Context, searchWord: String?,sign2:String) {
fun startSearch(context: Context, searchWord: String?,sign2:String,relatedWord:String) {
val intent = Intent(context, ExpertSearchActivity::class.java)
intent.putExtra(EXTRA_SEARCH_WORD, searchWord)
intent.putExtra(EXTRA_RELATED_WORD, relatedWord)
intent.putExtra("sign2",sign2)
context.startActivity(intent)
}
......@@ -225,14 +232,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
initNetLossView()
// etSearch.setOnEditorActionListener { _, actionId, _ ->
// if (actionId == EditorInfo.IME_ACTION_SEARCH) {
// doSearch()
// }
// true
// }
// etSearch.setOnClickListener { appbar_layout.setExpanded(false) }
// etSearch.setOnFocusChangeListener { view, b -> if (b) appbar_layout.setExpanded(false) }
btn_back.setOnClickListener {
onBackPressed()
}
......@@ -384,24 +383,41 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
}
private fun initData(mIntent: Intent) {
private fun initData(mIntent: Intent,isRefresh:Boolean) {
fromPageType = mIntent.getIntExtra(EXTRA_FROM_PAGE, -1)
initCategory = mIntent.getStringExtra(EXTRA_CATEGORY) ?: ""
initShowType = mIntent.getIntExtra(EXTRA_SHOW_TYPE, 0)
tv_search_content.text = mIntent.getStringExtra(EXTRA_SEARCH_WORD)
val relatedWord = mIntent.getStringExtra(EXTRA_RELATED_WORD) // 搜索内容的联想词
val searchWord = mIntent.getStringExtra(EXTRA_SEARCH_WORD)
if (!TextUtils.isEmpty(relatedWord)){ // 判断搜索内容的联想词为空,则用搜索词进行搜索
allFilter.searchWord = relatedWord
}else{
allFilter.searchWord = searchWord
}
mSign2 = mIntent.getStringExtra("sign2")?:""
getRouterParam()
allFilter.showType.key = initShowType
allFilter.categoryId2List.add(initCategory)
if (!TextUtils.isEmpty(initCategory)){
allFilter.categoryId2List.add(initCategory)
}
if (!TextUtils.isEmpty(cateName)){
tvSubject.text = cateName
updateFilterTextViewStatus(tvSubject,FILTER_STATUS_FILTERED)
}
getPresenter().fetchListHead()
// refresh(false)
if (isRefresh){
refresh(false)
}
tv_search_content.text = searchWord
// 判断搜索词和联想词不一样,则显示匹配结果
if (!TextUtils.isEmpty(searchWord)&&!TextUtils.isEmpty(relatedWord)&&searchWord!=relatedWord){
cl_search_words.visibility = View.VISIBLE
val text = "根据匹配,为您推荐“${relatedWord}”相关词"
tv_search_related_word.text = setTextBold(text,relatedWord)
}
v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
......@@ -410,7 +426,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
initData(intent!!)
initData(intent!!,true)
}
......@@ -509,7 +525,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
filterLabelSet()
//开始筛选数据
// refresh()
refresh()
}
view.addView(textView)
}
......@@ -562,7 +578,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
"2" -> {//省
if (headData?.region!!.size > 0) {
var bean = RegionItem()
val bean = RegionItem()
if (isAdd) {
//热门中如果选择过地区、要把其他已选中的置位未选中
if (hasSelectedArea) {
......@@ -769,7 +785,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//用于侧滑筛选过来更新快捷筛选选中状态
private fun updateOtherViews(otherdata: List<OtherItem>) {
private fun updateOtherViews(otherData: List<OtherItem>) {
if (lin_filter2.childCount > 0) {
//清空选中
for (i in 0.until(lin_filter2.childCount)) {
......@@ -778,7 +794,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textView.paint.isFakeBoldText = false
}
//重置选中状态
for ((index, other) in otherdata.withIndex()) {
for (other in otherData) {
for (i in 0 until lin_filter2.childCount) {
val textView = lin_filter2.getChildAt(i) as TextView
if (textView.text == other.value) {
......@@ -828,7 +844,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
srlContainer.isRefreshing = false
// 埋点
val sign1 = data.map { it.id }.joinToString { "|" }
val sign1 = data.joinToString(","){it.id}
ActionCountUtils.baiDuCountSign3(ConsultBIConstants.PART_ID_CONSULT_COUNSELOR_LIST_PAGE,ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_PAGE_VISIT,sign1,mSign2,"app")
}
......@@ -863,6 +879,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
rvExperts.visibility = View.GONE
dismissProgressDialog()
srlContainer.isRefreshing = false
}
override fun fetchFailed(msg: String?) {
......@@ -946,7 +963,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
ActionCountUtils.count(YDL_USER_CONSULT_SEARCH_CLICK)
ARouter.getInstance()
.build("/consult/hot_search")
.withString(HOT_SEARCH_DOCTOR_NAME, tv_search_content.text.toString())
.withString(HOT_SEARCH_DOCTOR_NAME, allFilter.searchWord)
.navigation()
}
}
......@@ -988,7 +1005,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
if (headData?.filters != null) {
val filterPopupWindow = FilterPopupWindow(this, headData?.filters!!, tempFilter)
filterPopupWindow.setOnDismissListener {
// viewDim.visibility = View.INVISIBLE
viewDim.visibility = View.INVISIBLE
viewDim_filter.visibility = View.GONE
if (allFilter.others.size + allFilter.enquiries.size + allFilter.ages.size + allFilter.doctorEdu.size + allFilter.title.size > 0 || !TextUtils.isEmpty(
allFilter.priceRanges?.minPrice
......@@ -1005,7 +1022,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity()
filterPopupWindow.onFilterConfirmListener = this
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN)
viewDim_filter.visibility = View.VISIBLE
viewDim.visibility = View.VISIBLE
} else {
ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead()
......@@ -1030,6 +1047,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
)
BuryPointUtils.buryPoint("Filtrate", props1)
// 埋点
if (tempFilter.specialityCrowd.size>0){
val sign1 = tempFilter.specialityCrowd.joinToString(","){it.value!!}
ActionCountUtils.baiDuCountSign3(ConsultBIConstants.PART_ID_CONSULT_FILTER_PAGE,ConsultBIConstants.ConsultEvent.POSITION_GOODAT_CROWD_CLICK,sign1,"app","")
}
allFilter.showType = tempFilter.showType
allFilter.enquiries.clear()
......@@ -1356,12 +1379,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity()
categoryPopup!!.onSubjectsSelectedListener = this
categoryPopup!!.showAsDropDown(tvFilter)
categoryPopup!!.showAsDropDown(viewSep2)
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
viewDim.visibility = View.VISIBLE
}else{
ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity()
categoryPopup!!.showAsDropDown(tvFilter)
categoryPopup!!.showAsDropDown(viewSep2)
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
viewDim.visibility = View.VISIBLE
}
......@@ -1374,16 +1397,16 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
*/
override fun onCategoriesSelected(signLit:ArrayList<String>) {
if (signLit.isNotEmpty()){
val sign1 = signLit.map { it }.joinToString { "," }
val sign1 = signLit.joinToString(","){it}
ActionCountUtils.baiDuCountSign3(ConsultBIConstants.PART_ID_CONSULT_COUNSELOR_LIST_PAGE,ConsultBIConstants.ConsultEvent.POSITION_TWO_CATEGORY_CLICK, sign1,"app","")
}
if (allFilter.categoryId2List.size>0||allFilter.categoryId3List.size>0){
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
refresh()
}else{
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_NORMAL)
}
refresh()
}
override fun onRefresh() {
......@@ -1394,12 +1417,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//刷新列表
private fun refresh(isShowRefresh: Boolean? = true) {
srlContainer.isRefreshing = isShowRefresh!!
val key = tv_search_content.text.toString()
if (!TextUtils.isEmpty(key.trim())) {
allFilter.searchWord = key.trim()
} else {
allFilter.searchWord = null
}
onScrollListener.resetState()
getPresenter().mExtras=null
getPresenter().fetchListData(allFilter, getPresenter().mExtras)
......@@ -1507,4 +1524,22 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
mHandler=null
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)
}
}
}
......@@ -69,6 +69,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
private lateinit var mActivity: FragmentActivity
var startTime =0L
var endTime =0L
private var mIdssign1:String="" // 列表埋点咨询师列表id拼接参数
override fun layoutResId(): Int {
return R.layout.consultant_activity_expert_search_list
......@@ -435,7 +436,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
filterLabelSet()
//开始筛选数据
// refresh()
refresh()
}
view.addView(textView)
}
......@@ -753,8 +754,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
srlContainer.isRefreshing = false
// 埋点
val sign1 = data.map { it.id }.joinToString { "|" }
ActionCountUtils.baiDuCountSign3(ConsultBIConstants.PART_ID_CONSULT_COUNSELOR_LIST_PAGE,ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_PAGE_VISIT,sign1,sign2,"app")
mIdssign1 = data.joinToString(","){it.id}
ActionCountUtils.baiDuCountSign3(ConsultBIConstants.PART_ID_CONSULT_COUNSELOR_LIST_PAGE,ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_PAGE_VISIT,mIdssign1,sign2,"app")
}
override fun fetchListFailed(msg: String?) {
......@@ -936,15 +937,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//筛选确认回调
override fun onFilterConfirmed() {
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(
","
)
)
props1.put(
"filtrate_second",
tempFilter.showType.value + ","
......@@ -955,6 +948,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
)
BuryPointUtils.buryPoint("Filtrate", props1)
// 埋点
if (tempFilter.specialityCrowd.size>0){
val sign1 = tempFilter.specialityCrowd.joinToString(","){it.value!!}
ActionCountUtils.baiDuCountSign3(ConsultBIConstants.PART_ID_CONSULT_FILTER_PAGE,ConsultBIConstants.ConsultEvent.POSITION_GOODAT_CROWD_CLICK,sign1,"app","")
}
allFilter.showType = tempFilter.showType
allFilter.enquiries.clear()
......@@ -1295,16 +1294,16 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
*/
override fun onCategoriesSelected(signLit:ArrayList<String>) {
if (signLit.isNotEmpty()){
val sign1 = signLit.map { it }.joinToString { "," }
val sign1 = signLit.joinToString(","){it}
ActionCountUtils.baiDuCountSign3(ConsultBIConstants.PART_ID_CONSULT_COUNSELOR_LIST_PAGE,ConsultBIConstants.ConsultEvent.POSITION_TWO_CATEGORY_CLICK, sign1,"app","")
}
if (allFilter.categoryId2List.size>0||allFilter.categoryId3List.size>0){
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
refresh()
}else{
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_NORMAL)
}
refresh()
}
override fun onRefresh() {
......@@ -1319,8 +1318,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
*/
private var sign2=""
fun onEvent(event: HomeModuleTabEvent) {
if (!TextUtils.isEmpty(event.sign)){
if (!TextUtils.isEmpty(event.sign)){
sign2 = event.sign
// 埋点
if (!TextUtils.isEmpty(mIdssign1)){
ActionCountUtils.baiDuCountSign3(ConsultBIConstants.PART_ID_CONSULT_COUNSELOR_LIST_PAGE,ConsultBIConstants.POSITION_CONSULT_COUNSELOR_LIST_PAGE_VISIT,mIdssign1,sign2,"app")
}
}
}
......
......@@ -10,6 +10,7 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.mvp.base.SimplePresenter
import com.ydl.ydlcommon.utils.RxLifecycleUtils
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxAppTool
import com.yidianling.consultant.http.ExpertSearchDataManager
import com.yidianling.consultant.model.SearchApi
......@@ -47,7 +48,7 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
@SuppressLint("CheckResult")
fun fetchListData(allFilter: AllFilter, extras: Extras?) {
//是否亲子教育字段
ConsultAssistantDialogUtils.REALATION_EDUCATION = allFilter.categories.size == 1 && allFilter.categories[0].cateId == "23"
// ConsultAssistantDialogUtils.REALATION_EDUCATION = allFilter.categories.size == 1 && allFilter.categories[0].cateId == "23"
val map = HashMap<String, Any>()
// filter
......@@ -58,15 +59,15 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
}
val categoryList = ArrayList<Any>()
// 八大类一级标签
if (allFilter.categoryId2List.isNotEmpty()){
if (allFilter.categoryId2List.size>0){
val categoryMap2 = HashMap<String, Any>()
val categoryIdMap2 = HashMap<String, Any>()
categoryIdMap2["in"] = allFilter.categoryId2List
categoryMap2["product_cates.category_id3"] = categoryIdMap2
categoryMap2["product_cates.category_id2"] = categoryIdMap2
categoryList.add(categoryMap2)
}
// 八大类二级标签
if (allFilter.categoryId3List.isNotEmpty()){
if (allFilter.categoryId3List.size>0){
val categoryMap3 = HashMap<String, Any>()
val categoryIdMap3 = HashMap<String, Any>()
categoryIdMap3["in"] = allFilter.categoryId3List
......@@ -77,7 +78,7 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
filterMap["__or"] = categoryList
}
// 主题
if (allFilter.categories.isNotEmpty()) {
if (allFilter.categories.size>0) {
val categories = ArrayList<String?>()
allFilter.categories.forEach {
categories.add(it.cateId)
......@@ -157,18 +158,31 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
// 其它
if (allFilter.others.isNotEmpty()) {
val gender = ArrayList<String?>()
val bookIngStatusList = ArrayList<String>()
allFilter.others.forEach {
if (it.key1=="gender"){
gender.add(it.value1)
}else{
filterMap[it.key1] = it.value1
when (it.key1) {
"gender" -> {
gender.add(it.value1)
}
"booking_status" -> {
bookIngStatusList.add("1")
bookIngStatusList.add("2")
}
else -> {
filterMap[it.key1] = it.value1
}
}
}
val genderMap = HashMap<String, Any>()
if (gender.size>0){
val genderMap = HashMap<String, Any>()
genderMap["in"] = gender
filterMap["gender"] = genderMap
}
if (bookIngStatusList.size>0){
val bookStatusMap = HashMap<String, Any>()
bookStatusMap["in"] = bookIngStatusList
filterMap["booking_status"] = bookStatusMap
}
}
map["filter"] = filterMap
......
......@@ -11,43 +11,42 @@ import android.view.WindowManager
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.ydl.ydl_image.config.ISimpleImageOpConfig
import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseMvpActivity
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.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.FixSizeLinkedList
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.*
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.banner.GlideImageLoader
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.adapter.SearchWordsAdapter
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.bean.HotSearchFocusItemBean
import com.yidianling.consultant.bean.HotSearchKeyWordDataBean
import com.yidianling.consultant.bean.HotSearchPopularDoctorBean
import com.yidianling.consultant.bean.*
import com.yidianling.consultant.constants.ConsultBIConstants
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.TempH5RouteUtils
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_item_expert_hot_search.view.*
@Route(path = "/consult/hot_search")
class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchContract.Presenter>(),
IHotSearchContract.View {
class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchContract.Presenter>(), IHotSearchContract.View {
private lateinit var searchWordsAdapter:SearchWordsAdapter
private val searchSuggestList: ArrayList<SearchSuggestListBean> = ArrayList()
private var mSearchContent:String = ""
private val CACHE_CONSULT_SEARCH_HISTORY_DATA = "cache_consult_search_history_data"
private val HOT_SEARCH_DOCTOR_NAME = "hot_search_doctor_name"
private var historyList: FixSizeLinkedList<String> = FixSizeLinkedList(15)
......@@ -84,7 +83,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
}
private fun getDataFromIntent() {
var doctorName = intent.getStringExtra(HOT_SEARCH_DOCTOR_NAME)
val doctorName = intent.getStringExtra(HOT_SEARCH_DOCTOR_NAME)
if (!TextUtils.isEmpty(doctorName)) {
etSearch.setText(doctorName)
iv_delete_icon.visibility = View.VISIBLE
......@@ -92,6 +91,10 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
}
private fun initViews() {
StatusBarUtils.statusBarLightMode(this)
maxWidth = (2 * RxDeviceTool.getScreenWidth(this@HotSearchActivity)) - RxImageTool.dip2px(60f)
dp42 = RxImageTool.dip2px(60f)
iv_delete_icon.setOnClickListener {
etSearch.setText("")
}
......@@ -101,12 +104,6 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
}
true
}
etSearch.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
doSearch()
}
true
}
tv_search_cancle.setOnClickListener {
finish()
}
......@@ -126,18 +123,27 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
iv_daoyi_image.setOnClickListener {
LogUtil.e("跳转导医:location=${data?.get(0)!!.location},title=${data[0].title}")
ConsultAssistantEntryUtils.jumpConsultAssistant(this,data?.get(0)!!.location.toInt(),"learning")
ConsultAssistantEntryUtils.jumpConsultAssistant(this, data[0].location.toInt(),"learning")
}
}
searchWordsAdapter = SearchWordsAdapter(searchSuggestList)
rv_search_words.layoutManager = LinearLayoutManager(this)
rv_search_words.adapter = searchWordsAdapter
searchWordsAdapter.setOnItemClickListener { adapter, view, position ->
}
etSearch.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {
if (TextUtils.isEmpty(s)) {
iv_delete_icon.visibility = View.INVISIBLE
rv_search_words.visibility = View.GONE
getSearchWords("")
} else {
iv_delete_icon.visibility = View.VISIBLE
getSearchWords(s.toString())
}
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
......@@ -147,10 +153,31 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
}
})
StatusBarUtils.statusBarLightMode(this)
maxWidth =
(2 * RxDeviceTool.getScreenWidth(this@HotSearchActivity)) - RxImageTool.dip2px(60f)
dp42 = RxImageTool.dip2px(60f)
}
/**
* 获取搜索联想词
*/
private fun getSearchWords(searchContent:String){
if (!TextUtils.isEmpty(searchContent)){
mSearchContent = searchContent
val map = HashMap<String, Any>()
map["content"] = searchContent
mPresenter.getSearchWords(map)
}else{
rv_search_words.visibility = View.GONE
}
}
override fun getSearchWordsSuccess(searchWordsBean: SearchWordsBean) {
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
}
}
private fun initData() {
......@@ -179,6 +206,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
refreshBanner(null)
}
//刷新 热门搜索
private fun refreshHotSearchData(keywordData: MutableList<HotSearchKeyWordDataBean>?) {
if (null == keywordData || keywordData.isEmpty()) {
......@@ -308,32 +336,34 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
return rect.width()//文字宽
}
//执行搜索
/**
* 搜索
*/
private fun doSearch() {
val view = this.currentFocus
if (view != null) {
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(view.windowToken, 0)
}
val keyWord = etSearch.text.toString()
// if (TextUtils.isEmpty(keyWord.trim())) {
// ToastUtil.toastShort("请输入搜索内容")
// return
// }
ActionCountUtils.count(ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK,keyWord)
if (!TextUtils.isEmpty(keyWord)) {
historyList.remove(keyWord)
historyList.add(keyWord)
val searchWords = etSearch.text.toString()
ActionCountUtils.count(ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK,searchWords)
if (!TextUtils.isEmpty(searchWords)) {
historyList.remove(searchWords)
historyList.add(searchWords)
SharedPreferencesEditor.putString(
CACHE_CONSULT_SEARCH_HISTORY_DATA,
Gson().toJson(historyList)
)
}
ExpertSearchActivity.startSearch(this, keyWord,"14")
this.finish()
// 搜索的关联词
var relatedWords = ""
if (searchSuggestList.isNotEmpty()){
searchSuggestList[0].suggest_relations?.let {
relatedWords = it[0]
}
}
ExpertSearchActivity.startSearch(this, searchWords,"14",relatedWords)
finish()
}
override fun onDestroy() {
......
package com.yidianling.consultant.adapter
import android.text.SpannableString
import android.text.Spanned
import android.text.style.ForegroundColorSpan
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yidianling.consultant.R
import com.yidianling.consultant.bean.SearchSuggestListBean
/**
* Created by Ykai on 2022/5/30.
*/
class SearchWordsAdapter(data: List<SearchSuggestListBean>) : BaseQuickAdapter<SearchSuggestListBean, BaseViewHolder>(R.layout.consultant_item_search_words,data) {
private var mSearchWord:String = ""
override fun convert(holder: BaseViewHolder, item: SearchSuggestListBean) {
val tvSearchWords = holder.getView<TextView>(R.id.tv_search_words)
tvSearchWords.text = setWordsStyle(item.suggest_content,mSearchWord)
}
fun notifyDataAndSetSearchWord(searchWord: String){
mSearchWord = searchWord
notifyDataSetChanged()
}
private fun setWordsStyle(words:String,searchWord:String):SpannableString{
val spannableString = SpannableString(words)
if (words.contains(searchWord)){
val startIndex = words.indexOf(searchWord)
val endIndex = startIndex+searchWord.length
spannableString.setSpan(ForegroundColorSpan(ContextCompat.getColor(mContext,R.color.platform_main_theme)), startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
}
return spannableString
}
}
\ No newline at end of file
package com.yidianling.consultant.bean
/**
* Created by Ykai on 2022/5/30.
*/
data class SearchWordsBean(
val search_suggests:ArrayList<SearchSuggestListBean>?
)
data class SearchSuggestListBean(
val id:String,
val score:String,
val suggest_content:String,
val suggest_relations:ArrayList<String>?,
val search_count: Int,
val suggest_classify_types:ArrayList<String>,
val mapping_classify_type_exist:Boolean
)
\ No newline at end of file
......@@ -56,6 +56,7 @@ class ConsultBIConstants {
const val POSITION_CONSULT_COUNSELOR_CARD_CLICK="consult_counselor_card_click" // 咨询师列表点击position
const val POSITION_CHOICE_FILTER_CLICK="choice_filter_click" // 热门点击项position
const val POSITION_TWO_CATEGORY_CLICK="two_category_click" // 八大类标签选择埋点
const val POSITION_GOODAT_CROWD_CLICK="goodat_crowd_click" // 擅长人群埋点
}
}
class ConsultSearchListEvent {
......
......@@ -5,6 +5,7 @@ import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.bean.SearchWordsBean
import io.reactivex.Observable
/**
......@@ -26,6 +27,11 @@ class IHotSearchContract {
* 请求失败
*/
fun requestFail()
/**
* 联想词请求成功结果
*/
fun getSearchWordsSuccess(searchWordsBean: SearchWordsBean)
}
interface Presenter : IPresenter<View> {
......@@ -38,6 +44,11 @@ class IHotSearchContract {
* 搜索页接口请求
*/
fun searchData()
/**
* 获取联想词
*/
fun getSearchWords(map:HashMap<String,Any>)
}
interface Model : IModel {
......@@ -45,5 +56,10 @@ class IHotSearchContract {
* 搜索页接口
*/
fun searchData(): Observable<HotSearchBean>
/**
* 获取到联想词
*/
fun getSearchWords(map:HashMap<String,Any>): Observable<SearchWordsBean>
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.yidianling.consultant.http
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.yidianling.consultant.bean.ExpertSearchTopShowBean
import com.yidianling.consultant.bean.SearchWordsBean
import com.yidianling.consultant.model.bean.ExpertBean
import io.reactivex.Observable
......@@ -19,6 +20,11 @@ interface IExpertSearchHttp{
// fun searchDoctor(params : String?): Observable<BaseAPIResponse<ExpertSearchBean>>
/**
* 获取搜索联想词
*/
// fun getSearchWords(map:Map<String,Any>): Observable<BaseAPIResponse<SearchWordsBean>>
/**
* 获取专家列表
*/
fun getExpertList(map:Map<String,Any>): Observable<BaseAPIResponse<ExpertBean>>
......
......@@ -4,6 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.bean.SearchWordsBean
import com.yidianling.consultant.http.ExpertSearchParam
import com.yidianling.consultant.model.SearchApi
import io.reactivex.Observable
......@@ -46,4 +47,8 @@ class HotSearchHttpImpl : IHotSearchHttp {
getSearchApi().searchPage()
}
}
override fun getSearchWords(map: HashMap<String, Any>): Observable<BaseAPIResponse<SearchWordsBean>> {
return getSearchApi().getSearchWords(map)
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.yidianling.consultant.http.hotsearch
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.bean.SearchWordsBean
import io.reactivex.Observable
/**
......@@ -13,7 +14,12 @@ import io.reactivex.Observable
*/
interface IHotSearchHttp{
/**
* 测评首页请求
* 搜索页请求
*/
fun searchData(): Observable<BaseAPIResponse<HotSearchBean>>
/**
* 搜索联想词请求
*/
fun getSearchWords(map:HashMap<String,Any>): Observable<BaseAPIResponse<SearchWordsBean>>
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.yidianling.consultant.model
import com.ydl.ydlcommon.data.http.RxUtils
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.bean.SearchWordsBean
import com.yidianling.consultant.contract.IHotSearchContract
import com.yidianling.consultant.http.hotsearch.HotSearchDataManager
import io.reactivex.Observable
......@@ -17,4 +18,8 @@ class HotSearchModelImpl : IHotSearchContract.Model{
override fun searchData(): Observable<HotSearchBean> {
return HotSearchDataManager.getHttp().searchData().compose(RxUtils.resultJavaData())
}
override fun getSearchWords(map:HashMap<String,Any>): Observable<SearchWordsBean> {
return HotSearchDataManager.getHttp().getSearchWords(map).compose(RxUtils.resultJavaData())
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.consultant.bean.ExpertSearchTopShowBean
import com.yidianling.consultant.bean.GuideBean
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.bean.SearchWordsBean
import com.yidianling.consultant.model.bean.ExpertBean
import com.yidianling.consultant.model.bean.HeadData
import io.reactivex.Observable
......@@ -42,11 +43,6 @@ interface SearchApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun searchConditions(@Query("cateSource") cateSource: Int): Observable<BaseAPIResponse<HeadData>>
//专家服务搜索
// @retrofit2.http.Headers("Content-Type:application/json")
// @GET
// fun searchDoctorService(@Url url: String): Observable<BaseAPIResponse<ExpertSearchBean>>
/**
* 新咨询师列表接口(包含搜索、筛选咨询师)
......@@ -55,6 +51,13 @@ interface SearchApi {
@POST("smart-rank/v1/search")
fun getExpertList(@Body map: Map<String,@JvmSuppressWildcards Any>):Observable<BaseAPIResponse<ExpertBean>>
/**
* 获取搜索联想词
*/
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
@POST("dmp/v1/searchsuggest")
fun getSearchWords(@Body map: Map<String,@JvmSuppressWildcards Any>):Observable<BaseAPIResponse<SearchWordsBean>>
//搜索页面接口
@retrofit2.http.Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
......
......@@ -14,7 +14,7 @@ data class ExpertServiceItem(
/**
* 专家ID
*/
val id: String?,
val id: String,
/**
* 专家uid
*/
......@@ -135,7 +135,7 @@ data class ExpertServiceItem(
)
data class FeatureTag(
val tag_id:Int,
val tag_id:String,
val tag_name:String,
val is_highlight:Boolean, // 是否高亮
val type:String // 标签类型
......
package com.yidianling.consultant.presenter
import android.annotation.SuppressLint
import android.content.Context
import android.text.TextUtils
import com.google.gson.Gson
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.utils.RxLifecycleUtils
import com.ydl.ydlcommon.utils.YDLAsyncUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.bean.HotSearchBean
import com.yidianling.consultant.contract.IHotSearchContract
import com.yidianling.consultant.model.HotSearchModelImpl
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
/**
* @author yuanwai
* @描述:搜索页面逻辑实现类
......@@ -20,8 +26,7 @@ import io.reactivex.functions.Consumer
* @Company 壹点灵
* @date 2019/3/19
*/
class HotSearchPresenterImpl () :
BasePresenter<IHotSearchContract.View, IHotSearchContract.Model>(), IHotSearchContract.Presenter{
class HotSearchPresenterImpl : BasePresenter<IHotSearchContract.View, IHotSearchContract.Model>(), IHotSearchContract.Presenter{
/**
* 实例化数据模型
......@@ -71,4 +76,20 @@ class HotSearchPresenterImpl () :
}
})
}
@SuppressLint("CheckResult")
override fun getSearchWords(map:HashMap<String,Any>) {
mModel.getSearchWords(map)
.debounce(500L, TimeUnit.MILLISECONDS)
.compose(RxLifecycleUtils.bindToLifecycle(mView))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
mView.getSearchWordsSuccess(it)
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
ToastUtil.toastShort(msg)
}
})
}
}
\ No newline at end of file
......@@ -124,6 +124,7 @@ class CategoryPopupWindow(context: Context,allFilter:AllFilter) : PopupWindow(Vi
}
mAllFilter.categoryId2List.clear()
mAllFilter.categoryId3List.clear()
signList.clear()
}
// 确定
view.btnConfirm.setOnClickListener {
......@@ -160,6 +161,7 @@ class CategoryPopupWindow(context: Context,allFilter:AllFilter) : PopupWindow(Vi
if (!childList[position].isSelected&&childList[0].isSelected){
childList[0].isSelected = false
mAllFilter.categoryId2List.remove(childList[0].cate_id)
signList.remove("亲子教育")
}
childList[position].isSelected = !childList[position].isSelected
if (childList[position].isSelected){
......@@ -204,6 +206,7 @@ class CategoryPopupWindow(context: Context,allFilter:AllFilter) : PopupWindow(Vi
if (!stressList[position].isSelected&&stressList[0].isSelected){
stressList[0].isSelected = false
mAllFilter.categoryId2List.remove(stressList[0].cate_id)
signList.remove("情绪压力")
}
stressList[position].isSelected = !stressList[position].isSelected
if (stressList[position].isSelected){
......@@ -248,6 +251,7 @@ class CategoryPopupWindow(context: Context,allFilter:AllFilter) : PopupWindow(Vi
if (!loveEmotionList[position].isSelected&&loveEmotionList[0].isSelected){
loveEmotionList[0].isSelected = false
mAllFilter.categoryId2List.remove(loveEmotionList[0].cate_id)
signList.remove("恋爱情感")
}
loveEmotionList[position].isSelected = !loveEmotionList[position].isSelected
if (loveEmotionList[position].isSelected){
......@@ -292,6 +296,7 @@ class CategoryPopupWindow(context: Context,allFilter:AllFilter) : PopupWindow(Vi
if (!marriedFamilyList[position].isSelected&&marriedFamilyList[0].isSelected){
marriedFamilyList[0].isSelected = false
mAllFilter.categoryId2List.remove(marriedFamilyList[0].cate_id)
signList.remove("婚姻家庭")
}
marriedFamilyList[position].isSelected = !marriedFamilyList[position].isSelected
if (marriedFamilyList[position].isSelected){
......@@ -336,6 +341,7 @@ class CategoryPopupWindow(context: Context,allFilter:AllFilter) : PopupWindow(Vi
if (!personalGrowthList[position].isSelected&&personalGrowthList[0].isSelected){
personalGrowthList[0].isSelected = false
mAllFilter.categoryId2List.remove(childList[0].cate_id)
signList.remove("个人成长")
}
personalGrowthList[position].isSelected = !personalGrowthList[position].isSelected
if (personalGrowthList[position].isSelected){
......@@ -380,6 +386,7 @@ class CategoryPopupWindow(context: Context,allFilter:AllFilter) : PopupWindow(Vi
if (!interpersonalRelationshipList[position].isSelected&&interpersonalRelationshipList[0].isSelected){
interpersonalRelationshipList[0].isSelected = false
mAllFilter.categoryId2List.remove(interpersonalRelationshipList[0].cate_id)
signList.remove("人际关系")
}
interpersonalRelationshipList[position].isSelected = !interpersonalRelationshipList[position].isSelected
if (interpersonalRelationshipList[position].isSelected){
......@@ -423,6 +430,8 @@ class CategoryPopupWindow(context: Context,allFilter:AllFilter) : PopupWindow(Vi
}else{
if (!careerDevelopmentList[position].isSelected&&careerDevelopmentList[0].isSelected){
careerDevelopmentList[0].isSelected = false
mAllFilter.categoryId2List.remove(careerDevelopmentList[0].cate_id)
signList.remove("职场发展")
}
careerDevelopmentList[position].isSelected = !careerDevelopmentList[position].isSelected
if (careerDevelopmentList[position].isSelected){
......@@ -466,6 +475,8 @@ class CategoryPopupWindow(context: Context,allFilter:AllFilter) : PopupWindow(Vi
}else{
if (!mentalHealthList[position].isSelected&&mentalHealthList[0].isSelected){
mentalHealthList[0].isSelected = false
mAllFilter.categoryId2List.remove(mentalHealthList[0].cate_id)
signList.remove("心理健康")
}
mentalHealthList[position].isSelected = !mentalHealthList[position].isSelected
if (mentalHealthList[position].isSelected){
......
......@@ -243,13 +243,6 @@ class FilterPopupWindow(private val context: Context, private val filterData: Fi
biEventParams = tempFilter.doctorEdu.map { it.value }.joinToString(",")
}
}
// 擅长人群拼接
if (tempFilter.specialityCrowd.isNotEmpty()){
sb.append("&crowdsTags=").append(tempFilter.specialityCrowd.map { it.key }.joinToString(","))
if (ConsultBIConstants.POSITION_GOOD_AT_CLICK==biEventName){
biEventParams = tempFilter.specialityCrowd.map { it.key }.joinToString(",")
}
}
if (tempFilter.others.isNotEmpty()) {
sb.append("&others=").append(tempFilter.others.map { it.key }.joinToString(","))
if (ConsultBIConstants.POSITION_OTHER_CHOICE_CLICK == biEventName) {
......@@ -461,7 +454,6 @@ class FilterPopupWindow(private val context: Context, private val filterData: Fi
textView.isSelected = true
textView.paint.isFakeBoldText = true
}
updateCount(ConsultBIConstants.POSITION_GOOD_AT_CLICK)
}
if (index>19){
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="4dp" />
<stroke
android:width="0.5dp"
android:color="@color/platform_color_EBEBEB" />
<solid android:color="#f9f9f9" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/platform_white">
<LinearLayout
android:id="@+id/clContainer"
<RelativeLayout
android:id="@+id/rl_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="@dimen/consultant_title_bar_height"
android:paddingStart="15dp"
android:tag="tag_search_input"
app:layout_constraintTop_toTopOf="parent"
>
<RelativeLayout
android:id="@+id/rl_search"
<View
android:id="@+id/view_search_input_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/consultant_title_bar_height"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:layout_marginRight="60dp"
android:background="@drawable/consultant_bg_hot_search_input"
android:tag="tag_search_input_bg" />
<ImageView
android:id="@+id/iv_search_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"
android:scaleType="centerCrop"
android:src="@drawable/consultant_icon_input_search"
android:tag="tag_search_input_img" />
<EditText
android:id="@+id/etSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:layout_toLeftOf="@+id/iv_delete_icon"
android:layout_toRightOf="@id/iv_search_icon"
android:background="@null"
android:cursorVisible="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:paddingLeft="15dp"
android:tag="tag_search_input">
android:hint="搜索心理问题或专家姓名"
android:imeOptions="actionSearch"
android:maxLength="100"
android:singleLine="true"
android:tag="tag_search_input_edit"
android:textColor="#242424"
android:textColorHint="#b3b3b3"
android:textCursorDrawable="@drawable/consultant_edit_cursor_drawable"
android:textSize="13sp" />
<ImageView
android:id="@+id/iv_delete_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignRight="@+id/view_search_input_bg"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:scaleType="centerCrop"
android:src="@drawable/platform_delete"
android:visibility="invisible" />
<TextView
android:id="@+id/tv_search_cancle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:padding="5dp"
android:text="取消"
android:textColor="#242424"
android:textSize="15dp" />
</RelativeLayout>
<View
android:id="@+id/v_topLine"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="@+id/rl_search"
android:layout_marginTop="@dimen/platform_dp_6"
android:background="@color/platform_color_E0E0E0"
app:layout_constraintTop_toBottomOf="@id/rl_search" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@id/v_topLine"
>
<View
android:id="@+id/view_search_input_bg"
<LinearLayout
android:id="@+id/clContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.ydl.ydlcommon.view.widgets.RoundImageView
android:id="@+id/iv_daoyi_image"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:layout_marginRight="60dp"
android:background="@drawable/consultant_bg_hot_search_input"
android:tag="tag_search_input_bg" />
<ImageView
android:id="@+id/iv_search_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_centerVertical="true"
android:layout_height="90dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"
android:layout_marginRight="15dp"
android:scaleType="centerCrop"
android:src="@drawable/consultant_icon_input_search"
android:tag="tag_search_input_img" />
android:visibility="gone"
app:pa_borderRadius="8dp"
app:pa_type="pa_round"
tools:visibility="visible" />
<EditText
android:id="@+id/etSearch"
<LinearLayout
android:id="@+id/ll_search_history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:layout_toLeftOf="@+id/iv_delete_icon"
android:layout_toRightOf="@id/iv_search_icon"
android:background="@null"
android:cursorVisible="true"
android:layout_below="@+id/v_topLine"
android:layout_marginTop="13dp"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="搜索心理问题或专家姓名"
android:imeOptions="actionSearch"
android:maxLength="100"
android:singleLine="true"
android:tag="tag_search_input_edit"
android:textColor="#242424"
android:textColorHint="#b3b3b3"
android:textCursorDrawable="@drawable/consultant_edit_cursor_drawable"
android:textSize="13sp" />
<ImageView
android:id="@+id/iv_delete_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignRight="@+id/view_search_input_bg"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:scaleType="centerCrop"
android:src="@drawable/platform_delete"
android:visibility="invisible" />
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<TextView
android:id="@+id/tv_search_cancle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:padding="5dp"
android:text="取消"
android:textColor="#242424"
android:textSize="15dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<View
android:id="@+id/v_topLine"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@+id/rl_search"
android:layout_marginTop="@dimen/platform_dp_6"
android:layout_marginBottom="13dp"
android:background="@color/platform_color_E0E0E0" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="历史搜索"
android:textColor="#242424"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<ImageView
android:id="@+id/iv_delete_history"
android:layout_width="28dp"
android:layout_height="28dp"
android:padding="5dp"
android:src="@drawable/consultant_hot_search_delete_icon" />
<com.ydl.ydlcommon.view.widgets.RoundImageView
android:id="@+id/iv_daoyi_image"
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:scaleType="centerCrop"
android:visibility="gone"
app:pa_borderRadius="8dp"
app:pa_type="pa_round"
tools:visibility="visible" />
</LinearLayout>
<cn.lankton.flowlayout.FlowLayout
android:id="@+id/fl_search_history"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp" />
<LinearLayout
android:id="@+id/ll_search_history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/v_topLine"
android:layout_marginTop="13dp"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp">
</LinearLayout>
<LinearLayout
android:id="@+id/llHotSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
android:layout_below="@id/ll_search_history"
android:layout_marginTop="13dp"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="历史搜索"
android:text="热门搜索"
android:textColor="#242424"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<ImageView
android:id="@+id/iv_delete_history"
android:layout_width="28dp"
android:layout_height="28dp"
android:padding="5dp"
android:src="@drawable/consultant_hot_search_delete_icon" />
<cn.lankton.flowlayout.FlowLayout
android:id="@+id/flHotSearch"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp" />
</LinearLayout>
<cn.lankton.flowlayout.FlowLayout
android:id="@+id/fl_search_history"
<LinearLayout
android:id="@+id/llHotExpert"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp" />
android:layout_height="wrap_content"
android:layout_below="@id/llHotSearch"
android:layout_marginTop="13dp"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:visibility="gone"
tools:visibility="visible">
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="本周热门专家"
android:textColor="#242424"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/llHotSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/ll_search_history"
android:layout_marginTop="13dp"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="热门搜索"
android:textColor="#242424"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<cn.lankton.flowlayout.FlowLayout
android:id="@+id/flHotExpert"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp" />
</LinearLayout>
<cn.lankton.flowlayout.FlowLayout
android:id="@+id/flHotSearch"
<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp" />
</LinearLayout>
android:layout_height="80dp"
android:layout_below="@+id/llHotExpert"
android:layout_marginLeft="@dimen/platform_dp_15"
android:layout_marginTop="@dimen/platform_dp_28"
android:layout_marginRight="@dimen/platform_dp_15"
android:layout_marginBottom="@dimen/platform_dp_28"
app:cardCornerRadius="@dimen/platform_dp_4"
app:cardElevation="0px">
<LinearLayout
android:id="@+id/llHotExpert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/llHotSearch"
android:layout_marginTop="13dp"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="本周热门专家"
android:textColor="#242424"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<com.ydl.ydlcommon.view.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="80dp"
android:scaleType="centerCrop"
android:tag="overScroll"
app:pa_indicator_different_width="14dp"
app:pa_indicator_drawable_selected="@drawable/consultant_banner_indicator_select"
app:pa_indicator_drawable_unselected="@drawable/consultant_banner_indicator_unselect"
app:pa_indicator_height="5dp"
app:pa_indicator_margin="1.25dp"
app:pa_is_selected_same_unselected="false" />
</androidx.cardview.widget.CardView>
<cn.lankton.flowlayout.FlowLayout
android:id="@+id/flHotExpert"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp" />
</LinearLayout>
</ScrollView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_search_words"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/v_topLine"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@color/white"
android:layout_marginTop="8dp"
android:visibility="gone"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_below="@+id/llHotExpert"
android:layout_marginLeft="@dimen/platform_dp_15"
android:layout_marginTop="@dimen/platform_dp_28"
android:layout_marginRight="@dimen/platform_dp_15"
android:layout_marginBottom="@dimen/platform_dp_28"
app:cardCornerRadius="@dimen/platform_dp_4"
app:cardElevation="0px">
<com.ydl.ydlcommon.view.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="80dp"
android:scaleType="centerCrop"
android:tag="overScroll"
app:pa_indicator_different_width="14dp"
app:pa_indicator_drawable_selected="@drawable/consultant_banner_indicator_select"
app:pa_indicator_drawable_unselected="@drawable/consultant_banner_indicator_unselect"
app:pa_indicator_height="5dp"
app:pa_indicator_margin="1.25dp"
app:pa_is_selected_same_unselected="false" />
</androidx.cardview.widget.CardView>
</LinearLayout>
</ScrollView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:src="http://schemas.android.com/tools"
android:paddingTop="12dp"
android:paddingBottom="12dp">
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_centerVertical="true"
android:src="@drawable/consultant_icon_input_search"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="16dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<TextView
android:id="@+id/tv_search_words"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
src:text="李哈哈"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:textColor="@color/platform_color_242424"
android:layout_marginStart="38dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/platform_white"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
......@@ -81,6 +82,65 @@
android:layout_width="match_parent"
android:layout_height="6dp"
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>
......
......@@ -23,7 +23,6 @@ import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.bean.ShareData
import com.ydl.ydlcommon.data.PlatformRamImpl
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.ModularServiceManager.provide
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.Utils
......
......@@ -2,9 +2,12 @@ package com.ydl.ydlnet.builder.interceptor.log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.text.TextUtils;
import com.ydl.ydlnet.utils.CharacterHandler;
import com.ydl.ydlnet.utils.NetLogUtils;
import okhttp3.MediaType;
import okhttp3.Request;
......@@ -48,17 +51,17 @@ public class DefaultFormatPrinter {
* @param request
* @param bodyString
*/
public void printJsonRequest(@NonNull Request request, @NonNull String bodyString) {
final String requestBody = LINE_SEPARATOR + BODY_TAG + LINE_SEPARATOR + bodyString;
final String tag = getTag(true);
if (!request.url().toString().contains("writeMaiDianData")){
NetLogUtils.debugInfo(tag, REQUEST_UP_LINE);
logLines(tag, new String[]{URL_TAG + request.url()}, false);
logLines(tag, getRequest(request), true);
logLines(tag, requestBody.split(LINE_SEPARATOR), true);
NetLogUtils.debugInfo(tag, END_LINE);
}
// if (!request.url().toString().contains("writeMaiDianData")){
NetLogUtils.debugInfo(tag, REQUEST_UP_LINE);
logLines(tag, new String[]{URL_TAG + request.url()}, false);
logLines(tag, getRequest(request), true);
logLines(tag, requestBody.split(LINE_SEPARATOR), true);
NetLogUtils.debugInfo(tag, END_LINE);
// }
}
......@@ -67,16 +70,16 @@ public class DefaultFormatPrinter {
*
* @param request
*/
public void printFileRequest(@NonNull Request request) {
final String tag = getTag(true);
if (!request.url().toString().contains("writeMaiDianData")){
NetLogUtils.debugInfo(tag, REQUEST_UP_LINE);
logLines(tag, new String[]{URL_TAG + request.url()}, false);
logLines(tag, getRequest(request), true);
logLines(tag, OMITTED_REQUEST, true);
NetLogUtils.debugInfo(tag, END_LINE);
}
// if (!request.url().toString().contains("writeMaiDianData")){
NetLogUtils.debugInfo(tag, REQUEST_UP_LINE);
logLines(tag, new String[]{URL_TAG + request.url()}, false);
logLines(tag, getRequest(request), true);
logLines(tag, OMITTED_REQUEST, true);
NetLogUtils.debugInfo(tag, END_LINE);
// }
}
......@@ -93,7 +96,7 @@ public class DefaultFormatPrinter {
* @param message 响应信息
* @param responseUrl 请求地址
*/
public void printJsonResponse(long chainMs, boolean isSuccessful, int code, @NonNull String headers, @Nullable MediaType contentType,
@Nullable String bodyString, @NonNull List<String> segments, @NonNull String message, @NonNull final String responseUrl) {
bodyString = RequestLogInterceptor.isJson(contentType) ? CharacterHandler.jsonFormat(bodyString)
......@@ -102,13 +105,13 @@ public class DefaultFormatPrinter {
final String responseBody = LINE_SEPARATOR + BODY_TAG + LINE_SEPARATOR + bodyString;
final String tag = getTag(false);
final String[] urlLine = {URL_TAG + responseUrl, N};
if (!responseUrl.contains("writeMaiDianData")){
// if (!responseUrl.contains("writeMaiDianData")) {
NetLogUtils.debugInfo(tag, RESPONSE_UP_LINE);
logLines(tag, urlLine, true);
logLines(tag, getResponse(headers, chainMs, code, isSuccessful, segments, message), true);
logLines(tag, responseBody.split(LINE_SEPARATOR), true);
NetLogUtils.debugInfo(tag, END_LINE);
}
// }
}
/**
......@@ -122,18 +125,18 @@ public class DefaultFormatPrinter {
* @param message 响应信息
* @param responseUrl 请求地址
*/
public void printFileResponse(long chainMs, boolean isSuccessful, int code, @NonNull String headers,
@NonNull List<String> segments, @NonNull String message, @NonNull final String responseUrl) {
final String tag = getTag(false);
final String[] urlLine = {URL_TAG + responseUrl, N};
if (!responseUrl.contains("writeMaiDianData")){
// if (!responseUrl.contains("writeMaiDianData")) {
NetLogUtils.debugInfo(tag, RESPONSE_UP_LINE);
logLines(tag, urlLine, true);
logLines(tag, getResponse(headers, chainMs, code, isSuccessful, segments, message), true);
logLines(tag, OMITTED_RESPONSE, true);
NetLogUtils.debugInfo(tag, END_LINE);
}
// }
}
/**
......@@ -157,7 +160,7 @@ public class DefaultFormatPrinter {
}
private static ThreadLocal<Integer> last = new ThreadLocal<Integer>() {
protected Integer initialValue() {
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment