Commit 3a23ad3f by 霍志良

feat:价格筛选回调排序添加

parent d8a14b9d
......@@ -1163,7 +1163,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
allFilter.title.addAll(tempFilter.title)
allFilter.priceRanges = tempFilter.priceRanges
allFilter.priceRangesView = tempFilter.priceRangesView
allFilter.reorder = tempFilter.reorder
//判断主题选中,判断热门筛选中是否也有该主题
Executors.newCachedThreadPool().execute {
if (headData!!.highlighter.size > 0) {
......@@ -1618,7 +1618,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onPriceItemSelected(priceRangesItem: PriceRangesItem) {
//价格筛选回调
allFilter.priceRanges = priceRange
allFilter.priceRanges = priceRangesItem
getPresenter().fetchListData(allFilter, getPresenter().mExtras)
}
}
......@@ -1072,7 +1072,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
allFilter.title.addAll(tempFilter.title)
allFilter.priceRanges = tempFilter.priceRanges
allFilter.priceRangesView = tempFilter.priceRangesView
allFilter.reorder = tempFilter.reorder
//判断主题选中,判断热门筛选中是否也有该主题
Executors.newCachedThreadPool().execute {
if (headData!!.highlighter.size > 0) {
......
......@@ -94,8 +94,6 @@ class FilterPopupWindow(
initShowTypeViews(view)
//咨询方式
initEnquiryViews(view)
//服务均价
initPriceViews(view)
//年龄选择
initAgeViews(view)
//其他选择
......@@ -159,7 +157,7 @@ class FilterPopupWindow(
llTextView.isSelected = true
llTextView.paint.isFakeBoldText = true
tempFilter.sortRangesView = llTextView
tempFilter.reorder = sortItems[index]
}
updateCount(ConsultBIConstants.POSITION_CONSULT_TYPE_CLICK)
}
......@@ -654,131 +652,6 @@ class FilterPopupWindow(
}
}
private fun initPriceViews(view: View) {
val priceRange =
View.inflate(context, R.layout.consultant_item_price_range, null) as LinearLayout
etMinPrice = priceRange.findViewById(R.id.etMinPrice);
etMaxPrice = priceRange.findViewById(R.id.etMaxPrice);
// context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
val listener: TextView.OnEditorActionListener =
TextView.OnEditorActionListener { _, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_DONE || event != null && event.keyCode == KeyEvent.KEYCODE_ENTER) {
updatePriceFilter()
true
} else {
false
}
}
if (tempFilter.priceRanges != null) {
etMinPrice?.setText(tempFilter.priceRanges?.min_price)
etMaxPrice?.setText(tempFilter.priceRanges?.max_price)
}
etMaxPrice?.setOnEditorActionListener(listener)
etMinPrice?.setOnEditorActionListener(listener)
etMaxPrice?.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
// 以小数点开头,前面自动加上 "0"
if (s.toString().startsWith(".")) {
etMaxPrice?.setText("0$s");
etMaxPrice?.setSelection(etMaxPrice?.text!!.length);
}
}
})
etMinPrice?.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
// 以小数点开头,前面自动加上 "0"
if (s.toString().startsWith(".")) {
etMinPrice?.setText("0$s");
etMinPrice?.setSelection(etMinPrice?.text!!.length);
}
}
})
val mWidth = (popWidth - RxImageTool.dp2px(52f)) / enquirySize
for ((index, priceRangesItem) in filterData.priceRanges.withIndex()) {
val textView = View.inflate(context, R.layout.consultant_item_filter, null) as TextView
val params = FrameLayout.LayoutParams(mWidth, RxImageTool.dp2px(48f))
val marginNum = RxImageTool.dp2px(2f)
params.setMargins(
marginNum + (RxImageTool.dp2px(10f) + mWidth) * (index % enquirySize),
RxImageTool.dp2px(58f) * (index / 3),
marginNum,
0
)
textView.layoutParams = params
val contentStr = String.format(
"%s\n%s",
priceRangesItem.display_range,
priceRangesItem.recommend_percent
)
val msp = SpannableString(contentStr)
msp.setSpan(
AbsoluteSizeSpan(10, true),
contentStr.indexOf("\n"),
contentStr.length,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
textView.text = msp
textView.setSingleLine(false)
textView.setLineSpacing(1.0f, 1.2f)
priceRangeViews.add(textView)
if (priceRangesItem == tempFilter.priceRanges) {
textView.isSelected = true
textView.paint.isFakeBoldText = true
tempFilter.priceRangesView = textView
}
textView.setOnClickListener {
if (textView != tempFilter.priceRangesView) {
tempFilter.priceRangesView?.isSelected = false
tempFilter.priceRangesView?.paint?.isFakeBoldText = false
}
if (textView.isSelected) {
tempFilter.priceRanges = null
textView.isSelected = false
textView.paint.isFakeBoldText = false
tempFilter.priceRangesView = null
etMaxPrice?.setText("")
etMinPrice?.setText("")
} else {
tempFilter.priceRanges = priceRangesItem.copy(
min_price = priceRangesItem.min_price,
max_price = priceRangesItem.max_price
)
textView.isSelected = true
textView.paint.isFakeBoldText = true
tempFilter.priceRangesView = textView
etMinPrice?.setText(priceRangesItem.min_price)
etMaxPrice?.setText(priceRangesItem.max_price)
etMinPrice?.setSelection(etMinPrice?.text!!.length)
etMaxPrice?.setSelection(etMaxPrice?.text!!.length)
}
updateCount(ConsultBIConstants.POSITION_AVERAGE_SERVICE_INPUT)
}
priceRange.flPriceRangeContainer.addView(textView)
}
view.flPriceRange.addView(priceRange)
}
private fun updatePriceFilter() {
RxKeyboardTool.hideSoftInput(context, etMaxPrice)
......
......@@ -69,22 +69,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_28"
android:text="价格"
android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<FrameLayout
android:id="@+id/flPriceRange"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
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