feat: 进港查询筛选弹窗改为内容区嵌入式面板

将筛选条件弹框从 XPopup DrawerPopupView 改为嵌入 Activity 内容区的滑动面板,
使筛选面板从右侧滑入时不遮挡顶部蓝色标题栏,暗色遮罩也只覆盖内容区域。
同时修复首次弹出时因布局测量时序导致的闪烁问题。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 16:54:28 +08:00
parent 3c413833cf
commit df5fa2ea74
5 changed files with 328 additions and 279 deletions

View File

@@ -1,84 +0,0 @@
package com.lukouguoji.gjj.dialog
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.lifecycle.MutableLiveData
import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.databinding.DialogIntImpQueryFilterBinding
import com.lukouguoji.module_base.base.BaseDialogModel
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.enums.PopupPosition
import dev.DevUtils
import com.lukouguoji.module_base.util.DictUtils
import dev.utils.app.info.KeyValue
/**
* 国际进港查询筛选抽屉
*/
class IntImpQueryFilterDialogModel(
val spCode: MutableLiveData<String>,
val spCodeList: MutableLiveData<List<KeyValue>>,
val flightNo: MutableLiveData<String>,
val origin: MutableLiveData<String>,
val awbType: MutableLiveData<String>,
val businessType: MutableLiveData<String>,
val goodsCn: MutableLiveData<String>,
private val onConfirm: () -> Unit
) : BaseDialogModel<DialogIntImpQueryFilterBinding>(DIALOG_TYPE_DRAWER) {
val awbTypeList = MutableLiveData<List<KeyValue>>(emptyList())
val businessTypeList = MutableLiveData<List<KeyValue>>(emptyList())
override fun layoutId() = R.layout.dialog_int_imp_query_filter
override fun onBuild(builder: XPopup.Builder) {
super.onBuild(builder)
builder.popupPosition(PopupPosition.Right)
val activity = DevUtils.getTopActivity()
val activityWidth = activity.window.decorView.width
builder.maxWidth(activityWidth / 3)
builder.popupWidth(activityWidth / 3)
}
override fun onDialogCreated(context: Context) {
binding.model = this
binding.lifecycleOwner = context as? androidx.lifecycle.LifecycleOwner
val titleColor = Color.parseColor("#666666")
binding.root.findViewById<TextView>(R.id.title_name)?.text = "筛选条件"
binding.root.findViewById<TextView>(R.id.title_name)?.setTextColor(titleColor)
binding.root.findViewById<TextView>(R.id.tool_tv_back)?.setTextColor(titleColor)
binding.root.findViewById<ImageView>(R.id.tool_iv_back)?.imageTintList = ColorStateList.valueOf(titleColor)
binding.root.findViewById<View>(R.id.toolbar)?.setBackgroundColor(Color.WHITE)
binding.root.findViewById<View>(R.id.tool_back)?.setOnClickListener {
dismiss()
}
DictUtils.getWaybillTypeList(type = "II", addAll = true, checkedValue = awbType.value) {
awbTypeList.postValue(it)
}
DictUtils.getBusinessTypeList(type = "II", addAll = true, checkedValue = businessType.value) {
businessTypeList.postValue(it)
}
}
fun onResetClick() {
spCode.value = ""
flightNo.value = ""
origin.value = ""
awbType.value = ""
businessType.value = ""
goodsCn.value = ""
}
fun onConfirmClick() {
dismiss()
onConfirm()
}
}