Commit faaeec78 by fengquan

feat: Code Review代码调整

parent b9b56cc8
...@@ -126,7 +126,7 @@ class ConfideHomeActivity : ...@@ -126,7 +126,7 @@ class ConfideHomeActivity :
private var bottomSheetDialogFragment: ConfideBottomSheetDialogFragment? = null private var bottomSheetDialogFragment: ConfideBottomSheetDialogFragment? = null
private var keyword : String = ""; private var keyword: String = "";
init { init {
//初始化参数 //初始化参数
...@@ -253,9 +253,9 @@ class ConfideHomeActivity : ...@@ -253,9 +253,9 @@ class ConfideHomeActivity :
} }
private fun showDoctorDetail(confideId: String, doctorId: String) { private fun showDoctorDetail(confideId: String, doctorId: String) {
val url = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(confideId)+"&payPage=1" val url = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(confideId) + "&payPage=1"
ConfideBottomSheetDialogFragment() ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(this@ConfideHomeActivity, url, doctorId) .showBottomSheetDialog(this@ConfideHomeActivity, url, doctorId)
} }
override fun onResume() { override fun onResume() {
...@@ -352,10 +352,10 @@ class ConfideHomeActivity : ...@@ -352,10 +352,10 @@ class ConfideHomeActivity :
rl_search_head.setOnClickListener { rl_search_head.setOnClickListener {
var intent = Intent(this, ConfideSearchActivity::class.java) var intent = Intent(this, ConfideSearchActivity::class.java)
if (!TextUtils.isEmpty(keyword)){ if (!TextUtils.isEmpty(keyword)) {
intent.putExtra(FinalString.CONFIDE_SEARCH_KEY_WORD,keyword) intent.putExtra(FinalString.CONFIDE_SEARCH_KEY_WORD, keyword)
} }
startActivityForResult(intent,SEARCH_REQUEST_CODE) startActivityForResult(intent, SEARCH_REQUEST_CODE)
} }
} }
...@@ -427,7 +427,10 @@ class ConfideHomeActivity : ...@@ -427,7 +427,10 @@ class ConfideHomeActivity :
initParam() initParam()
hideError() hideError()
cacheList?.addAll(0, list) cacheList?.addAll(0, list)
cacheList?.add(0, ConfideHomeDataBean(IConfideHomeConfig.TYPE_SEARCH,null,null,null, -1,keyword)) cacheList?.add(
0,
ConfideHomeDataBean(IConfideHomeConfig.TYPE_SEARCH, null, null, null, -1, keyword)
)
updateAdapter() updateAdapter()
setSuspendListener() setSuspendListener()
v_filterView.refreshView() v_filterView.refreshView()
...@@ -437,7 +440,7 @@ class ConfideHomeActivity : ...@@ -437,7 +440,7 @@ class ConfideHomeActivity :
* 设置筛选模块悬浮顶部监听数据 * 设置筛选模块悬浮顶部监听数据
*/ */
private fun setSuspendListener() { private fun setSuspendListener() {
listSuspendListener?.setFilterView(v_filterView,rl_search_head, vFilterLine) listSuspendListener?.setFilterView(v_filterView, rl_search_head, vFilterLine)
listSuspendListener?.setSectionAdapter(mConfideAdapter!!) listSuspendListener?.setSectionAdapter(mConfideAdapter!!)
} }
...@@ -450,8 +453,8 @@ class ConfideHomeActivity : ...@@ -450,8 +453,8 @@ class ConfideHomeActivity :
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
if (requestCode == SEARCH_REQUEST_CODE && resultCode == RESULT_OK) { if (requestCode == SEARCH_REQUEST_CODE && resultCode == RESULT_OK) {
val keyWord = data?.getStringExtra(FinalString.CONFIDE_SEARCH_KEY_WORD) val keyWord = data?.getStringExtra(FinalString.CONFIDE_SEARCH_KEY_WORD)
if (keyWord != null){ if (keyWord != null) {
keyword = keyWord this.keyword = keyWord
page = 1 page = 1
allFiltersBean = ConfideHomeAllFiltersBean( allFiltersBean = ConfideHomeAllFiltersBean(
page, page,
...@@ -541,17 +544,25 @@ class ConfideHomeActivity : ...@@ -541,17 +544,25 @@ class ConfideHomeActivity :
} }
if (bean?.body != null && bean?.body.size == 0) { if (bean?.body != null && bean?.body.size == 0) {
var hasEmptyLayout : Boolean = false var hasEmptyLayout: Boolean = false
for (index in (0..(cacheList!!.size - 1)).reversed()) { for (index in (0..(cacheList!!.size - 1)).reversed()) {
if (cacheList!![index].type == IConfideHomeConfig.TYPE_EMPTY) { if (cacheList!![index].type == IConfideHomeConfig.TYPE_EMPTY) {
hasEmptyLayout = true hasEmptyLayout = true
break break
} }
} }
if (!hasEmptyLayout){ if (!hasEmptyLayout) {
cacheList?.add(ConfideHomeDataBean(IConfideHomeConfig.TYPE_EMPTY,null,null,null, -1)) cacheList?.add(
ConfideHomeDataBean(
IConfideHomeConfig.TYPE_EMPTY,
null,
null,
null,
-1
)
)
} }
}else{ } else {
for (index in (0..(cacheList!!.size - 1)).reversed()) { for (index in (0..(cacheList!!.size - 1)).reversed()) {
if (cacheList!![index].type == IConfideHomeConfig.TYPE_EMPTY) { if (cacheList!![index].type == IConfideHomeConfig.TYPE_EMPTY) {
cacheList!!.removeAt(index) cacheList!!.removeAt(index)
......
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