Commit 1183915e by 霍志良

feat:BUG修改

parent 1899cb1a
......@@ -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