Commit a039c65c by upwork.021

feat: 代码优化

parent de7e6896
...@@ -901,7 +901,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -901,7 +901,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showSubjectPopupWindow() showSubjectPopupWindow()
}, 300); }, 300)
} }
R.id.tvArea -> { R.id.tvArea -> {
...@@ -910,7 +910,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -910,7 +910,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showAreaPopupWindow() showAreaPopupWindow()
}, 300); }, 300)
} }
R.id.tvSort -> { R.id.tvSort -> {
...@@ -919,7 +919,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -919,7 +919,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showSortPopupWindow() showSortPopupWindow()
}, 300); }, 300)
} }
R.id.tvFilter -> { R.id.tvFilter -> {
...@@ -928,7 +928,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -928,7 +928,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showFilterPopupWindow() showFilterPopupWindow()
}, 300); }, 300)
} }
R.id.tv_guide -> { R.id.tv_guide -> {
...@@ -964,7 +964,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -964,7 +964,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//显示筛选弹窗 //显示筛选弹窗
private fun showFilterPopupWindow() { private fun showFilterPopupWindow() {
// tempFilter.searchWord = etSearch.text.toString()
tempFilter.categories.clear() tempFilter.categories.clear()
tempFilter.categories.addAll(allFilter.categories) tempFilter.categories.addAll(allFilter.categories)
tempFilter.reorder = allFilter.reorder tempFilter.reorder = allFilter.reorder
...@@ -1003,11 +1002,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1003,11 +1002,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
ConsultAssistantDialogUtils.INSTANCE.fitRequest(this, "doctor_list", true) ConsultAssistantDialogUtils.INSTANCE.fitRequest(this, "doctor_list", true)
} }
filterPopupWindow.isClippingEnabled = false filterPopupWindow.isClippingEnabled = false
filterPopupWindow.showAtLocation(viewSep2.rootView, Gravity.TOP + Gravity.RIGHT, 0, 0) filterPopupWindow.showAsDropDown(viewSep2)
ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity() ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity()
filterPopupWindow.onFilterConfirmListener = this filterPopupWindow.onFilterConfirmListener = this
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN)
// viewDim.visibility = View.VISIBLE
viewDim_filter.visibility = View.VISIBLE viewDim_filter.visibility = View.VISIBLE
} else { } else {
ToastUtil.toastShort("数据初始化失败,请重试") ToastUtil.toastShort("数据初始化失败,请重试")
...@@ -1359,12 +1357,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1359,12 +1357,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity() ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity()
categoryPopup!!.onSubjectsSelectedListener = this categoryPopup!!.onSubjectsSelectedListener = this
categoryPopup!!.showAsDropDown(viewSep2) categoryPopup!!.showAsDropDown(tvFilter)
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
viewDim.visibility = View.VISIBLE viewDim.visibility = View.VISIBLE
}else{ }else{
ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity() ConsultAssistantDialogUtils.INSTANCE.hideAssistantActivity()
categoryPopup!!.showAsDropDown(viewSep2) categoryPopup!!.showAsDropDown(tvFilter)
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
viewDim.visibility = View.VISIBLE viewDim.visibility = View.VISIBLE
} }
......
...@@ -123,10 +123,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -123,10 +123,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
YDLImageCacheManager.showImage(activity, url, imgView, width, heigh, ops) YDLImageCacheManager.showImage(activity, url, imgView, width, heigh, ops)
} }
} }
//
// override fun getStatusViewOptions(): StatusBarOptions {
// return StatusBarOptions(true,true)
// }
companion object { companion object {
const val EXTRA_CATEGORY = "category" const val EXTRA_CATEGORY = "category"
...@@ -149,20 +145,14 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -149,20 +145,14 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
private val allFilter = AllFilter() //当前筛选 private val allFilter = AllFilter() //当前筛选
private val tempFilter = AllFilter() //临时筛选,未确认状态 private val tempFilter = AllFilter() //临时筛选,未确认状态
private val doctorList = ArrayList<ExpertServiceItem>() private val doctorList = ArrayList<ExpertServiceItem>()
private val serviceList = ArrayList<ExpertServiceItem>()
private var hasMore = true private var hasMore = true
private var initCategory = "0"
private var initShowType: Int = 0 private var initShowType: Int = 0
private lateinit var doctorAdapter: ExpertSearchAdapter private lateinit var doctorAdapter: ExpertSearchAdapter
private lateinit var onScrollListener: EndlessRecyclerViewScrollListener private lateinit var onScrollListener: EndlessRecyclerViewScrollListener
private var headData: HeadData? = null //筛选数据 private var headData: HeadData? = null //筛选数据
private val props1 = JSONObject() //筛选标题埋点参数 private val props1 = JSONObject() //筛选标题埋点参数
private var fromPageType: Int = 0 //从哪个页面跳转过来的
private val fromPages = arrayOf("首页", "搜索页面", "在线专家")
private var isRecommend = false //埋点数据 private var isRecommend = false //埋点数据
private var keyWord: String? = null //埋点数据
private var isDoSearch: Boolean = false //埋点判断是否通过搜索进入埋点的 private var isDoSearch: Boolean = false //埋点判断是否通过搜索进入埋点的
// private val bannerList = ArrayList<String>()
private var hasSelectedArea = false //是否选择过地区 private var hasSelectedArea = false //是否选择过地区
private var hasSelectedSort = false //是否选择过排序 private var hasSelectedSort = false //是否选择过排序
...@@ -287,7 +277,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -287,7 +277,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} }
} }
} }
// rvExperts.addItemDecoration(ExpertItemDecoration(this))
rvExperts.addOnScrollListener(onScrollListener) rvExperts.addOnScrollListener(onScrollListener)
rvExperts.addOnScrollListener(YDLImageRecyclerOnScrollListener(activity)) rvExperts.addOnScrollListener(YDLImageRecyclerOnScrollListener(activity))
// etSearch.addTextChangedListener(object : TextWatcher { // etSearch.addTextChangedListener(object : TextWatcher {
...@@ -301,7 +290,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -301,7 +290,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
// //
// }) // })
image_scroll_top.setOnClickListener(this) image_scroll_top.setOnClickListener(this)
// initStatus()
} }
override fun setUserVisibleHint(isVisibleToUser: Boolean) { override fun setUserVisibleHint(isVisibleToUser: Boolean) {
...@@ -843,7 +831,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -843,7 +831,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showAreaPopupWindow() showAreaPopupWindow()
}, 300); }, 300)
} }
R.id.tvSort -> { R.id.tvSort -> {
...@@ -852,7 +840,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -852,7 +840,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showSortPopupWindow() showSortPopupWindow()
}, 300); }, 300)
} }
R.id.tvFilter -> { R.id.tvFilter -> {
...@@ -861,7 +849,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -861,7 +849,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
appbar_layout.setExpanded(false) appbar_layout.setExpanded(false)
appbar_layout.postDelayed({ appbar_layout.postDelayed({
showFilterPopupWindow() showFilterPopupWindow()
}, 300); }, 300)
} }
R.id.tv_guide -> { R.id.tv_guide -> {
...@@ -896,7 +884,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -896,7 +884,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//显示筛选弹窗 //显示筛选弹窗
private fun showFilterPopupWindow() { private fun showFilterPopupWindow() {
// tempFilter.searchWord = etSearch.text.toString()
tempFilter.categories.clear() tempFilter.categories.clear()
tempFilter.categories.addAll(allFilter.categories) tempFilter.categories.addAll(allFilter.categories)
tempFilter.reorder = allFilter.reorder tempFilter.reorder = allFilter.reorder
......
...@@ -119,10 +119,10 @@ class YdlHomeAdapter(private val mContext: Context, ...@@ -119,10 +119,10 @@ class YdlHomeAdapter(private val mContext: Context,
} }
override fun getItemViewType(position: Int): Int { override fun getItemViewType(position: Int): Int {
if (position < list.size) { return if (position < list.size) {
return list[position].type!! list[position].type!!
} else { } else {
return -1 -1
} }
} }
......
...@@ -295,7 +295,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm ...@@ -295,7 +295,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
val act = homeHeaderBean.activityResponse val act = homeHeaderBean.activityResponse
if (act != null) { if (act != null) {
if (!TextUtils.isEmpty(act!!.imageUrl)) { if (!TextUtils.isEmpty(act.imageUrl)) {
img_ad.visibility = View.VISIBLE img_ad.visibility = View.VISIBLE
GlideApp.with(this).load(act!!.imageUrl).into(img_ad) GlideApp.with(this).load(act!!.imageUrl).into(img_ad)
img_ad.setOnClickListener { img_ad.setOnClickListener {
......
...@@ -69,9 +69,9 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -69,9 +69,9 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
*/ */
private fun initButtonView() { private fun initButtonView() {
if (null == buttonParams) { if (null == buttonParams) {
var screenWidth = RxDeviceTool.getScreenWidth(mContext) val screenWidth = RxDeviceTool.getScreenWidth(mContext)
var viewWidth = ((screenWidth - 2 * 9 * RxDeviceTool.getScreenDensity(mContext)) / 4).toInt() val viewWidth = ((screenWidth - 2 * 9 * RxDeviceTool.getScreenDensity(mContext)) / 4).toInt()
var viewHeight = viewWidth * 78 / 80 val viewHeight = viewWidth * 78 / 80
buttonParams = LinearLayout.LayoutParams(viewWidth, viewHeight) buttonParams = LinearLayout.LayoutParams(viewWidth, viewHeight)
buttonParamsFrame = FrameLayout.LayoutParams(viewWidth, viewHeight) buttonParamsFrame = FrameLayout.LayoutParams(viewWidth, viewHeight)
buttonParamsFrame2= FrameLayout.LayoutParams((viewWidth/2.0).toInt(), (viewHeight/2.3).toInt()) buttonParamsFrame2= FrameLayout.LayoutParams((viewWidth/2.0).toInt(), (viewHeight/2.3).toInt())
......
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