refactor(ui): 将搜索框清空职责从getDishList移至调用方,修复下拉刷新误清输入框问题
This commit is contained in:
@@ -105,9 +105,7 @@ class CookingModeActivity : BaseActivity() {
|
|||||||
else -> "1"
|
else -> "1"
|
||||||
}
|
}
|
||||||
// 切换餐次时清空搜索框,避免用户误以为列表是被过滤的状态
|
// 切换餐次时清空搜索框,避免用户误以为列表是被过滤的状态
|
||||||
isClearingByTabSwitch = true
|
clearSearchText()
|
||||||
binding.etInputDish.text?.clear()
|
|
||||||
isClearingByTabSwitch = false
|
|
||||||
loadFragment()
|
loadFragment()
|
||||||
}
|
}
|
||||||
binding.etInputDish.addOnActionSearchListener {
|
binding.etInputDish.addOnActionSearchListener {
|
||||||
@@ -174,6 +172,7 @@ class CookingModeActivity : BaseActivity() {
|
|||||||
val isCooking = intent?.getBooleanExtra(IS_COOKING, false) ?: false
|
val isCooking = intent?.getBooleanExtra(IS_COOKING, false) ?: false
|
||||||
val lastDinnerType = intent?.getStringExtra(DINNER_TYPE) ?: "0"
|
val lastDinnerType = intent?.getStringExtra(DINNER_TYPE) ?: "0"
|
||||||
if (lastDinnerType == "1" || lastDinnerType == "2" || lastDinnerType == "3") {
|
if (lastDinnerType == "1" || lastDinnerType == "2" || lastDinnerType == "3") {
|
||||||
|
clearSearchText()
|
||||||
fragmentList[lastDinnerType.toInt() - 1].getDishList(1, lastDinnerType)
|
fragmentList[lastDinnerType.toInt() - 1].getDishList(1, lastDinnerType)
|
||||||
}
|
}
|
||||||
when (lastDinnerType) {
|
when (lastDinnerType) {
|
||||||
|
|||||||
@@ -194,10 +194,6 @@ class FoodListFragment : BaseFragment<FragmentFoodListBinding>() {
|
|||||||
)
|
)
|
||||||
foodName?.let { param["foodName"] = it }
|
foodName?.let { param["foodName"] = it }
|
||||||
if (pageNo == 1) {
|
if (pageNo == 1) {
|
||||||
//解决回调页面刷新本地数据时,输入框内容还显示的问题
|
|
||||||
if (foodName.isNullOrBlank()) {
|
|
||||||
activity.clearSearchText()
|
|
||||||
}
|
|
||||||
pendingLocalList = activity.appViewModel.getCookFoodListDirect(
|
pendingLocalList = activity.appViewModel.getCookFoodListDirect(
|
||||||
cookMode = 0,
|
cookMode = 0,
|
||||||
dinnerType = dinnerType
|
dinnerType = dinnerType
|
||||||
|
|||||||
Reference in New Issue
Block a user