Commit 18945a43 by 刘鹏

Merge branch 'feat/diamond_category_zl' into 'd/v4.4.07'

金刚位功能

See merge request app_android_lib/YDL-Component!300
parents baf849fe b6385b63
...@@ -64,15 +64,7 @@ android { ...@@ -64,15 +64,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
} }
signingConfigs {
release {
storeFile file("keystore.jks")
storePassword "123456"
keyAlias "ydl"
keyPassword "123456"
}
}
productFlavors { productFlavors {
ydl{} ydl{}
xlzx{} xlzx{}
......
...@@ -8,6 +8,7 @@ import com.ydl.ydlcommon.data.http.RxUtils ...@@ -8,6 +8,7 @@ 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.modular.ModularServiceManager 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.AnimUtils
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.RxAppTool import com.yidianling.common.tools.RxAppTool
...@@ -63,7 +64,7 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -63,7 +64,7 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
fun fetchListData(allFilter: AllFilter, extras: Extras?) { 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"
...@@ -75,8 +76,13 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -75,8 +76,13 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
filterMap["__keywords"] = allFilter.searchWord filterMap["__keywords"] = allFilter.searchWord
} }
val categoryList = ArrayList<Any>() val categoryList = ArrayList<Any>()
//首页金刚位传过来的搜索MAP结果集
if (mapFilter != null) {
filterMap.putAll(mapFilter)
}
map["filter"] = filterMap
// 八大类一级标签 // 八大类一级标签
if (allFilter.categoryId2List.size>0){ if (allFilter.categoryId2List.size > 0) {
val categoryMap2 = HashMap<String, Any>() val categoryMap2 = HashMap<String, Any>()
val categoryIdMap2 = HashMap<String, Any>() val categoryIdMap2 = HashMap<String, Any>()
categoryIdMap2["in"] = allFilter.categoryId2List.toSortedSet().toList() categoryIdMap2["in"] = allFilter.categoryId2List.toSortedSet().toList()
...@@ -84,7 +90,7 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -84,7 +90,7 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
categoryList.add(categoryMap2) categoryList.add(categoryMap2)
} }
// 八大类二级标签 // 八大类二级标签
if (allFilter.categoryId3List.size>0){ if (allFilter.categoryId3List.size > 0) {
val categoryMap3 = HashMap<String, Any>() val categoryMap3 = HashMap<String, Any>()
val categoryIdMap3 = HashMap<String, Any>() val categoryIdMap3 = HashMap<String, Any>()
categoryIdMap3["in"] = allFilter.categoryId3List.toSortedSet().toList() categoryIdMap3["in"] = allFilter.categoryId3List.toSortedSet().toList()
...@@ -197,13 +203,13 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -197,13 +203,13 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
} }
} }
} }
if (gender.size>0){ if (gender.size > 0) {
val genderMap = HashMap<String, Any>() val genderMap = HashMap<String, Any>()
genderMap["in"] = gender genderMap["in"] = gender
filterMap["gender"] = genderMap filterMap["gender"] = genderMap
} }
} }
map["filter"] = filterMap
// sorts // sorts
if (allFilter.reorder.key != null) { if (allFilter.reorder.key != null) {
......
...@@ -33,6 +33,7 @@ import com.yidianling.consultant.api.IConsultantService ...@@ -33,6 +33,7 @@ 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.constants.ConsultBIConstants.ConsultEvent.Companion.SEARCH_BANNERWORD_CLICK import com.yidianling.consultant.constants.ConsultBIConstants.ConsultEvent.Companion.SEARCH_BANNERWORD_CLICK
import com.yidianling.consultant.constants.ConsultBIConstants.ConsultEvent.Companion.YDL_USER_CONSULT_SEARCH_CONFIRM_CLICK
import com.yidianling.consultant.contract.IHotSearchContract import com.yidianling.consultant.contract.IHotSearchContract
import com.yidianling.consultant.model.bean.FunctionWordBean import com.yidianling.consultant.model.bean.FunctionWordBean
import com.yidianling.consultant.modular.utils.ConsultAssistantEntryUtils import com.yidianling.consultant.modular.utils.ConsultAssistantEntryUtils
...@@ -110,6 +111,12 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon ...@@ -110,6 +111,12 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
} }
etSearch.setOnEditorActionListener { _, actionId, _ -> etSearch.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH) { if (actionId == EditorInfo.IME_ACTION_SEARCH) {
//埋点
ActionCountUtils.count(
YDL_USER_CONSULT_SEARCH_CONFIRM_CLICK,
etSearch.text.toString(),
etSearch.hint.toString()
)
// 搜索的关联词 // 搜索的关联词
var relatedWords = "" var relatedWords = ""
var isRecommendWords = false var isRecommendWords = false
......
...@@ -30,7 +30,6 @@ import com.yidianling.consultant.listener.OnExpertClickListener ...@@ -30,7 +30,6 @@ import com.yidianling.consultant.listener.OnExpertClickListener
import com.yidianling.consultant.model.bean.ExpertServiceItem 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_activity_hot_search.*
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_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.*
...@@ -38,7 +37,6 @@ import kotlinx.android.synthetic.main.consultant_expert_search_products_item.vie ...@@ -38,7 +37,6 @@ import kotlinx.android.synthetic.main.consultant_expert_search_products_item.vie
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
/** /**
......
...@@ -16,7 +16,8 @@ import kotlinx.android.synthetic.main.consultant_item_region.view.* ...@@ -16,7 +16,8 @@ import kotlinx.android.synthetic.main.consultant_item_region.view.*
* 省份列表适配器 * 省份列表适配器
* Created by zqk on 17-7-21. * Created by zqk on 17-7-21.
*/ */
class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList<RegionItem>, var selectedRegion: RegionItem class RegionRecyclerViewAdapter(
val context: Context, var regionList: ArrayList<RegionItem>, var selectedRegion: RegionItem
) : RecyclerView.Adapter<RegionRecyclerViewAdapter.ViewHolder>() { ) : RecyclerView.Adapter<RegionRecyclerViewAdapter.ViewHolder>() {
var onItemClickListener: MyBaseAdapter.OnItemClickListener<RegionItem>? = null var onItemClickListener: MyBaseAdapter.OnItemClickListener<RegionItem>? = null
...@@ -29,11 +30,14 @@ class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList< ...@@ -29,11 +30,14 @@ class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList<
holder.itemView.tvRegionName.setTypeface(Typeface.DEFAULT_BOLD) holder.itemView.tvRegionName.setTypeface(Typeface.DEFAULT_BOLD)
holder.itemView.tvRegionName.setTextColor(context.resources.getColor(R.color.platform_main_theme)) holder.itemView.tvRegionName.setTextColor(context.resources.getColor(R.color.platform_main_theme))
holder.itemView.view_select.visibility = View.VISIBLE holder.itemView.view_select.visibility = View.VISIBLE
holder.itemView.setBackgroundColor(context.resources.getColor(R.color.white))
} else { } else {
//未选中状态 //未选中状态
holder.itemView.tvRegionName.setTypeface(Typeface.DEFAULT) holder.itemView.tvRegionName.setTypeface(Typeface.DEFAULT)
holder.itemView.tvRegionName.setTextColor(context.resources.getColor(R.color.platform_default_text_color)) holder.itemView.tvRegionName.setTextColor(context.resources.getColor(R.color.platform_default_text_color))
holder.itemView.view_select.visibility = View.INVISIBLE holder.itemView.view_select.visibility = View.INVISIBLE
holder.itemView.setBackgroundColor(context.resources.getColor(R.color.platform_color_F7F7F7))
} }
} }
......
...@@ -10,7 +10,8 @@ import com.yidianling.consultant.model.bean.ChildrenBean ...@@ -10,7 +10,8 @@ import com.yidianling.consultant.model.bean.ChildrenBean
/** /**
* Created by Ykai on 2022/5/18. * Created by Ykai on 2022/5/18.
*/ */
class SortAdapter(data: List<ChildrenBean>) : BaseMultiItemQuickAdapter<ChildrenBean, BaseViewHolder>(data) { class SortAdapter(data: List<ChildrenBean>) :
BaseMultiItemQuickAdapter<ChildrenBean, BaseViewHolder>(data) {
var isVisible = false var isVisible = false
init { init {
...@@ -19,25 +20,37 @@ class SortAdapter(data: List<ChildrenBean>) : BaseMultiItemQuickAdapter<Children ...@@ -19,25 +20,37 @@ class SortAdapter(data: List<ChildrenBean>) : BaseMultiItemQuickAdapter<Children
} }
override fun convert(holder: BaseViewHolder, item: ChildrenBean) { override fun convert(holder: BaseViewHolder, item: ChildrenBean) {
when(holder.itemViewType){ when (holder.itemViewType) {
1 ->{ 1 -> {
holder.setGone(R.id.ll_sort_item,item.isVisible) holder.setGone(R.id.ll_sort_item, item.isVisible)
holder.setText(R.id.tv_sort_name, item.cate_name) holder.setText(R.id.tv_sort_name, item.cate_name)
holder.getView<TextView>(R.id.tv_sort_name).isSelected = item.isSelected holder.getView<TextView>(R.id.tv_sort_name).isSelected = item.isSelected
if (item.isSelected){ if (item.isSelected) {
holder.setTextColor(R.id.tv_sort_name,ContextCompat.getColor(mContext,R.color.platform_main_theme)) holder.setTextColor(
}else{ R.id.tv_sort_name,
holder.setTextColor(R.id.tv_sort_name,ContextCompat.getColor(mContext,R.color.platform_color_242424)) ContextCompat.getColor(mContext, R.color.platform_main_theme)
)
} else {
holder.setTextColor(
R.id.tv_sort_name,
ContextCompat.getColor(mContext, R.color.platform_color_242424)
)
} }
} }
2->{ 2 -> {
holder.setGone(R.id.ll_sort_item,item.isVisible) holder.setGone(R.id.ll_sort_item, item.isVisible)
holder.setText(R.id.tv_sort_name, item.cate_name) holder.setText(R.id.tv_sort_name, item.cate_name)
holder.getView<TextView>(R.id.tv_sort_name).isSelected = item.isSelected holder.getView<TextView>(R.id.tv_sort_name).isSelected = item.isSelected
if (item.isSelected){ if (item.isSelected) {
holder.setTextColor(R.id.tv_sort_name,ContextCompat.getColor(mContext,R.color.platform_main_theme)) holder.setTextColor(
}else{ R.id.tv_sort_name,
holder.setTextColor(R.id.tv_sort_name,ContextCompat.getColor(mContext,R.color.platform_color_242424)) ContextCompat.getColor(mContext, R.color.platform_main_theme)
)
} else {
holder.setTextColor(
R.id.tv_sort_name,
ContextCompat.getColor(mContext, R.color.platform_color_242424)
)
} }
} }
} }
...@@ -47,7 +60,7 @@ class SortAdapter(data: List<ChildrenBean>) : BaseMultiItemQuickAdapter<Children ...@@ -47,7 +60,7 @@ class SortAdapter(data: List<ChildrenBean>) : BaseMultiItemQuickAdapter<Children
/** /**
* 设置大于第12个之后的标签全部显示 * 设置大于第12个之后的标签全部显示
*/ */
fun setAllVisible(){ fun setAllVisible() {
mData.forEach { bean -> mData.forEach { bean ->
bean.isVisible = true bean.isVisible = true
} }
...@@ -58,9 +71,9 @@ class SortAdapter(data: List<ChildrenBean>) : BaseMultiItemQuickAdapter<Children ...@@ -58,9 +71,9 @@ class SortAdapter(data: List<ChildrenBean>) : BaseMultiItemQuickAdapter<Children
/** /**
* 设置大于第12个之后的标签全部隐藏 * 设置大于第12个之后的标签全部隐藏
*/ */
fun setGone(){ fun setGone() {
mData.forEachIndexed { index, bean -> mData.forEachIndexed { index, bean ->
if (index>12){ if (index > 12) {
bean.isVisible = false bean.isVisible = false
} }
} }
......
...@@ -16,31 +16,81 @@ import kotlinx.android.synthetic.main.consultant_item_consult_type.view.* ...@@ -16,31 +16,81 @@ import kotlinx.android.synthetic.main.consultant_item_consult_type.view.*
* 城市列表适配器 * 城市列表适配器
* Created by zqk on 17-7-21. * Created by zqk on 17-7-21.
*/ */
class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubItem>, var selectedSub: SubItem) : RecyclerView.Adapter<SubRecyclerViewAdapter.ViewHolder>() { class SubRecyclerViewAdapter(
val context: Context, val subList: ArrayList<SubItem>,
var selectedSub: SubItem, val locationCode: String
) : RecyclerView.Adapter<SubRecyclerViewAdapter.ViewHolder>() {
var onItemClickListener: MyBaseAdapter.OnItemClickListener<SubItem>? = null var onItemClickListener: MyBaseAdapter.OnItemClickListener<SubItem>? = null
private lateinit var mOnAuthClickLister: OnAuthClickLister
override fun onBindViewHolder(holder: ViewHolder, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val subItem = subList[position] val subItem = subList[position]
holder.itemView.tvConsultTypeName.text = subItem.value holder.itemView.tvConsultTypeName.text = subItem.value
if (selectedSub.code == subItem.code) { if (subItem.locationCode == locationCode) {
//选中状态 holder.itemView.reLocation.visibility = View.GONE
holder.itemView.tvConsultTypeName.setTypeface(Typeface.DEFAULT_BOLD) holder.itemView.location_img.visibility = View.VISIBLE
holder.itemView.tvConsultTypeName.setTextColor(ContextCompat.getColor(context,R.color.platform_main_theme)) holder.itemView.location_img.drawable.setTint(context.resources.getColor(R.color.platform_color_black_333333))
} else {
holder.itemView.isEnabled = true
} else if (subItem.locationCode == "NotAuth") {
//未选中状态 //未选中状态
holder.itemView.reLocation.visibility = View.VISIBLE
holder.itemView.reLocation.setOnClickListener {
mOnAuthClickLister.onAuthClick()
}
holder.itemView.location_img.visibility = View.VISIBLE
holder.itemView.tvConsultTypeName.setTypeface(Typeface.DEFAULT) holder.itemView.tvConsultTypeName.setTypeface(Typeface.DEFAULT)
holder.itemView.tvConsultTypeName.setTextColor(ContextCompat.getColor(context,R.color.platform_default_text_color)) holder.itemView.tvConsultTypeName.setTextColor(
ContextCompat.getColor(
context,
R.color.platform_default_text_color
)
)
holder.itemView.location_img.drawable.setTint(context.resources.getColor(R.color.platform_color_black_333333))
holder.itemView.isEnabled = false
} else {
holder.itemView.reLocation.visibility = View.GONE
holder.itemView.isEnabled = true
holder.itemView.location_img.visibility = View.GONE
if (selectedSub.code == subItem.code) {
//选中状态
holder.itemView.tvConsultTypeName.setTypeface(Typeface.DEFAULT_BOLD)
holder.itemView.tvConsultTypeName.setTextColor(
ContextCompat.getColor(
context,
R.color.platform_main_theme
)
)
} else {
//未选中状态
holder.itemView.tvConsultTypeName.setTypeface(Typeface.DEFAULT)
holder.itemView.tvConsultTypeName.setTextColor(
ContextCompat.getColor(
context,
R.color.platform_default_text_color
)
)
}
} }
} }
override fun getItemCount(): Int = subList.size override fun getItemCount(): Int = subList.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_consult_type, parent, false) val view = LayoutInflater.from(context)
.inflate(R.layout.consultant_item_consult_type, parent, false)
return ViewHolder(view) return ViewHolder(view)
} }
interface OnAuthClickLister {
fun onAuthClick()
}
fun setOnAuthClickLister(lister: OnAuthClickLister) {
mOnAuthClickLister = lister
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
init { init {
itemView.setOnClickListener { itemView.setOnClickListener {
......
package com.yidianling.consultant.bean
import android.os.Parcelable
import com.yidianling.consultant.model.bean.SubItem
import kotlinx.android.parcel.Parcelize
@Parcelize
data class ConsultantRecentCity(
var recentCity: MutableList<SubItem> = arrayListOf()
) : Parcelable
\ No newline at end of file
package com.yidianling.consultant.bean
data class ConsultantRegionBean(
val country_code: String?,
val country_name: String?,
val province_code: String?,
val province_name: String?,
val city_code: String?,
val city_name: String?
)
\ No newline at end of file
...@@ -27,6 +27,7 @@ class ConsultBIConstants { ...@@ -27,6 +27,7 @@ class ConsultBIConstants {
const val POSITION_YDL_USER_ASSOCIATE_WORD_CLICK="ydl_user_associate_word_click" // 联想词点击position const val POSITION_YDL_USER_ASSOCIATE_WORD_CLICK="ydl_user_associate_word_click" // 联想词点击position
// 咨询师列表页 banner 点击事件 // 咨询师列表页 banner 点击事件
const val POSITION_CONSULT_COUNSELOR_LIST_BANNER_CLICK = "consult_counselor_list_banner_click" const val POSITION_CONSULT_COUNSELOR_LIST_BANNER_CLICK = "consult_counselor_list_banner_click"
} }
//====================APP咨询列表页(app_consult_list_page)==================== //====================APP咨询列表页(app_consult_list_page)====================
...@@ -57,7 +58,8 @@ class ConsultBIConstants { ...@@ -57,7 +58,8 @@ class ConsultBIConstants {
APP_CONSULT_LIST_PAGE + "ydl_user_consult_search_click"//咨询师页搜索框点击事件 APP_CONSULT_LIST_PAGE + "ydl_user_consult_search_click"//咨询师页搜索框点击事件
const val YDL_USER_CONSULT_TYPE_CLICK: String = const val YDL_USER_CONSULT_TYPE_CLICK: String =
APP_CONSULT_LIST_PAGE + "ydl_user_consult_type_click"//咨询师顶部ICON 厌学专题、限时特惠、精神心理 APP_CONSULT_LIST_PAGE + "ydl_user_consult_type_click"//咨询师顶部ICON 厌学专题、限时特惠、精神心理
const val YDL_USER_CONSULT_SEARCH_CONFIRM_CLICK: String =
APP_CONSULT_LIST_PAGE + "YDL_USER_CONSULT_SEARCH_CONFIRM_CLICK"//搜索词、底纹词点击埋点
const val POSITION_CONSULT_COUNSELOR_CARD_CLICK = const val POSITION_CONSULT_COUNSELOR_CARD_CLICK =
"consult_counselor_card_click" // 咨询师列表点击position "consult_counselor_card_click" // 咨询师列表点击position
const val POSITION_CHOICE_FILTER_CLICK = const val POSITION_CHOICE_FILTER_CLICK =
...@@ -68,6 +70,15 @@ class ConsultBIConstants { ...@@ -68,6 +70,15 @@ class ConsultBIConstants {
"goodat_crowd_click" // 擅长人群埋点 "goodat_crowd_click" // 擅长人群埋点
const val SEARCH_BANNERWORD_CLICK = const val SEARCH_BANNERWORD_CLICK =
"$PART_ID_YDL_USER_MAIN_PAGE|search_bannerword_click" //历史搜索、热门搜索、本周热门专家搜索 "$PART_ID_YDL_USER_MAIN_PAGE|search_bannerword_click" //历史搜索、热门搜索、本周热门专家搜索
const val CONSULT_FILTER_CITY_PAGE = "consult_filter_city_page"
const val POPUP_ICON_CLICK = "$CONSULT_FILTER_CITY_PAGE|popup_icon_click"
const val AUTHORIZATION_ICON_CLICK =
"$CONSULT_FILTER_CITY_PAGE|authorization_icon_click"
const val CITY_NAME_CLICK = "$CONSULT_FILTER_CITY_PAGE|city_name_click"
const val CONSULT_FILTER_PRICE_PAGE = "consult_filter_price_page"
const val PRICE_CHOICE_CLICK = "$CONSULT_FILTER_PRICE_PAGE|price_choice_click"
const val PRICE_SLIDE_CLICK = "$CONSULT_FILTER_PRICE_PAGE|price_slide_click"
const val BOTTOM_ICON_CLICK = "$CONSULT_FILTER_PRICE_PAGE|bottom_icon_click"
} }
} }
class ConsultSearchListEvent { class ConsultSearchListEvent {
...@@ -94,4 +105,12 @@ class ConsultBIConstants { ...@@ -94,4 +105,12 @@ class ConsultBIConstants {
YDL_USER_MAIN_PAGE + "private_chat_click" // 点击私聊按钮 YDL_USER_MAIN_PAGE + "private_chat_click" // 点击私聊按钮
} }
} }
class ConsultantLocationAuth {
companion object {
const val WHETHER_LOCATION_AUTH = "whether_location_auth"
const val REFUSE_ALREADY = "refuse_already"
const val RECENT_CITY = "recent_city"
}
}
} }
\ No newline at end of file
package com.yidianling.consultant.listener
import com.yidianling.consultant.model.bean.PriceRangesItem
/**
* Created by zqk on 17-9-20.
*/
interface OnPriceItemSelectedListener {
fun onPriceItemSelected(priceRangesItem: PriceRangesItem)
}
\ No newline at end of file
...@@ -106,12 +106,17 @@ interface SearchApi { ...@@ -106,12 +106,17 @@ interface SearchApi {
* 100 有配置接口 * 100 有配置接口
* */ * */
@GET("consult/assistant/chat-route-config") @GET("consult/assistant/chat-route-config")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA,"Content-Type:application/json") @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
fun getChatRouteConfig( fun getChatRouteConfig(
@Query("location") location: Int, @Query("location") location: Int,
@Query("naviType") naviType: String = "1" @Query("naviType") naviType: String = "1"
): Observable<BaseAPIResponse<Long>> ): Observable<BaseAPIResponse<Long>>
//根据IP地址获取城市
@GET("region/ip-region")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
fun getCityByIp(): Observable<BaseAPIResponse<ConsultantRegionBean>>
//搜索条件 //搜索条件
@GET("consult/user/order/promptPayment") @GET("consult/user/order/promptPayment")
......
...@@ -8,45 +8,47 @@ import android.widget.TextView ...@@ -8,45 +8,47 @@ import android.widget.TextView
* Created by zqk on 17-9-20. * Created by zqk on 17-9-20.
*/ */
data class AllFilter( data class AllFilter(
var searchWord: String? = null, var searchWord: String? = null,
val categories: ArrayList<CateItem> = ArrayList(), //主题 val categories: ArrayList<CateItem> = ArrayList(), //主题
var reorder: ReorderItem = ReorderItem(), //排序 var reorder: ReorderItem = ReorderItem(), //排序
var region: RegionItem = RegionItem(), //省 var region: RegionItem = RegionItem(), //省
var sub: SubItem = SubItem(), //市 var sub: SubItem = SubItem(), //市
var showType: ShowTypeItem = ShowTypeItem(), //显示方式 var showType: ShowTypeItem = ShowTypeItem(), //显示方式
val enquiries: ArrayList<EnquiryItem> = ArrayList(), //咨询方式 val enquiries: ArrayList<EnquiryItem> = ArrayList(), //咨询方式
var priceRanges: PriceRangesItem ?= null, //服务均价 var priceRanges: PriceRangesItem? = null, //服务均价
var priceRangesView: TextView ?= null, //服务均价 var priceRangesView: TextView? = null, //服务均价
val ages: ArrayList<AgeItem> = ArrayList(), //年龄 var sortRangesView: TextView? = null, //排序均价
val doctorEdu: ArrayList<DoctorEduItem> = ArrayList(), //学历 val ages: ArrayList<AgeItem> = ArrayList(), //年龄
val others: ArrayList<OtherItem> = ArrayList(),//其他筛选 val sorStyle: ArrayList<ReorderItem> = ArrayList(), //排序方式
val doctorEdu: ArrayList<DoctorEduItem> = ArrayList(), //学历
val title:ArrayList<ReorderItem> = ArrayList(), //资质 val others: ArrayList<OtherItem> = ArrayList(),//其他筛选
val specialityCrowd:ArrayList<SpecialityCrowdBean> = ArrayList(), // 擅长人群
val title: ArrayList<ReorderItem> = ArrayList(), //资质
// 八大类标签集合 val specialityCrowd: ArrayList<SpecialityCrowdBean> = ArrayList(), // 擅长人群
val childList:ArrayList<ChildrenBean> = ArrayList(), // 亲子教育
val stressList:ArrayList<ChildrenBean> = ArrayList(), // 情绪压力 // 八大类标签集合
val loveEmotionList:ArrayList<ChildrenBean> = ArrayList(), // 恋爱情感 val childList: ArrayList<ChildrenBean> = ArrayList(), // 亲子教育
val marriedFamilyList:ArrayList<ChildrenBean> = ArrayList(), // 婚姻家庭 val stressList: ArrayList<ChildrenBean> = ArrayList(), // 情绪压力
val personalGrowthList:ArrayList<ChildrenBean> = ArrayList(), // 个人成长 val loveEmotionList: ArrayList<ChildrenBean> = ArrayList(), // 恋爱情感
val interpersonalRelationshipList:ArrayList<ChildrenBean> = ArrayList(), // 人际关系 val marriedFamilyList:ArrayList<ChildrenBean> = ArrayList(), // 婚姻家庭
val careerDevelopmentList:ArrayList<ChildrenBean> = ArrayList(), // 职场发展 val personalGrowthList:ArrayList<ChildrenBean> = ArrayList(), // 个人成长
val mentalHealthList:ArrayList<ChildrenBean> = ArrayList(), // 心理健康 val interpersonalRelationshipList:ArrayList<ChildrenBean> = ArrayList(), // 人际关系
val careerDevelopmentList:ArrayList<ChildrenBean> = ArrayList(), // 职场发展
val mentalHealthList:ArrayList<ChildrenBean> = ArrayList(), // 心理健康
// 八大类已选中标签id集合 // 八大类已选中标签id集合
val categoryId2List:ArrayList<String> = ArrayList(), // 一级类目id集合 val categoryId2List:ArrayList<String> = ArrayList(), // 一级类目id集合
val categoryId3List:ArrayList<String> = ArrayList(), // 二级类目id集合 val categoryId3List:ArrayList<String> = ArrayList(), // 二级类目id集合
// 八大类选中下标集合,重置的时候可以减少循坏,提升性能 // 八大类选中下标集合,重置的时候可以减少循坏,提升性能
val chooseChildIndexList:ArrayList<Int> = ArrayList(), val chooseChildIndexList:ArrayList<Int> = ArrayList(),
val chooseStressIndexList:ArrayList<Int> = ArrayList(), val chooseStressIndexList:ArrayList<Int> = ArrayList(),
val chooseLoveEmotionIndexList:ArrayList<Int> = ArrayList(), val chooseLoveEmotionIndexList:ArrayList<Int> = ArrayList(),
val chooseMarriedFamilyIndexList:ArrayList<Int> = ArrayList(), val chooseMarriedFamilyIndexList:ArrayList<Int> = ArrayList(),
val choosePersonalGrowthIndexList:ArrayList<Int> = ArrayList(), val choosePersonalGrowthIndexList:ArrayList<Int> = ArrayList(),
val chooseInterpersonalRelationshipIndexList:ArrayList<Int> = ArrayList(), val chooseInterpersonalRelationshipIndexList:ArrayList<Int> = ArrayList(),
val chooseCareerDevelopmentIndexList:ArrayList<Int> = ArrayList(), val chooseCareerDevelopmentIndexList:ArrayList<Int> = ArrayList(),
val chooseMentalHealthIndexList:ArrayList<Int> = ArrayList() val chooseMentalHealthIndexList:ArrayList<Int> = ArrayList()
) )
\ No newline at end of file
package com.yidianling.consultant.model.bean package com.yidianling.consultant.model.bean
import android.os.Parcelable
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
@Parcelize
data class SubItem( data class SubItem(
@field:SerializedName("value") @field:SerializedName("value")
var value: String? = null, var value: String? = null,
@field:SerializedName("key") @field:SerializedName("key")
var key: String? = null, var key: String? = null,
@field:SerializedName("code") @field:SerializedName("code")
var code: String?=null var code: String? = null,
) var locationCode: String? = ""
\ No newline at end of file ) : Parcelable
\ No newline at end of file
package com.yidianling.consultant.ui.view package com.yidianling.consultant.ui.view
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.graphics.Region
import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.BitmapDrawable
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSnapHelper
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.PopupWindow import android.widget.PopupWindow
import com.tencent.mmkv.MMKV
import com.ydl.ydlcommon.adapter.MyBaseAdapter import com.ydl.ydlcommon.adapter.MyBaseAdapter
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.R import com.yidianling.consultant.R
import com.yidianling.consultant.adapter.RegionRecyclerViewAdapter import com.yidianling.consultant.adapter.RegionRecyclerViewAdapter
import com.yidianling.consultant.adapter.SubRecyclerViewAdapter import com.yidianling.consultant.adapter.SubRecyclerViewAdapter
import com.yidianling.consultant.bean.ConsultantRecentCity
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.constants.ConsultBIConstants.ConsultEvent.Companion.CITY_NAME_CLICK
import com.yidianling.consultant.constants.ConsultBIConstants.ConsultantLocationAuth.Companion.RECENT_CITY
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.model.bean.RegionItem import com.yidianling.consultant.model.bean.RegionItem
import com.yidianling.consultant.model.bean.SubItem import com.yidianling.consultant.model.bean.SubItem
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.consultant_ui_region_popup_window.view.* import kotlinx.android.synthetic.main.consultant_ui_region_popup_window.view.*
/** /**
* 地区选择弹窗 * 地区选择弹窗
*/ */
class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>, private var selectedRegion: RegionItem, private var selectedSub: SubItem) class AreaPopupWindow(
: PopupWindow(null, ViewGroup.LayoutParams.MATCH_PARENT, RxImageTool.dp2px(369f)) { val context: Context,
regionList: ArrayList<RegionItem>,
private var selectedRegion: RegionItem,
private var selectedSub: SubItem,
private val isAgree: Boolean
) : PopupWindow(null, ViewGroup.LayoutParams.MATCH_PARENT, RxImageTool.dp2px(369f)) {
private val subList = ArrayList<SubItem>() private val subList = ArrayList<SubItem>()
private val regionAdapter = RegionRecyclerViewAdapter(context, regionList, selectedRegion) private val regionAdapter = RegionRecyclerViewAdapter(context, regionList, selectedRegion)
private var subAdapter:SubRecyclerViewAdapter private var subAdapter: SubRecyclerViewAdapter
private var recentCityBean: ConsultantRecentCity? = ConsultantRecentCity(arrayListOf())
var onRegionSelectedListener: OnRegionSelectedListener? = null var onRegionSelectedListener: OnRegionSelectedListener? = null
private var subLocationItem: SubItem? = SubItem()
private val locationCode = "-1"
private val recentCityCode = "0"
private var locationRegionItem: RegionItem? = null
private var locationList: ArrayList<SubItem>? = arrayListOf()
private var locationHistoryList = regionList
init { init {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_ui_region_popup_window, null) val view =
LayoutInflater.from(context).inflate(R.layout.consultant_ui_region_popup_window, null)
this.contentView = view this.contentView = view
this.isFocusable = true this.isFocusable = true
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
this.setBackgroundDrawable(BitmapDrawable()) this.setBackgroundDrawable(BitmapDrawable())
this.isOutsideTouchable = true this.isOutsideTouchable = true
this.height = ((RxDeviceTool.getScreenHeight(context) - RxImageTool.dp2px(90f)) * 0.618).toInt() //设置高度为屏幕的80% this.height =
((RxDeviceTool.getScreenHeight(context) - RxImageTool.dp2px(90f)) * 0.618).toInt() //设置高度为屏幕的80%
if (selectedRegion.sub.isNotEmpty()){ regionAdapter.regionList = regionList
if (selectedRegion.sub.isNotEmpty()) {
subList.addAll(selectedRegion.sub) subList.addAll(selectedRegion.sub)
}else{ } else {
subList.addAll(regionList[0].sub) subList.addAll(regionList[0].sub)
} }
subAdapter = SubRecyclerViewAdapter(context, subList, selectedSub) subAdapter = SubRecyclerViewAdapter(context, subList, selectedSub, locationCode)
subAdapter.setOnAuthClickLister(object : SubRecyclerViewAdapter.OnAuthClickLister {
override fun onAuthClick() {
val dialog = CommonDialog(context)
.setTitle("温馨提示")
.setMessage("建议您授权定位权限,就能轻松获取周边优秀咨询师和其他服务")
.setLeftOnclick("暂不") { v1 ->
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.AUTHORIZATION_ICON_CLICK,
"暂不"
)
}.setRightClick("授权") { v12 ->
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.AUTHORIZATION_ICON_CLICK,
"授权"
)
MMKV.defaultMMKV().encode(
ConsultBIConstants.ConsultantLocationAuth.WHETHER_LOCATION_AUTH,
true
)
getRegionByIp(true, true)
}
dialog.show()
}
})
view.rvRegion.layoutManager = view.rvRegion.layoutManager =
LinearLayoutManager( LinearLayoutManager(
context, context,
...@@ -60,8 +112,8 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>, p ...@@ -60,8 +112,8 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>, p
} }
view.rvRegion.adapter = regionAdapter view.rvRegion.adapter = regionAdapter
val i = regionList val i = regionList
.takeWhile { it.key != selectedRegion.key } .takeWhile { it.key != selectedRegion.key }
.count() .count()
view.rvRegion.scrollToPosition(i) view.rvRegion.scrollToPosition(i)
...@@ -72,13 +124,70 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>, p ...@@ -72,13 +124,70 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>, p
false false
) )
subAdapter.onItemClickListener = MyBaseAdapter.OnItemClickListener { _, _, data -> subAdapter.onItemClickListener = MyBaseAdapter.OnItemClickListener { _, _, data ->
saveCitySearchRecord(data)
selectedSub = data selectedSub = data
ActionCountUtils.count(CITY_NAME_CLICK, data.value.toString())
onRegionSelectedListener?.onRegionSelected(selectedRegion, selectedSub) onRegionSelectedListener?.onRegionSelected(selectedRegion, selectedSub)
} }
view.rvSub.adapter = subAdapter view.rvSub.adapter = subAdapter
view.rvSub.scrollToPosition(subList.indexOf(selectedSub) + 1) view.rvSub.scrollToPosition(subList.indexOf(selectedSub) + 1)
} }
//倒序保留最近五次的搜索历史记录并去重
private fun saveCitySearchRecord(data: SubItem) {
if (data.value == "不限") return
recentCityBean?.let {
if (it.recentCity.size < 5) {
it.recentCity.add(0, data)
it.recentCity = it.recentCity.toMutableSet().toMutableList()
MMKV.defaultMMKV().encode(RECENT_CITY, recentCityBean)
} else {
it.recentCity.removeAt(it.recentCity.size - 1)
it.recentCity.add(0, data)
it.recentCity = it.recentCity.toMutableSet().toMutableList()
MMKV.defaultMMKV().encode(RECENT_CITY, recentCityBean)
}
}
}
@SuppressLint("CheckResult")
fun getRegionByIp(agreeLocation: Boolean, refreshAdapter: Boolean) {
if (agreeLocation) {
SearchApi.getSearchApi().getCityByIp()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it.code == "200") {
subLocationItem?.code = it.data.city_code
subLocationItem?.key = it.data.city_code
subLocationItem?.value = it.data.city_name
subLocationItem?.locationCode = locationCode
locationList?.clear()
subLocationItem?.let { locationList?.add(it) }
locationHistoryList.get(0).code = it.data.province_code
locationHistoryList.get(0).key = it.data.province_code
locationHistoryList.get(0).value = "定位"
locationList?.let { locationHistoryList.get(0).sub = it }
subList.clear()
locationList?.let { it1 -> subList.addAll(it1) }
subAdapter.notifyDataSetChanged()
regionAdapter.notifyDataSetChanged()
} else {
ToastUtil.toastShort(it.msg)
}
}, {})
} else {
subLocationItem?.code = null
subLocationItem?.key = null
subLocationItem?.value = "开启授权,获得定位城市"
subLocationItem?.locationCode = "NotAuth"
subAdapter.notifyDataSetChanged()
regionAdapter.notifyDataSetChanged()
}
}
interface OnRegionSelectedListener { interface OnRegionSelectedListener {
fun onRegionSelected(region: RegionItem, sub: SubItem) fun onRegionSelected(region: RegionItem, sub: SubItem)
} }
......
package com.yidianling.consultant.ui.view.rangeseekbar;
/**
* ================================================
* 作 者:JayGoo
* 版 本:
* 创建日期:2018/5/8
* 描 述:
* ================================================
*/
public interface OnRangeChangedListener {
void onRangeChanged(RangeSeekBar view, float leftValue, float rightValue, boolean isFromUser);
void onStartTrackingTouch(RangeSeekBar view, boolean isLeft);
void onStopTrackingTouch(RangeSeekBar view, boolean isLeft);
}
package com.yidianling.consultant.ui.view.rangeseekbar;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.View;
/**
* ================================================
* 作 者:JayGoo
* 版 本:
* 创建日期:2018/5/8
* 描 述:
* ================================================
*/
public class SavedState extends View.BaseSavedState {
public static final Creator<SavedState> CREATOR = new Creator<SavedState>() {
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
public float minValue;
public float maxValue;
public float rangeInterval;
public int tickNumber;
public float currSelectedMin;
public float currSelectedMax;
public SavedState(Parcelable superState) {
super(superState);
}
private SavedState(Parcel in) {
super(in);
minValue = in.readFloat();
maxValue = in.readFloat();
rangeInterval = in.readFloat();
tickNumber = in.readInt();
currSelectedMin = in.readFloat();
currSelectedMax = in.readFloat();
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeFloat(minValue);
out.writeFloat(maxValue);
out.writeFloat(rangeInterval);
out.writeInt(tickNumber);
out.writeFloat(currSelectedMin);
out.writeFloat(currSelectedMax);
}
}
package com.yidianling.consultant.ui.view.rangeseekbar;
/**
* ================================================
* 作 者:JayGoo
* 版 本:
* 创建日期:2018/5/9
* 描 述: it works for draw indicator text
* ================================================
*/
public class SeekBarState {
public String indicatorText;
public float value; //now progress value
public boolean isMin;
public boolean isMax;
@Override
public String toString() {
return "indicatorText: " + indicatorText + " ,isMin: " + isMin + " ,isMax: " + isMax;
}
}
package com.yidianling.consultant.ui.view.rangeseekbar;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.NinePatch;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.Log;
import androidx.annotation.ColorRes;
import androidx.core.content.ContextCompat;
/**
* ================================================
* 作 者:JayGoo
* 版 本:
* 创建日期:2018/5/8
* 描 述:
* ================================================
*/
public class Utils {
private static final String TAG = "RangeSeekBar";
public static void print(String log) {
Log.d(TAG, log);
}
public static void print(Object... logs) {
StringBuilder stringBuilder = new StringBuilder();
for (Object log : logs) {
stringBuilder.append(log);
}
Log.d(TAG, stringBuilder.toString());
}
public static Bitmap drawableToBitmap(Context context, int width, int height, int drawableId) {
if (context == null || width <= 0 || height <= 0 || drawableId == 0) return null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return Utils.drawableToBitmap(width, height, context.getResources().getDrawable(drawableId, null));
} else {
return Utils.drawableToBitmap(width, height, context.getResources().getDrawable(drawableId));
}
}
/**
* make a drawable to a bitmap
*
* @param drawable drawable you want convert
* @return converted bitmap
*/
public static Bitmap drawableToBitmap(int width, int height, Drawable drawable) {
Bitmap bitmap = null;
try {
if (drawable instanceof BitmapDrawable) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
bitmap = bitmapDrawable.getBitmap();
if (bitmap != null && bitmap.getHeight() > 0) {
Matrix matrix = new Matrix();
float scaleWidth = width * 1.0f / bitmap.getWidth();
float scaleHeight = height * 1.0f / bitmap.getHeight();
matrix.postScale(scaleWidth, scaleHeight);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
return bitmap;
}
}
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
} catch (Exception e) {
e.printStackTrace();
}
return bitmap;
}
/**
* draw 9Path
*
* @param canvas Canvas
* @param bmp 9path bitmap
* @param rect 9path rect
*/
public static void drawNinePath(Canvas canvas, Bitmap bmp, Rect rect) {
NinePatch.isNinePatchChunk(bmp.getNinePatchChunk());
NinePatch patch = new NinePatch(bmp, bmp.getNinePatchChunk(), null);
patch.draw(canvas, rect);
}
public static void drawBitmap(Canvas canvas, Paint paint, Bitmap bmp, Rect rect) {
try {
if (NinePatch.isNinePatchChunk(bmp.getNinePatchChunk())) {
drawNinePath(canvas, bmp, rect);
return;
}
} catch (Exception e) {
}
canvas.drawBitmap(bmp, rect.left, rect.top, paint);
}
public static int dp2px(Context context, float dpValue) {
if (context == null || compareFloat(0f, dpValue) == 0) return 0;
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
* Compare the size of two floating point numbers
*
* @param a
* @param b
* @return 1 is a > b
* -1 is a < b
* 0 is a == b
*/
public static int compareFloat(float a, float b) {
int ta = Math.round(a * 1000000);
int tb = Math.round(b * 1000000);
if (ta > tb) {
return 1;
} else if (ta < tb) {
return -1;
} else {
return 0;
}
}
/**
* Compare the size of two floating point numbers with accuracy
*
* @param a
* @param b
* @return 1 is a > b
* -1 is a < b
* 0 is a == b
*/
public static int compareFloat(float a, float b, int degree) {
if (Math.abs(a - b) < Math.pow(0.1, degree)) {
return 0;
} else {
if (a < b) {
return -1;
} else {
return 1;
}
}
}
public static float parseFloat(String s) {
try {
return Float.parseFloat(s);
} catch (NumberFormatException e) {
return 0f;
}
}
public static Rect measureText(String text, float textSize) {
Paint paint = new Paint();
Rect textRect = new Rect();
paint.setTextSize(textSize);
paint.getTextBounds(text, 0, text.length(), textRect);
paint.reset();
return textRect;
}
public static boolean verifyBitmap(Bitmap bitmap) {
if (bitmap == null || bitmap.isRecycled() || bitmap.getWidth() <= 0 || bitmap.getHeight() <= 0) {
return false;
}
return true;
}
public static int getColor(Context context, @ColorRes int colorId) {
if (context != null) {
return ContextCompat.getColor(context.getApplicationContext(), colorId);
}
return Color.WHITE;
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/platform_color_F7F7F7" />
<corners android:radius="4dp" />
</shape>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#1DA1F2"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_4" />
<solid android:color="@color/platform_main_theme_bright" />
<stroke
android:width="0.5dp"
android:color="@color/platform_main_theme" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/platform_gray7" />
<stroke
android:width="1dp"
android:color="@color/platform_gray7" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@android:color/white" />
<stroke
android:width="2dp"
android:color="@color/platform_main_theme" />
</shape>
<?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="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -2,13 +2,22 @@ ...@@ -2,13 +2,22 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground" android:background="@color/white"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingTop="@dimen/platform_dp_15"
android:paddingBottom="@dimen/platform_dp_15"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp"> android:paddingRight="16dp">
<ImageView
android:id="@+id/location_img"
android:layout_width="@dimen/platform_dp_15"
android:layout_height="@dimen/platform_dp_15"
android:src="@drawable/consultant_baseline_location_on_24"
android:visibility="gone" />
<TextView <TextView
android:id="@+id/tvConsultTypeName" android:id="@+id/tvConsultTypeName"
android:layout_width="0dp" android:layout_width="0dp"
...@@ -16,14 +25,24 @@ ...@@ -16,14 +25,24 @@
android:layout_weight="1" android:layout_weight="1"
android:textColor="@color/platform_color_black_333333" android:textColor="@color/platform_color_black_333333"
android:textSize="14sp" android:textSize="14sp"
android:includeFontPadding="false"
tools:text="咨询方式" /> tools:text="咨询方式" />
<TextView
android:id="@+id/reLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="授权"
android:textColor="@color/platform_main_theme"
android:textSize="@dimen/platform_sp_14"
android:visibility="gone" />
<ImageView <ImageView
android:id="@+id/ivCheckCircle" android:id="@+id/ivCheckCircle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@null" android:contentDescription="@null"
android:src="@drawable/consultant_ic_check" android:src="@drawable/consultant_ic_check"
android:visibility="invisible"/> android:visibility="invisible" />
</LinearLayout> </LinearLayout>
...@@ -14,5 +14,5 @@ ...@@ -14,5 +14,5 @@
android:paddingTop="6dp" android:paddingTop="6dp"
android:paddingBottom="6dp" android:paddingBottom="6dp"
android:textColor="@color/consultant_color_search_filter_selector" android:textColor="@color/consultant_color_search_filter_selector"
android:textSize="13dp" android:textSize="14sp"
tools:text="按专家显示" /> tools:text="按专家显示" />
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:background="@color/platform_white"> android:background="@color/platform_color_F7F7F7">
<View <View
android:id="@+id/view_select" android:id="@+id/view_select"
android:layout_width="4dp" android:layout_width="4dp"
android:layout_height="21dp" android:layout_height="21dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="@color/platform_main_theme" android:background="@color/platform_main_theme"
android:visibility="invisible"/> android:visibility="invisible" />
<TextView <TextView
android:id="@+id/tvRegionName" android:id="@+id/tvRegionName"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content"
android:includeFontPadding="false"
android:paddingTop="@dimen/platform_dp_15"
android:paddingBottom="@dimen/platform_dp_15"
android:gravity="center" android:gravity="center"
android:text="地区" android:text="地区"
android:textColor="@color/platform_default_text_color" android:textColor="@color/platform_default_text_color"
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:width="0dp" android:width="0dp"
android:ellipsize="end"
android:singleLine="true"
android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp" android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp" android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:text="困扰" android:text="困扰"
...@@ -44,7 +46,7 @@ ...@@ -44,7 +46,7 @@
android:width="0dp" android:width="0dp"
android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp" android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp" android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:text="@string/platform_area" android:text="城市"
android:textColor="@color/platform_color_242424" /> android:textColor="@color/platform_color_242424" />
<com.ydl.ydlcommon.view.DrawableRightTextView <com.ydl.ydlcommon.view.DrawableRightTextView
...@@ -55,7 +57,7 @@ ...@@ -55,7 +57,7 @@
android:width="0dp" android:width="0dp"
android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp" android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp" android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:text="@string/platform_sort" android:text="价格"
android:textColor="@color/platform_color_242424" /> android:textColor="@color/platform_color_242424" />
<com.ydl.ydlcommon.view.DrawableRightTextView <com.ydl.ydlcommon.view.DrawableRightTextView
...@@ -64,8 +66,8 @@ ...@@ -64,8 +66,8 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:width="0dp" android:width="0dp"
android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp" android:drawableEnd="@drawable/filter_up_grey"
android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp" android:drawableRight="@drawable/filter_up_grey"
android:text="@string/platform_filter" android:text="@string/platform_filter"
android:textColor="@color/platform_color_242424" /> android:textColor="@color/platform_color_242424" />
</LinearLayout> </LinearLayout>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="@dimen/platform_dp_10"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
...@@ -44,13 +44,14 @@ ...@@ -44,13 +44,14 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_28" android:layout_marginTop="@dimen/platform_dp_28"
android:text="咨询方式" android:text="排序"
android:layout_marginStart="@dimen/platform_dp_4"
android:textColor="@color/platform_color_242424" android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" /> android:textStyle="bold" />
<FrameLayout <FrameLayout
android:id="@+id/flEnquiryType" android:id="@+id/flSortType"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" /> android:layout_marginTop="12dp" />
...@@ -59,22 +60,23 @@ ...@@ -59,22 +60,23 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_28" android:layout_marginTop="@dimen/platform_dp_28"
android:text="价格" android:text="咨询方式"
android:layout_marginStart="@dimen/platform_dp_4"
android:textColor="@color/platform_color_242424" android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" /> android:textStyle="bold" />
<FrameLayout <FrameLayout
android:id="@+id/flPriceRange" android:id="@+id/flEnquiryType"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" /> android:layout_marginTop="12dp" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_28" android:layout_marginTop="@dimen/platform_dp_28"
android:text="年龄选择" android:text="年龄选择"
android:layout_marginStart="@dimen/platform_dp_4"
android:textColor="@color/platform_color_242424" android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" /> android:textStyle="bold" />
...@@ -90,6 +92,7 @@ ...@@ -90,6 +92,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_28" android:layout_marginTop="@dimen/platform_dp_28"
android:text="资质选择" android:text="资质选择"
android:layout_marginStart="@dimen/platform_dp_4"
android:textColor="@color/platform_color_242424" android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" /> android:textStyle="bold" />
...@@ -109,6 +112,7 @@ ...@@ -109,6 +112,7 @@
android:text="擅长人群" android:text="擅长人群"
android:textColor="@color/platform_color_242424" android:textColor="@color/platform_color_242424"
android:textSize="16sp" android:textSize="16sp"
android:layout_marginStart="@dimen/platform_dp_4"
android:textStyle="bold" /> android:textStyle="bold" />
<cn.lankton.flowlayout.FlowLayout <cn.lankton.flowlayout.FlowLayout
...@@ -126,6 +130,7 @@ ...@@ -126,6 +130,7 @@
android:text="学历选择" android:text="学历选择"
android:textColor="@color/platform_color_242424" android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:layout_marginStart="@dimen/platform_dp_4"
android:textStyle="bold" /> android:textStyle="bold" />
<FrameLayout <FrameLayout
...@@ -169,6 +174,7 @@ ...@@ -169,6 +174,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_28" android:layout_marginTop="@dimen/platform_dp_28"
android:text="其他选择" android:text="其他选择"
android:layout_marginStart="@dimen/platform_dp_4"
android:textColor="@color/platform_color_242424" android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" /> android:textStyle="bold" />
...@@ -182,6 +188,7 @@ ...@@ -182,6 +188,7 @@
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
......
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:paddingTop="@dimen/platform_dp_15">
<FrameLayout
android:id="@+id/flPriceRangeView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="50dp"
android:paddingStart="@dimen/platform_dp_12"
android:paddingEnd="@dimen/platform_dp_12"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_start_end_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0-不限"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/platform_dp_30"
android:textColor="@color/platform_color_black_333333"
android:textSize="@dimen/platform_sp_14"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/flPriceRangeView" />
<com.yidianling.consultant.ui.view.rangeseekbar.RangeSeekBar
android:id="@+id/range_price_seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/platform_dp_12"
android:layout_marginEnd="@dimen/platform_dp_12"
android:layout_marginTop="@dimen/platform_dp_15"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_start_end_price"
app:rsb_gravity="bottom"
app:rsb_mode="range"
app:rsb_progress_color="@color/platform_main_theme"
app:rsb_step_auto_bonding="true"
app:rsb_step_color="@color/platform_gray7"
app:rsb_step_height="5dp"
app:rsb_step_width="0.5dp"
app:rsb_steps="6"
app:rsb_thumb_drawable="@drawable/thumb_yellow_stroke"
app:rsb_thumb_height="15dp"
app:rsb_thumb_width="15dp"
app:rsb_tick_mark_layout_gravity="bottom"
app:rsb_tick_mark_mode="other"
app:rsb_tick_mark_text_array="@array/wordsArray"
app:rsb_tick_mark_text_margin="20dp" />
<View
android:id="@+id/seperate_line"
android:layout_width="wrap_content"
android:layout_height="0.5dp"
android:layout_marginTop="@dimen/platform_dp_30"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/range_price_seekbar"></View>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_marginTop="@dimen/platform_dp_8"
android:background="@color/white"
android:orientation="horizontal"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
app:layout_constraintTop_toBottomOf="@id/seperate_line">
<TextView
android:id="@+id/price_reset"
android:layout_width="0dp"
android:layout_height="44dp"
android:layout_weight="1"
android:background="@drawable/consultant_stroke_ebebeb_r_8"
android:gravity="center"
android:text="@string/platform_reset"
android:textColor="@color/platform_color_242424"
android:textSize="16sp" />
<TextView
android:id="@+id/price_Confirm"
android:layout_width="0dp"
android:layout_height="44dp"
android:layout_marginStart="13dp"
android:layout_weight="1"
android:background="@drawable/consultant_solid_main_theme_color_r_8"
android:gravity="center"
android:text="@string/platform_confirm"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -8,16 +8,15 @@ ...@@ -8,16 +8,15 @@
android:id="@+id/rvRegion" android:id="@+id/rvRegion"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/platform_white" android:background="@color/platform_color_F7F7F7"
android:layout_weight="1" android:layout_weight="1"
android:paddingTop="10dp"
android:overScrollMode="never"/> android:overScrollMode="never"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvSub" android:id="@+id/rvSub"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/platform_color_F7F7F7" android:background="@color/white"
android:layout_weight="2" android:layout_weight="2"
android:paddingTop="10dp" android:paddingTop="10dp"
android:overScrollMode="never"/> android:overScrollMode="never"/>
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="wordsArray">
<item>0</item>
<item>100</item>
<item>200</item>
<item>300</item>
<item>400</item>
<item>500</item>
<item>不限</item>
</string-array>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="RangeSeekBar">
<!--RangeSeekBar common attrs-->
<!--The maximum-->
<attr name="rsb_max" format="float" />
<!--The minimum-->
<attr name="rsb_min" format="float" />
<!--RangeSeekBar mode, single is normal seekBar, range is RangeSeekBar-->
<attr name="rsb_mode" format="enum">
<enum name="single" value="1" />
<enum name="range" value="2" />
</attr>
<!--RangeSeekBar gravity-->
<attr name="rsb_gravity" format="enum">
<enum name="top" value="0" />
<enum name="bottom" value="1" />
<enum name="center" value="2" />
</attr>
<!--The min interval of the thumbs -->
<attr name="rsb_min_interval" format="float" />
<!-- 0 for the normal mode, greater than 1 to switch to scale mode-->
<attr name="rsb_tick_mark_number" format="integer" />
<!--Scale mode
Number according to the scale of the actual proportion of the distribution of the location (markTextArray must be a number)
Other bisects the current layout (markTextArray can be any character)
-->
<attr name="rsb_tick_mark_mode" format="enum">
<enum name="number" value="0" />
<enum name="other" value="1" />
</attr>
<!--The tick mark text gravity -->
<attr name="rsb_tick_mark_gravity" format="enum">
<enum name="left" value="0" />
<enum name="center" value="1" />
<enum name="right" value="2" />
</attr>
<!--The tick mark text layout gravity -->
<attr name="rsb_tick_mark_layout_gravity" format="enum">
<enum name="top" value="0" />
<enum name="bottom" value="1" />
</attr>
<!--The tick mark text array -->
<attr name="rsb_tick_mark_text_array" format="reference" />
<!--The tick mark text margin bottom to progress -->
<attr name="rsb_tick_mark_text_margin" format="dimension" />
<attr name="rsb_tick_mark_text_size" format="dimension" />
<attr name="rsb_tick_mark_text_color" format="color" />
<!--it just work in range && number mode now-->
<attr name="rsb_tick_mark_in_range_text_color" format="color" />
<attr name="rsb_progress_height" format="dimension" />
<attr name="rsb_progress_radius" format="dimension" />
<!--the color of progress bar when in progress-->
<attr name="rsb_progress_color" format="color" />
<!--the default color of the progress bar-->
<attr name="rsb_progress_default_color" format="color" />
<attr name="rsb_progress_drawable" format="reference" />
<attr name="rsb_progress_drawable_default" format="reference" />
<!--SeekBar attrs-->
<attr name="rsb_indicator_show_mode" format="enum">
<enum name="showWhenTouch" value="0" />
<enum name="alwaysHide" value="1" />
<enum name="alwaysShowAfterTouch" value="2" />
<enum name="alwaysShow" value="3" />
</attr>
<attr name="rsb_indicator_height" format="dimension">
<enum name="wrap_content" value="-1" />
</attr>
<attr name="rsb_indicator_width" format="dimension">
<enum name="wrap_content" value="-1" />
</attr>
<!--indicator margin bottom to progress bar-->
<attr name="rsb_indicator_margin" format="dimension" />
<attr name="rsb_indicator_text_size" format="dimension" />
<attr name="rsb_indicator_text_color" format="color" />
<!--indicator arrow size, it just work when you not use rsb_indicator_drawable -->
<attr name="rsb_indicator_arrow_size" format="dimension" />
<!-- must use 9 path !!!-->
<attr name="rsb_indicator_drawable" format="reference" />
<attr name="rsb_indicator_background_color" format="color" />
<attr name="rsb_indicator_padding_left" format="dimension" />
<attr name="rsb_indicator_padding_right" format="dimension" />
<attr name="rsb_indicator_padding_top" format="dimension" />
<attr name="rsb_indicator_padding_bottom" format="dimension" />
<attr name="rsb_indicator_radius" format="dimension" />
<attr name="rsb_thumb_drawable" format="reference" />
<!--the thumb inactivated is when you don't touch the thumb button-->
<attr name="rsb_thumb_inactivated_drawable" format="reference" />
<attr name="rsb_thumb_width" format="dimension" />
<attr name="rsb_thumb_height" format="dimension" />
<attr name="rsb_thumb_scale_ratio" format="float" />
<!--steps SeekBar-->
<attr name="rsb_steps" format="integer" />
<attr name="rsb_step_color" format="color" />
<attr name="rsb_step_width" format="dimension" />
<attr name="rsb_step_height" format="dimension" />
<attr name="rsb_step_radius" format="dimension" />
<attr name="rsb_step_auto_bonding" format="boolean" />
<attr name="rsb_step_drawable" format="reference" />
</declare-styleable>
<declare-styleable name="VerticalRangeSeekBar">
<!--the vertical RangeSeekBar draw orientation-->
<attr name="rsb_orientation" format="enum">
<enum name="left" value="1" />
<enum name="right" value="2" />
</attr>
<attr name="rsb_tick_mark_orientation" format="enum">
<enum name="vertical" value="1" />
<enum name="horizontal" value="2" />
</attr>
<attr name="rsb_indicator_text_orientation" format="enum">
<enum name="vertical" value="1" />
<enum name="horizontal" value="2" />
</attr>
</declare-styleable>
</resources>
...@@ -80,7 +80,9 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -80,7 +80,9 @@ open class HomeBaseImpl : IHomeBaseEvent {
?: "" ?: ""
) )
if (!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(mContext as Context,true)) { if (!ModularServiceManager.provide(IUserService::class.java)
.loginByOneKeyLogin(mContext as Context, true)
) {
//跳转登录 //跳转登录
return return
} }
...@@ -166,11 +168,18 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -166,11 +168,18 @@ open class HomeBaseImpl : IHomeBaseEvent {
} }
ActionCountUtils.count(HomeBIConstants.YDL_USER_TELEPHONE_CUSTOMER_SERVICE_CLICK) ActionCountUtils.count(HomeBIConstants.YDL_USER_TELEPHONE_CUSTOMER_SERVICE_CLICK)
val tel = val tel =
if (PlatformRamImpl.getInstance().getGlobalInfo() == null) "400-765-1010" else PlatformRamImpl.getInstance().getGlobalInfo()!!.info.tel if (PlatformRamImpl.getInstance()
.getGlobalInfo() == null
) "400-765-1010" else PlatformRamImpl.getInstance().getGlobalInfo()!!.info.tel
var con = "\n400-765-1010\n早8:30-凌晨2:00" var con = "\n400-765-1010\n早8:30-凌晨2:00"
if (PlatformRamImpl.getInstance().getGlobalInfo() != null && PlatformRamImpl.getInstance().getGlobalInfo()!!.info != null) { if (PlatformRamImpl.getInstance()
.getGlobalInfo() != null && PlatformRamImpl.getInstance()
.getGlobalInfo()!!.info != null
) {
con = con =
PlatformRamImpl.getInstance().getGlobalInfo()?.info?.tel + "\n" + PlatformRamImpl.getInstance().getGlobalInfo()?.info?.work_time PlatformRamImpl.getInstance()
.getGlobalInfo()?.info?.tel + "\n" + PlatformRamImpl.getInstance()
.getGlobalInfo()?.info?.work_time
} }
val dialog = CommonDialog(mContext) val dialog = CommonDialog(mContext)
...@@ -232,7 +241,7 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -232,7 +241,7 @@ open class HomeBaseImpl : IHomeBaseEvent {
} }
override fun categoryClick(data: HomeHeaderBean.AskCategoryDataBean) { override fun categoryClick(data: HomeHeaderBean.CategoryGoldListDataBean) {
// linkTo(data.url.toString()) // linkTo(data.url.toString())
if (Utils.isFastClick()) { if (Utils.isFastClick()) {
//防止连击 //防止连击
...@@ -240,18 +249,16 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -240,18 +249,16 @@ open class HomeBaseImpl : IHomeBaseEvent {
} }
ActionCountUtils.count( ActionCountUtils.count(
HomeBIConstants.YDL_USER_CONSULT_CLASSIFICATION_CLICK, HomeBIConstants.YDL_USER_CONSULT_CLASSIFICATION_CLICK,
data.cateId.toString(), data.id.toString(),
data.cateTitle data.title
?: "" ?: ""
) )
goExpertSearch(data) goExpertSearch(data)
} }
private fun goExpertSearch(data: HomeHeaderBean.AskCategoryDataBean) { private fun goExpertSearch(data: HomeHeaderBean.CategoryGoldListDataBean) {
if (!TextUtils.isEmpty(data.url) && data.url!!.endsWith("?")) {
data.url = data.url!!.substring(0, data.url!!.length - 1) if ("全部类别" == data.title || "全部分类" == data.title) {
}
if ("全部类别" == data.cateTitle || "全部分类" == data.cateTitle) {
/*YDLRouterManager.router( /*YDLRouterManager.router(
IYDLRouterConstant.ROUTER_H5_H5, IYDLRouterConstant.ROUTER_H5_H5,
YDLRouterParams().putExtra( YDLRouterParams().putExtra(
...@@ -261,19 +268,20 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -261,19 +268,20 @@ open class HomeBaseImpl : IHomeBaseEvent {
)*/ )*/
//因心理咨询迁移新系统,跳转咨询列表页 //因心理咨询迁移新系统,跳转咨询列表页
EventBus.getDefault().post(HomeModuleTabEvent(2)) EventBus.getDefault().post(HomeModuleTabEvent(2))
} else if (data.goType.equals("h5")) {
NewH5Activity.start(mContext, H5Params(data.goUrl.toString(), ""))
} else if (data.goType.equals("special_categories")) {
ARouter.getInstance().build("/consult/list")
.withInt(IYDLRouterConstant.EXTRA_SHOWTYPE, 0)
.withString(IYDLRouterConstant.EXTRA_CATETITLE, data.title)
.withSerializable(IYDLRouterConstant.GO_CRITERIA, data.goCriteriaMap)
.navigation()
} else { } else {
//跳转咨询频道页 服务入口 ARouter.getInstance().build("/consult/list")
YDLRouterManager.router( .withInt(IYDLRouterConstant.EXTRA_SHOWTYPE, 0)
IYDLRouterConstant.ROUTER_CONSULT_LIST, .withString(IYDLRouterConstant.EXTRA_CATETITLE, data.title)
YDLRouterParams().putExtra( .withSerializable(IYDLRouterConstant.GO_CRITERIA, data.goCriteriaMap)
IYDLRouterConstant.EXTRA_CATEID, .navigation()
data.cateId.toString()
).putExtra(
IYDLRouterConstant.EXTRA_CATETITLE, data.cateTitle!!
).putExtra(
IYDLRouterConstant.EXTRA_SHOWTYPE, "0"
)
)
} }
} }
...@@ -291,7 +299,7 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -291,7 +299,7 @@ open class HomeBaseImpl : IHomeBaseEvent {
return return
} }
EventBus.getDefault().post( EventBus.getDefault().post(
HomeModuleTabEvent(2,"11") HomeModuleTabEvent(2, "11")
) )
ActionCountUtils.count(HomeBIConstants.YDL_USER_CONSULT_CLICK) ActionCountUtils.count(HomeBIConstants.YDL_USER_CONSULT_CLICK)
} }
...@@ -304,7 +312,11 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -304,7 +312,11 @@ open class HomeBaseImpl : IHomeBaseEvent {
ActionCountUtils.count(HomeBIConstants.YDL_USER_TALK_IN_TIME_CLICK) ActionCountUtils.count(HomeBIConstants.YDL_USER_TALK_IN_TIME_CLICK)
//倾诉首页 ydl-user://confide/home //倾诉首页 ydl-user://confide/home
ActionCountUtils.record("listen_counselor_list_page", "listen_counselor_list_page_visit", "1") ActionCountUtils.record(
"listen_counselor_list_page",
"listen_counselor_list_page_visit",
"1"
)
route(mContext, ConfideRoute.R_CONFIDE_HOME) route(mContext, ConfideRoute.R_CONFIDE_HOME)
} }
...@@ -347,7 +359,7 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -347,7 +359,7 @@ open class HomeBaseImpl : IHomeBaseEvent {
* 倾述咨询师点击 * 倾述咨询师点击
* @param linkUrl 跳转地址 * @param linkUrl 跳转地址
*/ */
override fun confideClick(linkUrl: String?, confideId:String, doctorId: Int, uid:String?) { override fun confideClick(linkUrl: String?, confideId: String, doctorId: Int, uid: String?) {
if (Utils.isFastClick()) { if (Utils.isFastClick()) {
//防止连击 //防止连击
return return
...@@ -378,7 +390,9 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -378,7 +390,9 @@ open class HomeBaseImpl : IHomeBaseEvent {
//防止连击 //防止连击
return return
} }
if (!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(mContext as Context,true)) { if (!ModularServiceManager.provide(IUserService::class.java)
.loginByOneKeyLogin(mContext as Context, true)
) {
//判断登录状态内部已完成 跳转登录 //判断登录状态内部已完成 跳转登录
return return
} }
...@@ -452,7 +466,9 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -452,7 +466,9 @@ open class HomeBaseImpl : IHomeBaseEvent {
} }
override fun askItemFocusClick(position: Int, id: String) { override fun askItemFocusClick(position: Int, id: String) {
if (!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(mContext as Context,true)) { if (!ModularServiceManager.provide(IUserService::class.java)
.loginByOneKeyLogin(mContext as Context, true)
) {
//判断登录状态内部已完成 跳转登录 //判断登录状态内部已完成 跳转登录
return return
} }
...@@ -461,7 +477,9 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -461,7 +477,9 @@ open class HomeBaseImpl : IHomeBaseEvent {
} }
override fun askItemZanClick(position: Int, index: Int, id: String) { override fun askItemZanClick(position: Int, index: Int, id: String) {
if (!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(mContext as Context,true)) { if (!ModularServiceManager.provide(IUserService::class.java)
.loginByOneKeyLogin(mContext as Context, true)
) {
//判断登录状态内部已完成 跳转登录 //判断登录状态内部已完成 跳转登录
return return
} }
......
...@@ -72,7 +72,7 @@ interface IHomeBaseEvent { ...@@ -72,7 +72,7 @@ interface IHomeBaseEvent {
/** /**
* 首页分类跳转 * 首页分类跳转
*/ */
fun categoryClick(category: HomeHeaderBean.AskCategoryDataBean) fun categoryClick(category: HomeHeaderBean.CategoryGoldListDataBean)
/** /**
* 心理咨询点击事件 * 心理咨询点击事件
......
package com.yidianling.home.model.bean package com.yidianling.home.model.bean
import com.google.gson.annotations.SerializedName
import com.yidianling.consultant.bean.Keyworks import com.yidianling.consultant.bean.Keyworks
import java.io.Serializable
/** /**
* Created by haorui on 2019/2/14. * Created by haorui on 2019/2/14.
* Des:首页头部模块数据 Banner&分类 * Des:首页头部模块数据 Banner&分类
*/ */
class HomeHeaderBean : HomeItemBaseBean { class HomeHeaderBean : HomeItemBaseBean {
constructor():super(false) constructor() : super(false)
constructor(isRealEmpty:Boolean):super(isRealEmpty) constructor(isRealEmpty: Boolean) : super(isRealEmpty)
/** /**
* 活动弹窗数据 * 活动弹窗数据
*/ */
var activityResponse: ActivityResponse? = null var activityResponse: ActivityResponse? = null
/** /**
* 分类数据 * 分类数据
*/ */
var askCategoryData: MutableList<AskCategoryDataBean>? = null var askCategoryData: MutableList<AskCategoryDataBean>? = null
/**
* 新版分类数据
*/
var goldList: MutableList<CategoryGoldListDataBean>? = null
/** /**
* 焦点图数据 * 焦点图数据
*/ */
var focusList: List<FocusListBean>? = null var focusList: List<FocusListBean>? = null
/** /**
* 滚动销售数据 * 滚动销售数据
*/ */
var homeSaleData: List<HomeSaleDataBean>? = null var homeSaleData: List<HomeSaleDataBean>? = null
/** /**
* 搜索关键词数据 * 搜索关键词数据
*/ */
var keywordData: MutableList<Keyworks>? = null var keywordData: MutableList<Keyworks>? = null
/** /**
* 倾诉分类 * 倾诉分类
*/ */
...@@ -39,28 +52,42 @@ class HomeHeaderBean : HomeItemBaseBean { ...@@ -39,28 +52,42 @@ class HomeHeaderBean : HomeItemBaseBean {
* 咨询分类 * 咨询分类
*/ */
var consultCategoryData: List<ConsultCategoryDateBean>? = null var consultCategoryData: List<ConsultCategoryDateBean>? = null
/** /**
* 专家名称 * 专家名称
*/ */
var doctorName : String? = null var doctorName: String? = null
/* /*
* 倾诉免费标识 * 倾诉免费标识
* */ * */
var listenFree : Boolean? = null var listenFree: Boolean? = null
data class CategoryGoldListDataBean(
var id: String? = "",
var title: String? = "",
var icon: String? = "",
var goType: String? = "",
var goUrl: String? = "",
var goCriteriaMap: HashMap<String, Any>? = null
) : Serializable
class AskCategoryDataBean { class AskCategoryDataBean {
/** /**
* id * id
*/ */
var cateId: Int = 0 var cateId: Int = 0
/** /**
* 名称 * 名称
*/ */
var cateTitle: String? = null // var cateTitle: String? = null //
/** /**
* 跳转url * 跳转url
*/ */
var url: String? = null var url: String? = null
/** /**
* 图片icon * 图片icon
*/ */
...@@ -72,22 +99,27 @@ class HomeHeaderBean : HomeItemBaseBean { ...@@ -72,22 +99,27 @@ class HomeHeaderBean : HomeItemBaseBean {
* 标题 * 标题
*/ */
var title: String? = null var title: String? = null
/** /**
* 跳转链接 * 跳转链接
*/ */
var linkUrl: String? = null var linkUrl: String? = null
/** /**
* 图片 * 图片
*/ */
var imageUrl: String? = null var imageUrl: String? = null
/** /**
* iPhone X图片 * iPhone X图片
*/ */
var imageIphonex: String? = null var imageIphonex: String? = null
/** /**
* 焦点图id * 焦点图id
*/ */
var focId: Int = 0 var focId: Int = 0
/** /**
* 分享数据 * 分享数据
*/ */
...@@ -104,26 +136,32 @@ class HomeHeaderBean : HomeItemBaseBean { ...@@ -104,26 +136,32 @@ class HomeHeaderBean : HomeItemBaseBean {
* 用户昵称 * 用户昵称
*/ */
var nickName: String? = null var nickName: String? = null
/** /**
* 老师名字 * 老师名字
*/ */
var doctorName: String? = null var doctorName: String? = null
/** /**
* 老师id * 老师id
*/ */
var doctorId: Int = 0 var doctorId: Int = 0
/** /**
* 跳转专家主页 * 跳转专家主页
*/ */
var url: String? = null var url: String? = null
/** /**
* 内容开头 * 内容开头
*/ */
var contentBefore: String? = null var contentBefore: String? = null
/** /**
* 内容结尾 * 内容结尾
*/ */
var contentAfter: String? = null var contentAfter: String? = null
/** /**
* 创建时间 * 创建时间
*/ */
...@@ -135,11 +173,11 @@ class HomeHeaderBean : HomeItemBaseBean { ...@@ -135,11 +173,11 @@ class HomeHeaderBean : HomeItemBaseBean {
var name: String? = null var name: String? = null
} }
class ActivityResponse{ class ActivityResponse {
var imageBanner:String? = null// 弹窗图片 var imageBanner: String? = null// 弹窗图片
var imageUrl: String?=null// 图片 var imageUrl: String? = null// 图片
var linkUrl:String?=null // 首页弹窗 var linkUrl: String? = null // 首页弹窗
var btnLinkurl:String?=null // 首页入口(左上角图标) var btnLinkurl: String? = null // 首页入口(左上角图标)
var title :String? = null// 标题 var title: String? = null// 标题
} }
} }
<?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"
android:layout_marginBottom="@dimen/platform_dp_15"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/category_img"
android:layout_width="@dimen/platform_dp_30"
android:layout_height="@dimen/platform_dp_30" />
<TextView
android:id="@+id/category_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_5"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#1c212d"
android:textSize="@dimen/platform_sp_12" />
</LinearLayout>
\ No newline at end of file
...@@ -161,7 +161,7 @@ class YdlHomeAdapter( ...@@ -161,7 +161,7 @@ class YdlHomeAdapter(
//顶部预约专家,即时倾诉,心理课堂,心理测试按钮模块 //顶部预约专家,即时倾诉,心理课堂,心理测试按钮模块
is HomeButtonBannerViewHolder -> { is HomeButtonBannerViewHolder -> {
holder.buttonBannerView.initData( holder.buttonBannerView.initData(
list[position].headerBean?.askCategoryData list[position].headerBean?.goldList
) )
} }
//课程*成长模块 //课程*成长模块
......
...@@ -54,7 +54,7 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -54,7 +54,7 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
fun initData( fun initData(
homeCategory: List<HomeHeaderBean.AskCategoryDataBean>? homeCategory: List<HomeHeaderBean.CategoryGoldListDataBean>?
) { ) {
homeEvent?.let { home_category_view.setEvent(it) } homeEvent?.let { home_category_view.setEvent(it) }
home_category_view.initData(homeCategory) home_category_view.initData(homeCategory)
......
...@@ -30,7 +30,8 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent) ...@@ -30,7 +30,8 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent)
/** /**
* 数据缓存 * 数据缓存
*/ */
var mDataList: ArrayList<HomeHeaderBean.AskCategoryDataBean>? = null var mDataList: ArrayList<HomeHeaderBean.CategoryGoldListDataBean>? = null
/** /**
* 分类view宽度 * 分类view宽度
*/ */
...@@ -113,7 +114,7 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent) ...@@ -113,7 +114,7 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent)
} }
fun initData( fun initData(
askCategoryDataBean: List<HomeHeaderBean.AskCategoryDataBean>?, askCategoryDataBean: List<HomeHeaderBean.CategoryGoldListDataBean>?,
homeSaleData: List<HomeHeaderBean.HomeSaleDataBean>? homeSaleData: List<HomeHeaderBean.HomeSaleDataBean>?
) { ) {
if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) { if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) {
...@@ -136,17 +137,16 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent) ...@@ -136,17 +137,16 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent)
* 判断数据是否变化 * 判断数据是否变化
*/ */
private fun getChange( private fun getChange(
bean: List<HomeHeaderBean.AskCategoryDataBean>?, bean: List<HomeHeaderBean.CategoryGoldListDataBean>?,
cacheBean: List<HomeHeaderBean.AskCategoryDataBean>? cacheBean: List<HomeHeaderBean.CategoryGoldListDataBean>?
): Boolean { ): Boolean {
if (bean?.size != cacheBean?.size) { if (bean?.size != cacheBean?.size) {
return true return true
} }
for (index in 0 until bean?.size!!) { for (index in 0 until bean?.size!!) {
if (!bean[index].url.equals(cacheBean!![index].url) if (!bean[index].icon.equals(cacheBean!![index].icon)
|| !bean[index].coverUrl.equals(cacheBean!![index].coverUrl) || !bean[index].title.equals(cacheBean!![index].title)
|| !bean[index].cateTitle.equals(cacheBean!![index].cateTitle) || bean[index].id != cacheBean!![index].id
|| bean[index].cateId != cacheBean!![index].cateId
) { ) {
return true return true
} }
...@@ -218,9 +218,9 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent) ...@@ -218,9 +218,9 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent)
*/ */
private fun bindIconData( private fun bindIconData(
imageView: ImageView, imageView: ImageView,
categoryBean: HomeHeaderBean.AskCategoryDataBean categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) { ) {
GlideApp.with(context).load(categoryBean.coverUrl) GlideApp.with(context).load(categoryBean.icon)
.centerCrop().into(imageView) .centerCrop().into(imageView)
} }
...@@ -249,8 +249,11 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent) ...@@ -249,8 +249,11 @@ class HomePagerBannerCategoryView(mContext: Context, homeEvent: IHomeBaseEvent)
/** /**
* 设置文本 * 设置文本
*/ */
private fun bindTextData(textView: TextView, categoryBean: HomeHeaderBean.AskCategoryDataBean) { private fun bindTextData(
textView.text = categoryBean.cateTitle textView: TextView,
categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) {
textView.text = categoryBean.title
} }
/** /**
......
...@@ -30,7 +30,8 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -30,7 +30,8 @@ class HomeModuleCategoryView : FrameLayout {
/** /**
* 数据缓存 * 数据缓存
*/ */
var mDataList: ArrayList<HomeHeaderBean.AskCategoryDataBean>? = null var mDataList: ArrayList<HomeHeaderBean.CategoryGoldListDataBean>? = null
/** /**
* 分类view宽度 * 分类view宽度
*/ */
...@@ -126,7 +127,7 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -126,7 +127,7 @@ class HomeModuleCategoryView : FrameLayout {
dp15 = RxImageTool.dip2px(4f) dp15 = RxImageTool.dip2px(4f)
} }
fun initData(askCategoryDataBean: List<HomeHeaderBean.AskCategoryDataBean>?) { fun initData(askCategoryDataBean: List<HomeHeaderBean.CategoryGoldListDataBean>?) {
if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) { if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) {
visibility = View.GONE visibility = View.GONE
return return
...@@ -146,17 +147,16 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -146,17 +147,16 @@ class HomeModuleCategoryView : FrameLayout {
* 判断数据是否变化 * 判断数据是否变化
*/ */
private fun getChange( private fun getChange(
bean: List<HomeHeaderBean.AskCategoryDataBean>?, bean: List<HomeHeaderBean.CategoryGoldListDataBean>?,
cacheBean: List<HomeHeaderBean.AskCategoryDataBean>? cacheBean: List<HomeHeaderBean.CategoryGoldListDataBean>?
): Boolean { ): Boolean {
if (bean?.size != cacheBean?.size) { if (bean?.size != cacheBean?.size) {
return true return true
} }
for (index in 0 until bean?.size!!) { for (index in 0 until bean?.size!!) {
if (!bean[index].url.equals(cacheBean!![index].url) if (!bean[index].icon.equals(cacheBean!![index].icon)
|| !bean[index].coverUrl.equals(cacheBean!![index].coverUrl) || !bean[index].title.equals(cacheBean!![index].title)
|| !bean[index].cateTitle.equals(cacheBean!![index].cateTitle) || bean[index].id != cacheBean!![index].id
|| bean[index].cateId != cacheBean!![index].cateId
) { ) {
return true return true
} }
...@@ -282,8 +282,11 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -282,8 +282,11 @@ class HomeModuleCategoryView : FrameLayout {
/** /**
* 设置文本 * 设置文本
*/ */
private fun bindTextData(textView: TextView, categoryBean: HomeHeaderBean.AskCategoryDataBean) { private fun bindTextData(
textView.text = categoryBean.cateTitle textView: TextView,
categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) {
textView.text = categoryBean.title
} }
/** /**
...@@ -291,9 +294,9 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -291,9 +294,9 @@ class HomeModuleCategoryView : FrameLayout {
*/ */
private fun bindIconData( private fun bindIconData(
imageView: ImageView, imageView: ImageView,
categoryBean: HomeHeaderBean.AskCategoryDataBean categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) { ) {
GlideApp.with(context).load(categoryBean.coverUrl) GlideApp.with(context).load(categoryBean.icon)
.centerCrop().into(imageView) .centerCrop().into(imageView)
} }
} }
\ No newline at end of file
package com.yidianling.home.adapter
import android.content.Context
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeHeaderBean
import kotlinx.android.synthetic.main.home_category_list_item.view.*
/**
* Created by zqk on 17-9-20.
*/
class CategoryAdapter(
private val context: Context,
private val cateList: MutableList<HomeHeaderBean.CategoryGoldListDataBean>,
private val homeEvent: IHomeBaseEvent
) : RecyclerView.Adapter<CategoryAdapter.ViewHolder>() {
override fun getItemCount(): Int = cateList.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val itemView =
LayoutInflater.from(context).inflate(R.layout.home_category_list_item, parent, false)
return ViewHolder(itemView)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
GlideApp.with(context).load(cateList[position].icon)
.centerCrop().into(holder.category_img)
holder.category_text.text = cateList[position].title
holder.itemView.setOnClickListener {
homeEvent.categoryClick(cateList[position])
}
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val category_img = itemView.category_img
val category_text = itemView.category_text
}
}
\ No newline at end of file
...@@ -24,9 +24,10 @@ class HomeCategoryAdapter : PagerAdapter { ...@@ -24,9 +24,10 @@ class HomeCategoryAdapter : PagerAdapter {
private var mContext : Context? = null private var mContext : Context? = null
private var mHomeEvent : IHomeBaseEvent? = null private var mHomeEvent : IHomeBaseEvent? = null
//源数据 //源数据
private var mOriginList : MutableList<HomeHeaderBean.AskCategoryDataBean>? = null private var mOriginList: MutableList<HomeHeaderBean.AskCategoryDataBean>? = null
//数据 //数据
private var list : MutableList<MutableList<HomeHeaderBean.AskCategoryDataBean>>? = null private var list: MutableList<MutableList<HomeHeaderBean.CategoryGoldListDataBean>>? = null
init { init {
list = ArrayList() list = ArrayList()
...@@ -40,13 +41,15 @@ class HomeCategoryAdapter : PagerAdapter { ...@@ -40,13 +41,15 @@ class HomeCategoryAdapter : PagerAdapter {
/** /**
* 更新数据 * 更新数据
*/ */
fun updateItems(data : MutableList<HomeHeaderBean.AskCategoryDataBean>?){ fun updateItems(data: MutableList<HomeHeaderBean.CategoryGoldListDataBean>?) {
if (null == data || data.isEmpty()){ if (null == data || data.isEmpty()) {
return return
} }
Log.e("http","--------------data.size="+data!!.size) Log.e("http", "--------------data.size=" + data!!.size)
list = this.averageAssign(data, HomeCategoryContainer.PAGE_ITEM_SIZE) list?.clear()
Log.e("http","--------------list.size="+list!!.size) list?.add(data)
// list = this.averageAssign(data, HomeCategoryContainer.PAGE_ITEM_SIZE)
Log.e("http", "--------------list.size=" + list!!.size)
notifyDataSetChanged() notifyDataSetChanged()
} }
......
...@@ -136,7 +136,10 @@ class YdlHomeAdapter(private val mContext: Context, ...@@ -136,7 +136,10 @@ class YdlHomeAdapter(private val mContext: Context,
if (viewType == -1){ if (viewType == -1){
//空布局 //空布局
val view = View(mContext) val view = View(mContext)
val layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,1) val layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
view.layoutParams = layoutParams view.layoutParams = layoutParams
view.visibility = View.GONE view.visibility = View.GONE
return HomePagerBannerViewHolder(view,viewType) return HomePagerBannerViewHolder(view,viewType)
......
...@@ -5,10 +5,13 @@ import android.view.View ...@@ -5,10 +5,13 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
import kotlinx.android.synthetic.ydl.home_button_banner_view.view.* import kotlinx.android.synthetic.ydl.home_button_banner_view.view.*
...@@ -20,7 +23,11 @@ import kotlinx.android.synthetic.ydl.home_button_banner_view.view.* ...@@ -20,7 +23,11 @@ import kotlinx.android.synthetic.ydl.home_button_banner_view.view.*
* @Company 壹点灵 * @Company 壹点灵
* @date 2019/02/13 * @date 2019/02/13
*/ */
class HomeButtonBannerView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?,var listenFree:Boolean) : LinearLayout(mContext) { class HomeButtonBannerView(
private val mContext: Context,
private var homeEvent: IHomeBaseEvent?,
var listenFree: Boolean
) : LinearLayout(mContext) {
private var buttonParams: LinearLayout.LayoutParams? = null private var buttonParams: LinearLayout.LayoutParams? = null
private var buttonParamsFrame: FrameLayout.LayoutParams? = null private var buttonParamsFrame: FrameLayout.LayoutParams? = null
...@@ -29,24 +36,29 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -29,24 +36,29 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
init { init {
initView() initView()
} }
fun setVisibilityFree(boolean: Boolean){
if (boolean){ fun setVisibilityFree(boolean: Boolean) {
qingsuGif.visibility=View.VISIBLE if (boolean) {
qingsuGif.visibility = View.VISIBLE
homeModuleButtonBannerSecondTitle.text = "免费热线" homeModuleButtonBannerSecondTitle.text = "免费热线"
}else{ } else {
qingsuGif.visibility=View.GONE qingsuGif.visibility = View.GONE
homeModuleButtonBannerSecondTitle.text = "倾诉热线" homeModuleButtonBannerSecondTitle.text = "倾诉热线"
} }
} }
private fun initView() { private fun initView() {
val params = RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) val params = RecyclerView.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
layoutParams = params layoutParams = params
View.inflate(mContext, R.layout.home_button_banner_view, this) View.inflate(mContext, R.layout.home_button_banner_view, this)
setVisibilityFree(listenFree) setVisibilityFree(listenFree)
Glide.with(context) Glide.with(context)
.load(R.drawable.qingsu_new_free_dynamic) .load(R.drawable.qingsu_new_free_dynamic)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE) .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(qingsuGif) .into(qingsuGif)
initButtonView() initButtonView()
homeModuleButtonBannerFirst.setOnClickListener { homeModuleButtonBannerFirst.setOnClickListener {
...@@ -69,19 +81,21 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -69,19 +81,21 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
private fun initButtonView() { private fun initButtonView() {
if (null == buttonParams) { if (null == buttonParams) {
val screenWidth = RxDeviceTool.getScreenWidth(mContext) val screenWidth = RxDeviceTool.getScreenWidth(mContext)
val viewWidth = ((screenWidth - 2 * 9 * RxDeviceTool.getScreenDensity(mContext)) / 4).toInt() // val viewWidth = ((screenWidth - 2 * 9 * RxDeviceTool.getScreenDensity(mContext)) / 4).toInt()
val viewHeight = viewWidth * 78 / 80 val viewWidth = screenWidth / 4 - 40
val viewHeight = viewWidth
buttonParams = LinearLayout.LayoutParams(viewWidth, viewHeight) buttonParams = LinearLayout.LayoutParams(viewWidth, viewHeight)
buttonParams!!.setMargins(0, 0, 15, 0)
buttonParamsFrame = FrameLayout.LayoutParams(viewWidth, viewHeight) buttonParamsFrame = FrameLayout.LayoutParams(viewWidth, viewHeight)
buttonParamsFrame2= FrameLayout.LayoutParams((viewWidth/2.0).toInt(), (viewHeight/2.3).toInt()) buttonParamsFrame2 =
buttonParamsFrame2!!.setMargins((((viewWidth/12f).toInt())),0,0,0) FrameLayout.LayoutParams((viewWidth / 2.0).toInt(), (viewHeight / 2.3).toInt())
qingsuGif.layoutParams=buttonParamsFrame2 buttonParamsFrame2!!.setMargins((((viewWidth / 12f).toInt())), 0, 0, 0)
// qingsuGif.layoutParams=buttonParamsFrame2
homeModuleButtonBannerFirst.layoutParams = buttonParams homeModuleButtonBannerFirst.layoutParams = buttonParams
homeModuleButtonBannerFourth.layoutParams = buttonParams
homeModuleButtonBannerSecond.layoutParams = buttonParams homeModuleButtonBannerSecond.layoutParams = buttonParams
homeModuleButtonBannerThird.layoutParams = buttonParams homeModuleButtonBannerThird.layoutParams = buttonParams
homeModuleButtonBannerFourth.layoutParams = buttonParams homeModuleButtonBannerSecondFrame.layoutParams = buttonParamsFrame
homeModuleButtonBannerSecondFrame.layoutParams=buttonParamsFrame
} }
} }
} }
\ No newline at end of file
...@@ -29,7 +29,7 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent ...@@ -29,7 +29,7 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent
private var lastPosition = 0 private var lastPosition = 0
private var count = 0 private var count = 0
private var mIndicatorWidth: Int = RxImageTool.dip2px(9f) private var mIndicatorWidth: Int = RxImageTool.dip2px(15f)
private var mIndicatorHeight: Int = RxImageTool.dip2px(5f) private var mIndicatorHeight: Int = RxImageTool.dip2px(5f)
private var dp2 : Int = 0 private var dp2 : Int = 0
...@@ -39,7 +39,7 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent ...@@ -39,7 +39,7 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent
init { init {
initView() initView()
dp2 = RxImageTool.dip2px(4f) dp2 = RxImageTool.dip2px(2f)
} }
private fun initView() { private fun initView() {
...@@ -51,17 +51,18 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent ...@@ -51,17 +51,18 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent
* 填充数据 * 填充数据
*/ */
fun initData(bean: HomeHeaderBean?) { fun initData(bean: HomeHeaderBean?) {
mHomeCategoryAdapter?.updateItems(bean?.askCategoryData) if (bean?.goldList == null) return
if (bean?.askCategoryData?.size!! > PAGE_ITEM_SIZE){ mHomeCategoryAdapter?.updateItems(bean?.goldList)
count = Math.ceil(Math.ceil(bean.askCategoryData?.size?.toFloat()?.div(PAGE_ITEM_SIZE.toFloat())?.toDouble()!!)).toInt()
createIndicator() //向上取整
val params = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,RxImageTool.dip2px(153f)) count = bean.goldList?.size?.toDouble()?.div(5)?.let { Math.ceil(it).toInt() }!!
vp_category.layoutParams = params val params = RelativeLayout.LayoutParams(
}else{ ViewGroup.LayoutParams.MATCH_PARENT,
val params = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,RxImageTool.dip2px(143f)) RxImageTool.dip2px(65f * count)
vp_category.layoutParams = params )
ll_Indicator.visibility = View.GONE vp_category.layoutParams = params
}
ll_Indicator.visibility = View.GONE
} }
private fun initViewPager() { private fun initViewPager() {
......
...@@ -9,17 +9,21 @@ import android.view.ViewGroup ...@@ -9,17 +9,21 @@ import android.view.ViewGroup
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.ydl.ydl_image.module.GlideApp import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.utils.ScreenUtil import com.ydl.ydlcommon.utils.ScreenUtil
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.adapter.CategoryAdapter
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeHeaderBean import com.yidianling.home.model.bean.HomeHeaderBean
import kotlinx.android.synthetic.ydl.home_pager_banner_category_view.view.* import kotlinx.android.synthetic.ydl.home_pager_banner_category_view.view.*
/** /**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a> * @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
* @描述: 首页顶部模块-分类模块 * @描述: 首页顶部模块-分类模块 金刚位跳转H5或咨询列表页面
* @Copyright Copyright (c) 2019 * @Copyright Copyright (c) 2019
* @Company 壹点灵 * @Company 壹点灵
* @date 2019/02/16 * @date 2019/02/16
...@@ -28,7 +32,8 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve ...@@ -28,7 +32,8 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
/** /**
* 数据缓存 * 数据缓存
*/ */
var mDataList: ArrayList<HomeHeaderBean.AskCategoryDataBean>? = null var mDataList: ArrayList<HomeHeaderBean.CategoryGoldListDataBean>? = null
/** /**
* 分类view宽度 * 分类view宽度
*/ */
...@@ -66,10 +71,12 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve ...@@ -66,10 +71,12 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
* 倍数 * 倍数
*/ */
private var multiple: Int = 0 private var multiple: Int = 0
/** /**
* 测评首页事件处理类 * 测评首页事件处理类
*/ */
private var homeEvent: IHomeBaseEvent? = null private var homeEvent: IHomeBaseEvent? = null
private lateinit var categoryAdapter: CategoryAdapter
init { init {
initView() initView()
...@@ -84,7 +91,7 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve ...@@ -84,7 +91,7 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
val params = FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT) val params = FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)
// params.topMargin = ScreenUtil.screenHeight * (356f / 750f).toInt() // params.topMargin = ScreenUtil.screenHeight * (356f / 750f).toInt()
layoutParams = params layoutParams = params
initArgs() // initArgs()
} }
/** /**
...@@ -102,7 +109,7 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve ...@@ -102,7 +109,7 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
} }
//, homeSaleData: List<HomeHeaderBean.HomeSaleDataBean>? //, homeSaleData: List<HomeHeaderBean.HomeSaleDataBean>?
fun initData(askCategoryDataBean: MutableList<HomeHeaderBean.AskCategoryDataBean>?) { fun initData(askCategoryDataBean: MutableList<HomeHeaderBean.CategoryGoldListDataBean>?) {
if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) { if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) {
visibility = View.GONE visibility = View.GONE
return return
...@@ -115,22 +122,36 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve ...@@ -115,22 +122,36 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
mDataList!!.clear() mDataList!!.clear()
mDataList!!.addAll(askCategoryDataBean) mDataList!!.addAll(askCategoryDataBean)
} }
refreshView() homeEvent?.let {
categoryAdapter = CategoryAdapter(context, mDataList!!, it)
}
homeModulePagerBannerFlRoot.adapter = categoryAdapter
homeModulePagerBannerFlRoot.layoutManager = GridLayoutManager(
context,
5,
LinearLayoutManager.VERTICAL,
false
)
// refreshView()
// setRealTextView(homeSaleData) // setRealTextView(homeSaleData)
} }
/** /**
* 判断数据是否变化 * 判断数据是否变化
*/ */
private fun getChange(bean: MutableList<HomeHeaderBean.AskCategoryDataBean>?, cacheBean: MutableList<HomeHeaderBean.AskCategoryDataBean>?): Boolean { private fun getChange(
bean: MutableList<HomeHeaderBean.CategoryGoldListDataBean>?,
cacheBean: MutableList<HomeHeaderBean.CategoryGoldListDataBean>?
): Boolean {
if (bean?.size != cacheBean?.size) { if (bean?.size != cacheBean?.size) {
return true return true
} }
for (index in 0 until bean?.size!!) { for (index in 0 until bean?.size!!) {
if (!bean[index].url.equals(cacheBean!![index].url) if (!bean[index].icon.equals(cacheBean!![index].icon)
|| !bean[index].coverUrl.equals(cacheBean!![index].coverUrl) || !bean[index].title.equals(cacheBean!![index].title)
|| !bean[index].cateTitle.equals(cacheBean!![index].cateTitle) || bean[index].id != cacheBean!![index].id
|| bean[index].cateId != cacheBean!![index].cateId) { ) {
return true return true
} }
} }
...@@ -144,9 +165,6 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve ...@@ -144,9 +165,6 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
homeModulePagerBannerFlRoot.removeAllViews() homeModulePagerBannerFlRoot.removeAllViews()
var i = 0 var i = 0
for (item in mDataList!!) { for (item in mDataList!!) {
if (i > 9) {
break
}
val imageView = createIcon(i) val imageView = createIcon(i)
val textView = createText(i) val textView = createText(i)
...@@ -189,9 +207,12 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve ...@@ -189,9 +207,12 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
/** /**
* 加载图片 * 加载图片
*/ */
private fun bindIconData(imageView: ImageView, categoryBean: HomeHeaderBean.AskCategoryDataBean) { private fun bindIconData(
GlideApp.with(context).load(categoryBean.coverUrl) imageView: ImageView,
.centerCrop().into(imageView) categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) {
GlideApp.with(context).load(categoryBean.icon)
.centerCrop().into(imageView)
} }
/** /**
...@@ -219,8 +240,11 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve ...@@ -219,8 +240,11 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
/** /**
* 设置文本 * 设置文本
*/ */
private fun bindTextData(textView: TextView, categoryBean: HomeHeaderBean.AskCategoryDataBean) { private fun bindTextData(
textView.text = categoryBean.cateTitle textView: TextView,
categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) {
textView.text = categoryBean.title
} }
/** /**
......
...@@ -105,11 +105,7 @@ class HomePagerBannerView(private val mContext: Context, private var homeEvent: ...@@ -105,11 +105,7 @@ class HomePagerBannerView(private val mContext: Context, private var homeEvent:
if (null != focusListBean && focusListBean.isNotEmpty()) { if (null != focusListBean && focusListBean.isNotEmpty()) {
mImageViews.clear() mImageViews.clear()
//产品说取前8个 //产品说取前8个
if (focusListBean.size > 8){ cacheList.addAll(focusListBean)
cacheList.addAll(focusListBean.subList(0,8))
}else{
cacheList.addAll(focusListBean)
}
for (item in cacheList) { for (item in cacheList) {
mImageViews.add(item.imageUrl!!) mImageViews.add(item.imageUrl!!)
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
android:color="#E0E0E0"/> android:color="#E0E0E0"/>
<size <size
android:width="22dp" android:width="5dp"
android:height="5dp"/> android:height="5dp"/>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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:id="@+id/four_button_constrain"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingLeft="@dimen/platform_dp_8" android:paddingLeft="@dimen/platform_dp_8"
android:paddingRight="@dimen/platform_dp_8" android:paddingTop="@dimen/platform_dp_8"
android:layout_marginTop="@dimen/platform_dp_12" android:paddingRight="@dimen/platform_dp_8">
>
<RelativeLayout <RelativeLayout
android:id="@+id/homeModuleButtonBannerFirst" android:id="@+id/homeModuleButtonBannerFirst"
android:layout_width="80dp" android:layout_width="0dp"
android:layout_height="78dp" android:layout_height="78dp"
android:layout_weight="1"
android:background="@drawable/home_button_banner_first_img_new" android:background="@drawable/home_button_banner_first_img_new"
android:gravity="center"> android:gravity="center"
android:paddingRight="@dimen/platform_dp_10">
<TextView <TextView
android:id="@+id/homeModuleButtonBannerFirstTitle" android:id="@+id/homeModuleButtonBannerFirstTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="bold" android:text="心理咨询"
android:textColor="@color/platform_color_FFFFFF" android:textColor="@color/black"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:text="心理咨询"/> android:textStyle="bold" />
<TextView <TextView
android:layout_below="@+id/homeModuleButtonBannerFirstTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF" android:layout_below="@+id/homeModuleButtonBannerFirstTitle"
android:textSize="@dimen/platform_dp_12" android:text="3W+师资"
android:text="3W+师资"/> android:textColor="@color/black"
android:textSize="@dimen/platform_dp_12" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/homeModuleButtonBannerFourth" android:id="@+id/homeModuleButtonBannerFourth"
android:layout_width="80dp" android:layout_width="0dp"
android:layout_height="78dp" android:layout_height="78dp"
android:layout_weight="1"
android:background="@drawable/home_confide_free_icon" android:background="@drawable/home_confide_free_icon"
android:gravity="center"> android:gravity="center"
android:paddingRight="@dimen/platform_dp_10">
<TextView <TextView
android:id="@+id/homeModuleButtonBannerFourthTitle" android:id="@+id/homeModuleButtonBannerFourthTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="bold" android:text="心理测试"
android:textColor="@color/platform_color_FFFFFF" android:textColor="@color/black"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:text="心理测试"/> android:textStyle="bold" />
<TextView <TextView
android:layout_below="@+id/homeModuleButtonBannerFourthTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF" android:layout_below="@+id/homeModuleButtonBannerFourthTitle"
android:textSize="@dimen/platform_dp_12" android:text="抑郁测量"
android:text="抑郁测量"/> android:textColor="@color/black"
android:textSize="@dimen/platform_dp_12" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/homeModuleButtonBannerThird" android:id="@+id/homeModuleButtonBannerThird"
android:layout_width="80dp" android:layout_width="0dp"
android:layout_height="78dp" android:layout_height="78dp"
android:orientation="vertical" android:layout_weight="1"
android:background="@drawable/home_button_banner_third_img_new" android:background="@drawable/home_button_banner_third_img_new"
android:gravity="center"> android:gravity="center"
android:orientation="vertical"
android:paddingRight="@dimen/platform_dp_10">
<TextView <TextView
android:id="@+id/homeModuleButtonBannerThirdTitle" android:id="@+id/homeModuleButtonBannerThirdTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="bold" android:text="心理课堂"
android:textColor="@color/platform_color_FFFFFF" android:textColor="@color/black"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:text="心理课堂"/> android:textStyle="bold" />
<TextView <TextView
android:layout_below="@+id/homeModuleButtonBannerThirdTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF" android:layout_below="@+id/homeModuleButtonBannerThirdTitle"
android:textSize="@dimen/platform_dp_12" android:text="学习与成长"
android:text="学习与成长"/> android:textColor="@color/black"
android:textSize="@dimen/platform_dp_12" />
</RelativeLayout> </RelativeLayout>
<FrameLayout
android:id="@+id/homeModuleButtonBannerSecond" <FrameLayout
android:layout_width="80dp" android:id="@+id/homeModuleButtonBannerSecond"
android:layout_width="0dp"
android:layout_height="78dp"
android:layout_weight="1"
android:background="@drawable/home_button_banner_fourth_img_new"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintLeft_toRightOf="@id/homeModuleButtonBannerThird"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<RelativeLayout
android:id="@+id/homeModuleButtonBannerSecondFrame"
android:layout_width="78dp"
android:layout_height="78dp" android:layout_height="78dp"
android:background="@drawable/home_button_banner_fourth_img_new" android:gravity="center"
> android:paddingRight="@dimen/platform_dp_10">
<RelativeLayout
android:id="@+id/homeModuleButtonBannerSecondFrame" <TextView
android:layout_width="80dp" android:id="@+id/homeModuleButtonBannerSecondTitle"
android:layout_height="78dp" android:layout_width="wrap_content"
android:gravity="center"> android:layout_height="wrap_content"
<TextView android:text="倾诉热线"
android:id="@+id/homeModuleButtonBannerSecondTitle" android:textColor="@color/black"
android:layout_width="wrap_content" android:textSize="@dimen/platform_dp_16"
android:layout_height="wrap_content" android:textStyle="bold" />
android:textStyle="bold"
android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_16"
android:text="倾诉热线"/>
<TextView <TextView
android:layout_below="@+id/homeModuleButtonBannerSecondTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_12"
android:text="温暖守护您"/>
</RelativeLayout>
<ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/qingsuGif" android:layout_below="@+id/homeModuleButtonBannerSecondTitle"
android:visibility="gone" android:text="温暖守护您"
> android:textColor="@color/black"
</ImageView> android:textSize="@dimen/platform_dp_12" />
</FrameLayout> </RelativeLayout>
<ImageView
android:id="@+id/qingsuGif"
android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_22"
android:visibility="visible" />
</FrameLayout>
</LinearLayout> </LinearLayout>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/vp_category" android:id="@+id/vp_category"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="153dp" android:layout_height="wrap_content"
android:background="@color/platform_white"/> android:background="@color/platform_white"/>
<LinearLayout <LinearLayout
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:visibility="gone" android:visibility="visible"
tools:visibility="visible"/> tools:visibility="visible"/>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android">
<androidx.recyclerview.widget.RecyclerView
<FrameLayout
android:id="@+id/homeModulePagerBannerFlRoot" android:id="@+id/homeModulePagerBannerFlRoot"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginStart="@dimen/platform_dp_8"
android:layout_marginEnd="@dimen/platform_dp_8"
android:paddingBottom="1dp" /> android:paddingBottom="1dp" />
</merge> </merge>
\ No newline at end of file
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
android:id="@+id/homeModulePagerBannerViewAddLayout" android:id="@+id/homeModulePagerBannerViewAddLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="175dp"
android:background="@drawable/home_home_category_bg" android:background="@drawable/home_home_category_bg"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="20dp"> android:paddingTop="20dp">
......
...@@ -82,6 +82,7 @@ interface IYDLRouterConstant{ ...@@ -82,6 +82,7 @@ interface IYDLRouterConstant{
const val EXTRA_RED_PACKET = "by_red_packet" const val EXTRA_RED_PACKET = "by_red_packet"
const val EXTRA_CONFIDEDID = "confidedId" const val EXTRA_CONFIDEDID = "confidedId"
const val EXTRA_DOCTORID = "doctorId" const val EXTRA_DOCTORID = "doctorId"
const val GO_CRITERIA = "go_criteria"
/** /**
* 冥想模块额外参数 * 冥想模块额外参数
......
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