Commit a039c65c by upwork.021

feat: 代码优化

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