Commit 504ec287 by 霍志良

feat:

parent c8fa8df1
......@@ -45,14 +45,12 @@ 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.bean.*
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import com.yidianling.consultant.router.ConsultantIn
import com.yidianling.consultant.ui.view.AreaPopupWindow
import com.yidianling.consultant.ui.view.CategoryPopupWindow
import com.yidianling.consultant.ui.view.FilterPopupWindow
import com.yidianling.consultant.ui.view.SortPopupWindow
import com.yidianling.consultant.ui.view.*
import com.yidianling.consultant.ui.view.topView.RecommendListView
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -70,7 +68,7 @@ import java.util.concurrent.TimeUnit
class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPresenter>(),
View.OnClickListener, IExpertSearchView,
OnCategoriesSelectedListener, OnSortItemSelectedListener, OnFilterConfirmListener,
SwipeRefreshLayout.OnRefreshListener {
SwipeRefreshLayout.OnRefreshListener, OnPriceItemSelectedListener {
var bottomWordDisposable: Disposable? = null
private lateinit var bottomWordlist: List<FunctionWordBean>
private var searchWord: String? = ""
......@@ -1018,7 +1016,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
hideSoftInput()
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
showSortPopupWindow()
// showSortPopupWindow()
showPricePopupWindow()
}, 300)
}
......@@ -1299,6 +1298,25 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private var sortPopup: SortPopupWindow? = null
private var pricePopup: PricePopupWindow? = null
//显示价格弹窗
private fun showPricePopupWindow() {
if (headData?.reorder != null) {
pricePopup = PricePopupWindow(
this, headData?.reorder!!,
headData?.filters!!,
tempFilter, allFilter.reorder, this
)
pricePopup!!.setOnDismissListener {
}
pricePopup!!.showAsDropDown(viewSep2)
} else {
ToastUtil.toastShort("数据初始化失败,请重试")
}
}
//显示排序弹窗
private fun showSortPopupWindow() {
......@@ -1595,4 +1613,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
bottomWordDisposable?.dispose()
ConsultAssistantDialogUtils.INSTANCE.expertSearchResetStatus()
}
override fun onPriceItemSelected(sortItem: ReorderItem) {
//价格筛选回调
}
}
......@@ -44,17 +44,11 @@ import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.adapter.ExpertSearchAdapter
import com.yidianling.consultant.bean.FunctionWordConsultBean
import com.yidianling.consultant.constants.ConsultBIConstants
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.listener.*
import com.yidianling.consultant.model.bean.*
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import com.yidianling.consultant.router.ConsultantIn
import com.yidianling.consultant.ui.view.AreaPopupWindow
import com.yidianling.consultant.ui.view.CategoryPopupWindow
import com.yidianling.consultant.ui.view.FilterPopupWindow
import com.yidianling.consultant.ui.view.SortPopupWindow
import com.yidianling.consultant.ui.view.*
import com.yidianling.consultant.ui.view.topView.RecommendListView
import com.yidianling.home.api.event.HomeModuleTabEvent
import de.greenrobot.event.EventBus
......@@ -74,7 +68,7 @@ import java.util.concurrent.TimeUnit
class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPresenter>(),
View.OnClickListener, IExpertSearchView,
OnCategoriesSelectedListener, OnSortItemSelectedListener, OnFilterConfirmListener,
SwipeRefreshLayout.OnRefreshListener {
SwipeRefreshLayout.OnRefreshListener, OnPriceItemSelectedListener {
private lateinit var mContext: Context
private lateinit var mActivity: FragmentActivity
var startTime = 0L
......@@ -899,7 +893,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
hideSoftInput()
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
showSortPopupWindow()
// showSortPopupWindow()
showPricePopupWindow()
}, 300)
}
......@@ -942,6 +937,26 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
}
private var pricePopup: PricePopupWindow? = null
//显示价格弹窗
private fun showPricePopupWindow() {
if (headData?.reorder != null) {
pricePopup = PricePopupWindow(
requireContext(), headData?.reorder!!,
headData?.filters!!,
tempFilter, allFilter.reorder, this
)
pricePopup!!.setOnDismissListener {
}
pricePopup!!.showAsDropDown(viewSep2)
} else {
ToastUtil.toastShort("数据初始化失败,请重试")
}
}
//显示筛选弹窗
private fun showFilterPopupWindow() {
tempFilter.categories.clear()
......@@ -1478,4 +1493,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
bottomWordDisposable?.dispose()
ConsultAssistantDialogUtils.INSTANCE.resetStatus()
}
override fun onPriceItemSelected(sortItem: ReorderItem) {
//价格筛选回调
}
}
package com.yidianling.consultant.listener
import com.yidianling.consultant.model.bean.ReorderItem
/**
* Created by zqk on 17-9-20.
*/
interface OnPriceItemSelectedListener {
fun onPriceItemSelected(sortItem: ReorderItem)
}
\ No newline at end of file
......@@ -110,23 +110,6 @@ class FilterPopupWindow(
view.btnReset.setOnClickListener {
reset()
}
view.sb_steps_6.setOnRangeChangedListener(object : OnRangeChangedListener {
override fun onRangeChanged(
view: RangeSeekBar?,
leftValue: Float,
rightValue: Float,
isFromUser: Boolean
) {
LogUtil.e("aaaaleftValue:" + (leftValue / 100) * 600 + "rightValue:" + rightValue)
}
override fun onStartTrackingTouch(view: RangeSeekBar?, isLeft: Boolean) {
}
override fun onStopTrackingTouch(view: RangeSeekBar?, isLeft: Boolean) {
}
})
view.btnConfirm.setOnClickListener {
if (tempFilter.priceRanges?.key1 == "avg_price" && filterData.priceRanges.isNotEmpty()) {
tempFilter.priceRanges?.key1 = filterData.priceRanges[0].key1
......
package com.yidianling.consultant.ui.view
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.text.SpannableString
import android.text.Spanned
import android.text.style.AbsoluteSizeSpan
import androidx.recyclerview.widget.LinearLayoutManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.PopupWindow
import android.widget.TextView
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.R
import com.yidianling.consultant.adapter.SortRecyclerViewAdapter
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.listener.OnPriceItemSelectedListener
import com.yidianling.consultant.listener.OnSortItemSelectedListener
import com.yidianling.consultant.model.bean.AllFilter
import com.yidianling.consultant.model.bean.Filters
import com.yidianling.consultant.model.bean.ReorderItem
import kotlinx.android.synthetic.main.consultant_item_price_range.view.*
import kotlinx.android.synthetic.main.consultant_ui_filter_popup.view.*
import kotlinx.android.synthetic.main.consultant_ui_filter_popup.view.flPriceRange
import kotlinx.android.synthetic.main.consultant_ui_price_popup_window.view.*
import kotlinx.android.synthetic.main.consultant_ui_sort_popup_window.view.*
/**
* 排序弹窗
* Created by zqk on 17-9-15.
*/
class PricePopupWindow(
val context: Context, sortItems: ArrayList<ReorderItem>,
private val filterData: Filters,
private val tempFilter: AllFilter,
var selectedSort: ReorderItem, onPriceItemSelectedListener: OnPriceItemSelectedListener
) : PopupWindow(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
private val popWidth = (RxDeviceTool.getScreenWidth(context))
private val enquirySize = 4
private val priceRangeViews: ArrayList<View> = ArrayList()
private var min_Price = ""
private var max_Price = ""
init {
val view =
LayoutInflater.from(context).inflate(R.layout.consultant_ui_price_popup_window, null)
this.contentView = view
this.isFocusable = true
@Suppress("DEPRECATION")
this.setBackgroundDrawable(BitmapDrawable())
this.isOutsideTouchable = true
initPriceTag()
}
fun initPriceTag() {
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
contentView.tv_start_end_price.text = "0-无限"
} 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
if (priceRangesItem.min_price.isNullOrEmpty()) min_Price = "0"
if (priceRangesItem.max_price.isNullOrEmpty()) max_Price = "无限"
contentView.tv_start_end_price.text = "$min_Price-$max_Price"
// 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)
}
contentView.flPriceRangeView.addView(textView)
}
}
}
\ No newline at end of file
......@@ -185,27 +185,6 @@
</ScrollView>
<com.yidianling.consultant.ui.view.rangeseekbar.RangeSeekBar
android:id="@+id/sb_steps_6"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:rsb_gravity="bottom"
app:rsb_mode="range"
app:rsb_progress_color="@color/platform_main_theme"
app:rsb_step_auto_bonding="false"
app:rsb_step_color="@color/platform_gray7"
app:rsb_step_height="5dp"
app:rsb_step_width="1dp"
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">
</com.yidianling.consultant.ui.view.rangeseekbar.RangeSeekBar>
<LinearLayout
android:layout_width="match_parent"
......
<?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:paddingStart="@dimen/platform_dp_12"
android:paddingTop="@dimen/platform_dp_15"
android:paddingEnd="@dimen/platform_dp_12">
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="价格"
android:textColor="@color/platform_color_black_333333"
android:textStyle="bold"
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="200-500"
app:layout_constraintBottom_toBottomOf="@id/tv_price"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_price" />
<com.yidianling.consultant.ui.view.rangeseekbar.RangeSeekBar
android:id="@+id/range_price_seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_15"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_price"
app:rsb_gravity="bottom"
app:rsb_mode="range"
app:rsb_progress_color="@color/platform_main_theme"
app:rsb_step_auto_bonding="false"
app:rsb_step_color="@color/platform_gray7"
app:rsb_step_height="5dp"
app:rsb_step_width="1dp"
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" />
<FrameLayout
android:id="@+id/flPriceRangeView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="50dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/range_price_seekbar" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment