Commit 9d53d32a by 刘鹏

Merge branch 'feat/zl/consult_top_modify' into 'd/4.4.10'

【C】咨询页顶部资源位改版1期

See merge request app_android_lib/YDL-Component!350
parents 39aae139 43602498
...@@ -98,6 +98,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -98,6 +98,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun showPromptPayment(promptPaymentBean: PromptPaymentBean) { override fun showPromptPayment(promptPaymentBean: PromptPaymentBean) {
} }
override fun consultTopBannerBean(consultantTopData: MutableList<ConsultantTopBannerBean>) {
}
override fun showImage( override fun showImage(
url: String?, url: String?,
imgView: ImageView, imgView: ImageView,
......
...@@ -47,6 +47,7 @@ import com.ydl.ydlcommon.view.listener.EndlessRecyclerViewScrollListener ...@@ -47,6 +47,7 @@ import com.ydl.ydlcommon.view.listener.EndlessRecyclerViewScrollListener
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.adapter.ConsultantTopAdapter
import com.yidianling.consultant.adapter.ExpertSearchAdapter import com.yidianling.consultant.adapter.ExpertSearchAdapter
import com.yidianling.consultant.bean.ConsultantRecentCity import com.yidianling.consultant.bean.ConsultantRecentCity
import com.yidianling.consultant.constants.ConsultBIConstants import com.yidianling.consultant.constants.ConsultBIConstants
...@@ -98,7 +99,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -98,7 +99,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
private var locationList: ArrayList<SubItem>? = arrayListOf() private var locationList: ArrayList<SubItem>? = arrayListOf()
private var locationHistoryList: ArrayList<RegionItem>? = arrayListOf() private var locationHistoryList: ArrayList<RegionItem>? = arrayListOf()
private var eightcategoryPopup: EightCategoryPopupWindow? = null private var eightcategoryPopup: EightCategoryPopupWindow? = null
private var mConsultantTopAdapter: ConsultantTopAdapter? = null
override fun layoutResId(): Int { override fun layoutResId(): Int {
return R.layout.consultant_activity_expert_search_list return R.layout.consultant_activity_expert_search_list
} }
...@@ -113,17 +114,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -113,17 +114,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
title_layout.setPadding(DisplayUtils.dp2px(context, 15), 0, 0, 0) title_layout.setPadding(DisplayUtils.dp2px(context, 15), 0, 0, 0)
initViews() initViews()
initData() initData()
//资源页顶部资源位改版。
val ffrom = PlatformDataManager.getRam().getChannelName() rl_hot_fix_for_huawei.visibility = View.GONE
if (!TextUtils.isEmpty(ffrom) && consultant_list.visibility = View.VISIBLE
(ffrom.endsWith(ChannelConfig.Xinliceshiyiyu.name))
) {
//抑郁焦虑测试
rl_hot_fix_for_huawei.visibility = View.GONE
} else {
rl_hot_fix_for_huawei.visibility = View.VISIBLE
}
} }
override fun initDataAndEventLazy() { override fun initDataAndEventLazy() {
...@@ -155,6 +148,16 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -155,6 +148,16 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
} }
override fun consultTopBannerBean(consultantTopData: MutableList<ConsultantTopBannerBean>) {
//咨询页顶部滑动banner。
consultant_list.visibility = View.VISIBLE
val layoutManager = LinearLayoutManager(requireContext())
layoutManager.orientation = LinearLayoutManager.HORIZONTAL
consultant_list.layoutManager = layoutManager
mConsultantTopAdapter = ConsultantTopAdapter(requireContext(), consultantTopData)
consultant_list.adapter = mConsultantTopAdapter
}
override fun showImage( override fun showImage(
url: String?, url: String?,
imgView: ImageView, imgView: ImageView,
...@@ -386,6 +389,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -386,6 +389,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
getPresenter().fetchListHead() getPresenter().fetchListHead()
getPresenter().fetchFunctionWord(2) getPresenter().fetchFunctionWord(2)
getPresenter().fetchConsultTopBanner()
recommendListView.requestData("") recommendListView.requestData("")
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
...@@ -1015,14 +1019,14 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1015,14 +1019,14 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
tempFilter, this tempFilter, this
) )
} }
pricePopup!!.setOnDismissListener { pricePopup?.setOnDismissListener {
if (tempFilter.priceRanges != null) { if (tempFilter.priceRanges != null) {
updateFilterTextViewStatus(tvSort, FILTER_STATUS_FILTERED) updateFilterTextViewStatus(tvSort, FILTER_STATUS_FILTERED)
} else { } else {
updateFilterTextViewStatus(tvSort, FILTER_STATUS_NORMAL) updateFilterTextViewStatus(tvSort, FILTER_STATUS_NORMAL)
} }
} }
pricePopup!!.showAsDropDown(viewSep2) pricePopup?.showAsDropDown(viewSep2)
} }
//显示筛选弹窗 //显示筛选弹窗
...@@ -1600,6 +1604,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -1600,6 +1604,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
onScrollListener.resetState() onScrollListener.resetState()
getPresenter().mExtras = null getPresenter().mExtras = null
getPresenter().fetchListData(allFilter, getPresenter().mExtras, null) getPresenter().fetchListData(allFilter, getPresenter().mExtras, null)
getPresenter().fetchConsultTopBanner()
rvExperts.scrollToPosition(0) rvExperts.scrollToPosition(0)
} }
......
...@@ -64,6 +64,21 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -64,6 +64,21 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
fun fetchConsultTopBanner() {
SearchApi.getSearchApi()
.searchConsultTopicBanner()
.compose(RxLifecycleUtils.bindToLifecycle(mView))
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
mView.consultTopBannerBean(resp)
}, { t ->
HttpErrorUtils.handleError(BaseApp.getApp(), t)
})
}
@SuppressLint("CheckResult")
fun fetchListData(allFilter: AllFilter, extras: Extras?, mapFilter: Map<String, Any>?) { fun fetchListData(allFilter: AllFilter, extras: Extras?, mapFilter: Map<String, Any>?) {
//是否亲子教育字段 //是否亲子教育字段
// ConsultAssistantDialogUtils.REALATION_EDUCATION = allFilter.categories.size == 1 && allFilter.categories[0].cateId == "23" // ConsultAssistantDialogUtils.REALATION_EDUCATION = allFilter.categories.size == 1 && allFilter.categories[0].cateId == "23"
......
...@@ -28,13 +28,15 @@ interface IExpertSearchView : IView { ...@@ -28,13 +28,15 @@ interface IExpertSearchView : IView {
/** /**
* 加载图片 * 加载图片
*/ */
fun showImage(url : String?, imgView : ImageView) fun showImage(url: String?, imgView: ImageView)
/** /**
* 加载图片 * 加载图片
*/ */
fun showImage(url : String?, imgView : ImageView, ops : SimpleImageOpConfiger) fun showImage(url: String?, imgView: ImageView, ops: SimpleImageOpConfiger)
fun showPromptPayment(promptPaymentBean: PromptPaymentBean) fun showPromptPayment(promptPaymentBean: PromptPaymentBean)
fun consultTopBannerBean(consultantTopData: MutableList<ConsultantTopBannerBean>)
} }
\ No newline at end of file
package com.yidianling.consultant.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.consultant.R
import com.yidianling.consultant.model.bean.ConsultantTopBannerBean
import kotlinx.android.synthetic.main.consultant_top_banner_item.view.*
/**
* Created by zqk on 17-9-20.
*/
class ConsultantTopAdapter(
private val context: Context,
private val consultList: MutableList<ConsultantTopBannerBean>
) : RecyclerView.Adapter<ConsultantTopAdapter.ViewHolder>() {
override fun getItemCount(): Int = consultList.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val itemView =
LayoutInflater.from(context).inflate(R.layout.consultant_top_banner_item, parent, false)
return ViewHolder(itemView)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val layoutParams = ViewGroup.LayoutParams(
(context.getResources().getDisplayMetrics().widthPixels / 4.5).toInt(),
ViewGroup.LayoutParams.WRAP_CONTENT
)
holder.itemView.layoutParams = layoutParams
if (consultList[position].specialTopicSubhead?.isNotEmpty() == true) {
holder.consult_tag.visibility = View.VISIBLE
holder.consult_tag.text = consultList[position].specialTopicSubhead
if (consultList[position].specialTopicSubhead?.toCharArray()?.size!! <= 2) {
val params = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT
)
params.setMargins(46, 0, 0, 0)
holder.consult_tag.layoutParams = params
}
} else {
holder.consult_tag.visibility = View.GONE
}
GlideApp.with(context)
.load(consultList[position].topicImage)
.into(holder.consult_img)
holder.consult_title.text = consultList[position].specialTopicTitle
holder.itemView.setOnClickListener {
NewH5Activity.start(
context,
H5Params(consultList[position].specialTopicUrl.toString(), "")
)
}
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val consult_tag = itemView.consult_tag
val consult_img = itemView.consult_img
val consult_title = itemView.consult_title
}
}
\ No newline at end of file
...@@ -50,6 +50,11 @@ interface SearchApi { ...@@ -50,6 +50,11 @@ interface SearchApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA) @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun searchFunctionWord(@Body map: Map<String, @JvmSuppressWildcards Any>): Observable<BaseAPIResponse<MutableList<FunctionWordBean>>> fun searchFunctionWord(@Body map: Map<String, @JvmSuppressWildcards Any>): Observable<BaseAPIResponse<MutableList<FunctionWordBean>>>
//咨询页顶部滑动banner
@POST("doctor/v1/querySpecialTopic")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun searchConsultTopicBanner(): Observable<BaseAPIResponse<MutableList<ConsultantTopBannerBean>>>
//查询功能词、底纹词 //查询功能词、底纹词
//(1热门词,2底纹词,3跳转词) //(1热门词,2底纹词,3跳转词)
@POST("function/word/queryList") @POST("function/word/queryList")
......
package com.yidianling.consultant.model.bean
data class ConsultantTopBannerBean(
val specialTopicSubhead: String? = "",//右上角标签 有数据则展示
val specialTopicUrl: String? = "",
val topicImage: String? = "",
val specialTopicTitle: String? = ""
)
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingDefaultResource">
<corners
android:bottomRightRadius="@dimen/platform_dp_3"
android:topLeftRadius="@dimen/platform_dp_3"
android:topRightRadius="@dimen/platform_dp_3" />
<solid android:color="#ff7171" />
</shape>
\ No newline at end of file
...@@ -55,6 +55,14 @@ ...@@ -55,6 +55,14 @@
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</RelativeLayout> </RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/consultant_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="horizontal"
android:paddingBottom="@dimen/platform_dp_17"
android:visibility="visible" />
</com.google.android.material.appbar.CollapsingToolbarLayout> </com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/platform_dp_25"
android:background="@color/white">
<FrameLayout
android:id="@+id/fl_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/consult_img"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginTop="@dimen/platform_dp_10" />
<TextView
android:id="@+id/consult_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/platform_dp_12"
android:layout_marginBottom="@dimen/platform_dp_40"
android:background="@drawable/consultant_bg_top_tag"
android:gravity="center"
android:includeFontPadding="false"
android:maxLength="5"
android:minWidth="@dimen/platform_dp_25"
android:paddingStart="@dimen/platform_dp_4"
android:paddingTop="@dimen/platform_dp_2"
android:paddingEnd="@dimen/platform_dp_4"
android:paddingBottom="@dimen/platform_dp_2"
android:textColor="@color/white"
android:textSize="9sp"
tools:text="dd" />
</FrameLayout>
<TextView
android:id="@+id/consult_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_8"
android:includeFontPadding="false"
android:textColor="@color/platform_color_666666"
android:textSize="@dimen/platform_sp_12"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/fl_img"
tools:text="新人专区">
</TextView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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