Commit 1183915e by 霍志良

feat:BUG修改

parent 1899cb1a
......@@ -4,6 +4,7 @@ import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ObjectAnimator
import android.animation.PropertyValuesHolder
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
......@@ -24,6 +25,7 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.google.android.material.appbar.AppBarLayout
import com.tencent.mmkv.MMKV
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.config.SimpleImageOpConfiger
......@@ -36,17 +38,20 @@ import com.ydl.ydlcommon.ui.LogoLoadingView
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.ydl.ydlcommon.view.listener.EndlessRecyclerViewScrollListener
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.adapter.ExpertSearchAdapter
import com.yidianling.consultant.bean.ConsultantRecentCity
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.constants.ConsultBIConstants.ConsultEvent.Companion.YDL_USER_CONSULT_SEARCH_CLICK
import com.yidianling.consultant.listener.OnCategoriesSelectedListener
import com.yidianling.consultant.listener.OnFilterConfirmListener
import com.yidianling.consultant.listener.OnPriceItemSelectedListener
import com.yidianling.consultant.listener.OnSortItemSelectedListener
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.model.bean.*
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import com.yidianling.consultant.router.ConsultantIn
......@@ -73,6 +78,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
var bottomWordDisposable: Disposable? = null
private lateinit var bottomWordlist: List<FunctionWordBean>
private var searchWord: String? = ""
private var subLocationItem: SubItem? = SubItem()
private var locationRegionItem: RegionItem? = null
private var locationList: ArrayList<SubItem>? = arrayListOf()
private var locationHistoryList: ArrayList<RegionItem>? = arrayListOf()
override fun showImage(url: String?, imgView: ImageView) {
YDLImageCacheManager.showImage(ExpertSearchActivity@ this, url, imgView)
}
......@@ -1024,7 +1033,26 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
hideSoftInput()
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
showAreaPopupWindow()
if (MMKV.defaultMMKV()
.decodeBool(ConsultBIConstants.ConsultantLocationAuth.WHETHER_LOCATION_AUTH)
) {
//同意定位授权
showAreaPopupWindow(true)
} else {
val dialog = CommonDialog(mContext)
.setTitle("温馨提示")
.setMessage("建议您授权定位权限,就能轻松获取周边优秀咨询师和其他服务")
.setLeftOnclick("暂不") { v1 ->
showAreaPopupWindow(false)
}.setRightClick("授权") { v12 ->
MMKV.defaultMMKV().encode(
ConsultBIConstants.ConsultantLocationAuth.WHETHER_LOCATION_AUTH,
true
)
showAreaPopupWindow(true)
}
dialog.show()
}
}, 300)
}
......@@ -1417,83 +1445,156 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
refresh()
}
//显示地区弹窗
private fun showAreaPopupWindow() {
if (headData?.region != null) {
val regionPopupWindow = AreaPopupWindow(
this, headData?.region
?: ArrayList(), allFilter.region, allFilter.sub,
true
@SuppressLint("CheckResult")
fun getRegionByIp(agreeLocation: Boolean) {
if (agreeLocation) {
SearchApi.getSearchApi().getCityByIp()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it.code == "200") {
locationList?.clear()
subLocationItem?.code = it.data.city_code
subLocationItem?.key = it.data.city_code
subLocationItem?.value = it.data.city_name
subLocationItem?.locationCode = "-1"
subLocationItem?.let { locationList?.add(it) }
locationRegionItem = locationList?.let { it1 ->
RegionItem(
it1,
value = "定位",
key = it.data.province_code,
code = it.data.province_code
)
}
locationRegionItem?.let { locationHistoryList?.add(0, it) }
showAreaPoPup(agreeLocation)
}
}, {})
} else {
locationList?.clear()
subLocationItem?.code = null
subLocationItem?.key = null
subLocationItem?.value = "开启授权,获得定位城市"
subLocationItem?.locationCode = "NotAuth"
subLocationItem?.let { locationList?.add(it) }
locationRegionItem = locationList?.let { it1 ->
RegionItem(
it1,
value = "定位",
key = null,
code = null
)
}
locationRegionItem?.let { locationHistoryList?.add(0, it) }
showAreaPoPup(agreeLocation)
}
}
private fun showAreaPoPup(isAgreeLocation: Boolean) {
locationHistoryList?.addAll(headData?.region ?: ArrayList())
if (allFilter.region.value == null) allFilter.region = locationRegionItem!!
val regionPopupWindow = locationHistoryList?.let {
AreaPopupWindow(
this,
it,
allFilter.region,
allFilter.sub,
isAgreeLocation
)
regionPopupWindow.showAsDropDown(viewSep2)
viewDim.visibility = View.VISIBLE
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
regionPopupWindow.setOnDismissListener {
viewDim.visibility = View.INVISIBLE
if (tvArea.text != CONST_CITY) {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED)
} else {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
}
}
regionPopupWindow?.showAsDropDown(viewSep2)
viewDim.visibility = View.VISIBLE
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
regionPopupWindow?.setOnDismissListener {
viewDim.visibility = View.INVISIBLE
if (tvArea.text != "城市") {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED)
} else {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
}
regionPopupWindow.onRegionSelectedListener =
object : AreaPopupWindow.OnRegionSelectedListener {
override fun onRegionSelected(region: RegionItem, sub: SubItem) {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
allFilter.region = region
allFilter.sub = sub
if (TextUtils.isEmpty(region.code) && TextUtils.isEmpty(sub.code)) {
tvArea.text = CONST_CITY
} else if (!TextUtils.isEmpty(region.code) && !TextUtils.isEmpty(sub.code)) {
if (region.value?.length ?: 0 > 4) {
tvArea.text = region.value?.substring(0, 3) + "..."
} else {
tvArea.text = region.value
}
}
regionPopupWindow?.onRegionSelectedListener =
object : AreaPopupWindow.OnRegionSelectedListener {
override fun onRegionSelected(region: RegionItem, sub: SubItem) {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
allFilter.region = region
allFilter.sub = sub
if (TextUtils.isEmpty(region.code) && TextUtils.isEmpty(sub.code)) {
tvArea.text = "城市"
} else if (!TextUtils.isEmpty(region.code) && !TextUtils.isEmpty(sub.code)) {
if (region.value?.length ?: 0 > 4) {
tvArea.text = region.value?.substring(0, 3) + "..."
} else {
if (sub.value?.length ?: 0 > 4) {
tvArea.text = sub.value?.substring(0, 3) + "..."
} else {
tvArea.text = sub.value
}
tvArea.text = region.value
}
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_AREA_CLICK,
region.value + "|" + sub.value
)
//更新热门搜索显示状态
if (headData!!.highlighter.size > 0) {
for ((index, hot) in headData!!.highlighter.withIndex()) {
if (hot.type == "2" || hot.type == "8") {
var textview = lin_filter2.getChildAt(index) as TextView
//有选择城市
if (!TextUtils.isEmpty(sub.code)) {
if (TextUtils.equals(sub.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
} else {
if (sub.value?.length ?: 0 > 4) {
tvArea.text = sub.value?.substring(0, 3) + "..."
} else {
tvArea.text = sub.value
}
}
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_AREA_CLICK,
region.value + "|" + sub.value
)
//更新热门搜索显示状态
if (headData!!.highlighter.size > 0) {
for ((index, hot) in headData!!.highlighter.withIndex()) {
if (hot.type == "2" || hot.type == "8") {
val textview = lin_filter2.getChildAt(index) as TextView
//有选择城市
if (!TextUtils.isEmpty(sub.code)) {
if (TextUtils.equals(sub.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
if (TextUtils.equals(region.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
} else {
if (TextUtils.equals(region.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
}
}
}
regionPopupWindow.dismiss()
refresh()
}
regionPopupWindow?.dismiss()
refresh()
}
}
}
//显示地区弹窗
private fun showAreaPopupWindow(isAgreeLocation: Boolean) {
if (headData?.region != null) {
locationHistoryList?.clear()
//添加历史搜索
var recentCityBean =
MMKV.defaultMMKV().decodeParcelable(
ConsultBIConstants.ConsultantLocationAuth.RECENT_CITY,
ConsultantRecentCity::class.java
)
if (recentCityBean == null) recentCityBean = ConsultantRecentCity(arrayListOf())
locationHistoryList?.add(
RegionItem(
recentCityBean!!.recentCity,
value = "历史",
key = "0",
code = "0"
)
)
//添加定位
getRegionByIp(isAgreeLocation)
} else {
ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead()
......
......@@ -48,6 +48,7 @@ import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.adapter.ExpertSearchAdapter
import com.yidianling.consultant.bean.ConsultantRecentCity
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.constants.ConsultBIConstants.ConsultantLocationAuth.Companion.WHETHER_LOCATION_AUTH
import com.yidianling.consultant.listener.*
......@@ -56,6 +57,7 @@ import com.yidianling.consultant.listener.OnCategoriesSelectedListener
import com.yidianling.consultant.listener.OnExpertClickListener
import com.yidianling.consultant.listener.OnFilterConfirmListener
import com.yidianling.consultant.listener.OnSortItemSelectedListener
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.model.bean.*
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import com.yidianling.consultant.router.ConsultantIn
......@@ -89,6 +91,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
var bottomWordDisposable: Disposable? = null
var isShow: Boolean = false
private lateinit var bottomWordlist: List<FunctionWordBean>
private var subLocationItem: SubItem? = SubItem()
private var locationRegionItem: RegionItem? = null
private var locationList: ArrayList<SubItem>? = arrayListOf()
private var locationHistoryList: ArrayList<RegionItem>? = arrayListOf()
override fun layoutResId(): Int {
return R.layout.consultant_activity_expert_search_list
}
......@@ -1310,89 +1317,160 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
refresh()
}
@SuppressLint("CheckResult")
fun getRegionByIp(agreeLocation: Boolean) {
if (agreeLocation) {
SearchApi.getSearchApi().getCityByIp()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it.code == "200") {
locationList?.clear()
subLocationItem?.code = it.data.city_code
subLocationItem?.key = it.data.city_code
subLocationItem?.value = it.data.city_name
subLocationItem?.locationCode = "-1"
subLocationItem?.let { locationList?.add(it) }
locationRegionItem = locationList?.let { it1 ->
RegionItem(
it1,
value = "定位",
key = it.data.province_code,
code = it.data.province_code
)
}
locationRegionItem?.let { locationHistoryList?.add(0, it) }
showAreaPoPup(agreeLocation)
}
}, {})
} else {
locationList?.clear()
subLocationItem?.code = null
subLocationItem?.key = null
subLocationItem?.value = "开启授权,获得定位城市"
subLocationItem?.locationCode = "NotAuth"
subLocationItem?.let { locationList?.add(it) }
locationRegionItem = locationList?.let { it1 ->
RegionItem(
it1,
value = "定位",
key = null,
code = null
)
}
locationRegionItem?.let { locationHistoryList?.add(0, it) }
showAreaPoPup(agreeLocation)
}
}
//显示地区弹窗
private fun showAreaPopupWindow(isAgreeLocation: Boolean) {
if (headData?.region != null) {
val regionPopupWindow = AreaPopupWindow(
locationHistoryList?.clear()
//添加历史搜索
var recentCityBean =
MMKV.defaultMMKV().decodeParcelable(
ConsultBIConstants.ConsultantLocationAuth.RECENT_CITY,
ConsultantRecentCity::class.java
)
if (recentCityBean == null) recentCityBean = ConsultantRecentCity(arrayListOf())
locationHistoryList?.add(
RegionItem(
recentCityBean!!.recentCity,
value = "历史",
key = "0",
code = "0"
)
)
//添加定位
getRegionByIp(isAgreeLocation)
} else {
ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead()
}
}
private fun showAreaPoPup(isAgreeLocation: Boolean) {
locationHistoryList?.addAll(headData?.region ?: ArrayList())
if (allFilter.region.value == null) allFilter.region = locationRegionItem!!
val regionPopupWindow = locationHistoryList?.let {
AreaPopupWindow(
mActivity,
headData?.region ?: ArrayList(),
it,
allFilter.region,
allFilter.sub,
isAgreeLocation
)
regionPopupWindow.showAsDropDown(viewSep2)
viewDim.visibility = View.VISIBLE
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
regionPopupWindow.setOnDismissListener {
viewDim.visibility = View.INVISIBLE
if (tvArea.text != "城市") {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED)
} else {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
}
}
regionPopupWindow?.showAsDropDown(viewSep2)
viewDim.visibility = View.VISIBLE
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
regionPopupWindow?.setOnDismissListener {
viewDim.visibility = View.INVISIBLE
if (tvArea.text != "城市") {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED)
} else {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
}
regionPopupWindow.onRegionSelectedListener =
object : AreaPopupWindow.OnRegionSelectedListener {
override fun onRegionSelected(region: RegionItem, sub: SubItem) {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
allFilter.region = region
allFilter.sub = sub
if (TextUtils.isEmpty(region.code) && TextUtils.isEmpty(sub.code)) {
tvArea.text = "城市"
} else if (!TextUtils.isEmpty(region.code) && !TextUtils.isEmpty(sub.code)) {
if (region.value?.length ?: 0 > 4) {
tvArea.text = region.value?.substring(0, 3) + "..."
} else {
tvArea.text = region.value
}
}
regionPopupWindow?.onRegionSelectedListener =
object : AreaPopupWindow.OnRegionSelectedListener {
override fun onRegionSelected(region: RegionItem, sub: SubItem) {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
allFilter.region = region
allFilter.sub = sub
if (TextUtils.isEmpty(region.code) && TextUtils.isEmpty(sub.code)) {
tvArea.text = "城市"
} else if (!TextUtils.isEmpty(region.code) && !TextUtils.isEmpty(sub.code)) {
if (region.value?.length ?: 0 > 4) {
tvArea.text = region.value?.substring(0, 3) + "..."
} else {
if (sub.value?.length ?: 0 > 4) {
tvArea.text = sub.value?.substring(0, 3) + "..."
} else {
tvArea.text = sub.value
}
tvArea.text = region.value
}
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_AREA_CLICK,
region.value + "|" + sub.value
)
//更新热门搜索显示状态
if (headData!!.highlighter.size > 0) {
for ((index, hot) in headData!!.highlighter.withIndex()) {
if (hot.type == "2" || hot.type == "8") {
val textview = lin_filter2.getChildAt(index) as TextView
//有选择城市
if (!TextUtils.isEmpty(sub.code)) {
if (TextUtils.equals(sub.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
} else {
if (sub.value?.length ?: 0 > 4) {
tvArea.text = sub.value?.substring(0, 3) + "..."
} else {
tvArea.text = sub.value
}
}
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_AREA_CLICK,
region.value + "|" + sub.value
)
//更新热门搜索显示状态
if (headData!!.highlighter.size > 0) {
for ((index, hot) in headData!!.highlighter.withIndex()) {
if (hot.type == "2" || hot.type == "8") {
val textview = lin_filter2.getChildAt(index) as TextView
//有选择城市
if (!TextUtils.isEmpty(sub.code)) {
if (TextUtils.equals(sub.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
if (TextUtils.equals(region.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
} else {
if (TextUtils.equals(region.code, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
}
}
}
regionPopupWindow.dismiss()
refresh()
}
regionPopupWindow?.dismiss()
refresh()
}
} else {
ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead()
}
}
}
private var mHandler: Handler? = null
......
......@@ -44,12 +44,11 @@ class AreaPopupWindow(
private var recentCityBean: ConsultantRecentCity? = ConsultantRecentCity(arrayListOf())
var onRegionSelectedListener: OnRegionSelectedListener? = null
private var subLocationItem: SubItem? = SubItem()
private var locationHistoryList: ArrayList<RegionItem>? = arrayListOf()
private val locationCode = "-1"
private val recentCityCode = "0"
private var locationRegionItem: RegionItem? = null
private var locationList: ArrayList<SubItem>? = arrayListOf()
private var locationHistoryList = regionList
init {
val view =
LayoutInflater.from(context).inflate(R.layout.consultant_ui_region_popup_window, null)
......@@ -60,27 +59,12 @@ class AreaPopupWindow(
this.isOutsideTouchable = true
this.height =
((RxDeviceTool.getScreenHeight(context) - RxImageTool.dp2px(90f)) * 0.618).toInt() //设置高度为屏幕的80%
//根据IP获取当前城市
getRegionByIp(isAgree, true)
recentCityBean =
MMKV.defaultMMKV().decodeParcelable(RECENT_CITY, ConsultantRecentCity::class.java)
if (recentCityBean == null) recentCityBean = ConsultantRecentCity(arrayListOf())
locationHistoryList?.add(
RegionItem(
recentCityBean!!.recentCity,
value = "历史",
key = recentCityCode,
code = recentCityCode
)
)
locationHistoryList?.addAll(regionList)
regionAdapter.regionList = locationHistoryList!!
regionAdapter.regionList = regionList
if (selectedRegion.sub.isNotEmpty()) {
subList.addAll(selectedRegion.sub)
} else {
subList.addAll(regionList[0].sub)
}
subAdapter = SubRecyclerViewAdapter(context, subList, selectedSub, locationCode)
subAdapter.setOnAuthClickLister(object : SubRecyclerViewAdapter.OnAuthClickLister {
override fun onAuthClick() {
......@@ -88,7 +72,6 @@ class AreaPopupWindow(
.setTitle("温馨提示")
.setMessage("建议您授权定位权限,就能轻松获取周边优秀咨询师和其他服务")
.setLeftOnclick("暂不") { v1 ->
dismiss()
}.setRightClick("授权") { v12 ->
MMKV.defaultMMKV().encode(
ConsultBIConstants.ConsultantLocationAuth.WHETHER_LOCATION_AUTH,
......@@ -114,10 +97,10 @@ class AreaPopupWindow(
view.rvSub.scrollToPosition(0)
}
view.rvRegion.adapter = regionAdapter
// val i = locationHistoryList!!
// .takeWhile { it.key != selectedRegion.key }
// .count()
// view.rvRegion.scrollToPosition(i)
val i = regionList
.takeWhile { it.key != selectedRegion.key }
.count()
view.rvRegion.scrollToPosition(i)
view.rvSub.layoutManager =
......@@ -137,6 +120,7 @@ class AreaPopupWindow(
//倒序保留最近五次的搜索历史记录并去重
private fun saveCitySearchRecord(data: SubItem) {
if (data.value == "不限") return
recentCityBean?.let {
if (it.recentCity.size < 5) {
it.recentCity.add(0, data)
......@@ -163,26 +147,15 @@ class AreaPopupWindow(
subLocationItem?.key = it.data.city_code
subLocationItem?.value = it.data.city_name
subLocationItem?.locationCode = locationCode
locationList?.clear()
subLocationItem?.let { locationList?.add(it) }
locationRegionItem =
locationList?.let {
RegionItem(
it,
value = "定位",
key = locationCode,
code = locationCode
)
}
locationRegionItem?.let { locationHistoryList?.add(0, it) }
if (locationRegionItem != null) {
selectedRegion = locationRegionItem!!
regionAdapter.selectedRegion = selectedRegion
}
if (selectedRegion.sub.isNotEmpty()) {
subList.addAll(selectedRegion.sub)
}
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()
}
......
......@@ -208,10 +208,7 @@ class FilterPopupWindow(
tempFilter.specialityCrowd.clear()
tempFilter.others.clear()
tempFilter.title.clear()
tempFilter.priceRangesView = null
tempFilter.priceRanges = null
etMinPrice?.setText("")
etMaxPrice?.setText("")
for (v in showTypeViews) {
v.isSelected = false
......@@ -257,14 +254,6 @@ class FilterPopupWindow(
v.paint.isFakeBoldText = false
}
}
for (v in priceRangeViews) {
v.isSelected = false
if (v is TextView) {
v.paint.isFakeBoldText = false
}
}
updateCount(ConsultBIConstants.POSITION_CONSULT_FILTER_RESET_CLICK)
}
......
......@@ -63,6 +63,35 @@ class PricePopupWindow(
onPriceItemSelectedListener.onPriceItemSelected(priceRangesItem)
dismiss()
}
contentView.price_reset.setOnClickListener {
//重置
contentView.range_price_seekbar.setProgress(0f, 100f)
reset()
}
if (tempFilter.priceRanges != null) {
if (tempFilter.priceRanges?.min_price.isNullOrEmpty()) {
min_Price = "0"
SeekBarLeftValue = 0f
} else {
min_Price = tempFilter.priceRanges?.min_price.toString()
SeekBarLeftValue =
(tempFilter.priceRanges?.min_price.toString().toFloat() / maxPriceValue) * 100f
}
if (tempFilter.priceRanges?.max_price.isNullOrEmpty()) {
max_Price = infiniteText
SeekBarRightValue = 100f
} else {
max_Price = tempFilter.priceRanges?.max_price.toString() + "元"
SeekBarRightValue =
(tempFilter.priceRanges?.max_price.toString().toFloat() / maxPriceValue) * 100f
}
if (SeekBarRightValue > 100f) SeekBarRightValue = 100f
contentView.tv_start_end_price.text = "$min_Price-$max_Price"
contentView.range_price_seekbar.setProgress(SeekBarLeftValue, SeekBarRightValue)
} else {
contentView.range_price_seekbar.setProgress(0f, 100f)
}
contentView.range_price_seekbar.setOnRangeChangedListener(object : OnRangeChangedListener {
override fun onRangeChanged(
view: RangeSeekBar?,
......@@ -80,6 +109,7 @@ class PricePopupWindow(
}
override fun onStartTrackingTouch(view: RangeSeekBar?, isLeft: Boolean) {
reset()
}
override fun onStopTrackingTouch(view: RangeSeekBar?, isLeft: Boolean) {
......@@ -88,6 +118,19 @@ class PricePopupWindow(
})
}
private fun reset() {
tempFilter.priceRangesView = null
tempFilter.priceRanges = null
contentView?.tv_start_end_price?.text = "0-无限"
for (v in priceRangeViews) {
v.isSelected = false
if (v is TextView) {
v.paint.isFakeBoldText = false
}
}
initPriceTag()
}
fun initPriceTag() {
val mWidth = (popWidth - RxImageTool.dp2px(52f)) / enquirySize
for ((index, priceRangesItem) in filterData.priceRanges.withIndex()) {
......@@ -164,7 +207,7 @@ class PricePopupWindow(
max_Price = infiniteText
SeekBarRightValue = 100f
} else {
max_Price = priceRangesItem.max_price.toString()
max_Price = priceRangesItem.max_price.toString() + "元"
SeekBarRightValue =
(priceRangesItem.max_price.toString().toFloat() / maxPriceValue) * 100f
}
......
......@@ -22,7 +22,7 @@
android:id="@+id/tv_start_end_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="200-500"
android:text="0-不限"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/platform_dp_30"
android:textColor="@color/platform_color_black_333333"
......
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