feat: opt ui

This commit is contained in:
2026-03-18 20:54:13 +08:00
parent c2b5e74156
commit aac2c860c6
8 changed files with 43 additions and 22 deletions

View File

@@ -124,11 +124,12 @@ class XxxViewModel : BasePageViewModel() {
<LinearLayout orientation="vertical"> <LinearLayout orientation="vertical">
<include layout="@layout/title_tool_bar" /> <include layout="@layout/title_tool_bar" />
<!-- 搜索区PadSearchLayout 横排 --> <!-- 搜索区PadSearchLayout 横排 + 操作按钮(如有) -->
<LinearLayout orientation="horizontal"> <LinearLayout orientation="horizontal">
<PadSearchLayout type="@{SearchLayoutType.DATE}" value="@={viewModel.flightDate}" /> <PadSearchLayout type="@{SearchLayoutType.DATE}" value="@={viewModel.flightDate}" />
<PadSearchLayout type="@{SearchLayoutType.INPUT}" value="@={viewModel.flightNo}" /> <PadSearchLayout type="@{SearchLayoutType.INPUT}" value="@={viewModel.flightNo}" />
<ImageView style="@style/iv_search_action" android:onClick="@{()-> viewModel.searchClick()}" /> <ImageView style="@style/iv_search_action" android:onClick="@{()-> viewModel.searchClick()}" />
<!-- 如需新增/删除按钮,尺寸规范见「开发原则」工具栏图标尺寸规范 -->
</LinearLayout> </LinearLayout>
<!-- 分页列表 --> <!-- 分页列表 -->
@@ -842,6 +843,7 @@ companion object {
- 标题栏统一用 `title_tool_bar` — 禁止手动编写 Toolbar - 标题栏统一用 `title_tool_bar` — 禁止手动编写 Toolbar
- 优先使用 PadDataLayoutNew 和 PadSearchLayout 组件 - 优先使用 PadDataLayoutNew 和 PadSearchLayout 组件
- 在每个页面布局时,如有截图,务必尽可能还原图片上的页面设计,而不是推测假想。如有困难一律要询问,禁止自己想象 - 在每个页面布局时,如有截图,务必尽可能还原图片上的页面设计,而不是推测假想。如有困难一律要询问,禁止自己想象
- 工具栏图标尺寸规范: `img_search` 36dp + padding 2dp`img_add` 40dp 无 padding使用 `drawable/img_add.xml` 矢量图,`drawable-xhdpi/img_add.png` 已废弃删除)
- 常用资源: `bg_white_radius_8``colorPrimary``text_normal``text_gray``color_bottom_layout` - 常用资源: `bg_white_radius_8``colorPrimary``text_normal``text_gray``color_bottom_layout`
### 环境配置 ### 环境配置

View File

@@ -100,11 +100,10 @@
<!-- 添加按钮 --> <!-- 添加按钮 -->
<ImageView <ImageView
android:layout_width="36dp" android:layout_width="40dp"
android:layout_height="36dp" android:layout_height="40dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:onClick="@{()-> viewModel.addClick()}" android:onClick="@{()-> viewModel.addClick()}"
android:padding="4dp"
android:src="@drawable/img_add" /> android:src="@drawable/img_add" />
</LinearLayout> </LinearLayout>

View File

@@ -104,11 +104,10 @@
<!-- 添加按钮 --> <!-- 添加按钮 -->
<ImageView <ImageView
android:layout_width="36dp" android:layout_width="40dp"
android:layout_height="36dp" android:layout_height="40dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:onClick="@{()-> viewModel.addClick()}" android:onClick="@{()-> viewModel.addClick()}"
android:padding="4dp"
android:src="@drawable/img_add" /> android:src="@drawable/img_add" />
</LinearLayout> </LinearLayout>

View File

@@ -97,11 +97,10 @@
<!--<><E696B0><EFBFBD>按钮 --> <!--<><E696B0><EFBFBD>按钮 -->
<ImageView <ImageView
android:layout_width="36dp" android:layout_width="40dp"
android:layout_height="36dp" android:layout_height="40dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:onClick="@{()-> viewModel.onAddClick()}" android:onClick="@{()-> viewModel.onAddClick()}"
android:padding="4dp"
android:src="@drawable/img_add" /> android:src="@drawable/img_add" />
<!-- 删除按钮 --> <!-- 删除按钮 -->

View File

@@ -99,11 +99,10 @@
android:src="@drawable/img_search" /> android:src="@drawable/img_search" />
<ImageView <ImageView
android:layout_width="36dp" android:layout_width="40dp"
android:layout_height="36dp" android:layout_height="40dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:onClick="@{()-> viewModel.addClick()}" android:onClick="@{()-> viewModel.addClick()}"
android:padding="4dp"
android:src="@drawable/img_add" /> android:src="@drawable/img_add" />
<ImageView <ImageView

View File

@@ -109,11 +109,10 @@
<!-- 新增按钮 --> <!-- 新增按钮 -->
<ImageView <ImageView
android:layout_width="36dp" android:layout_width="40dp"
android:layout_height="36dp" android:layout_height="40dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:onClick="@{()-> viewModel.onAddClick()}" android:onClick="@{()-> viewModel.onAddClick()}"
android:padding="4dp"
android:src="@drawable/img_add" /> android:src="@drawable/img_add" />
<!-- 删除按钮 --> <!-- 删除按钮 -->

View File

@@ -20,7 +20,8 @@ class HbQueryListViewModel : BasePageViewModel() {
val date = MutableLiveData(DateUtils.getCurrentTime().formatDate()) val date = MutableLiveData(DateUtils.getCurrentTime().formatDate())
val fNo = MutableLiveData("") val fNo = MutableLiveData("")
val range = MutableLiveData("") val dep = MutableLiveData("") // 始发站
val dest = MutableLiveData("") // 目的站
val addressType = MutableLiveData("") val addressType = MutableLiveData("")
val serviceType = MutableLiveData("") val serviceType = MutableLiveData("")
@@ -59,7 +60,7 @@ class HbQueryListViewModel : BasePageViewModel() {
"limit" to pageModel.limit, "limit" to pageModel.limit,
"fdate" to date.value, "fdate" to date.value,
"fno" to fNo.value, "fno" to fNo.value,
"range" to range.value, "range" to buildRange(),
"countryType" to addressType.value, "countryType" to addressType.value,
"serviceType" to serviceType.value, "serviceType" to serviceType.value,
).toRequestBody() ).toRequestBody()
@@ -72,6 +73,13 @@ class HbQueryListViewModel : BasePageViewModel() {
} }
} }
private fun buildRange(): String? {
val d = dep.value?.trim()
val a = dest.value?.trim()
if (d.isNullOrEmpty() && a.isNullOrEmpty()) return null
return "${d ?: ""}-${a ?: ""}"
}
override fun onItemClick(position: Int, type: Int) { override fun onItemClick(position: Int, type: Int) {
val bean = pageModel.rv!!.commonAdapter()!!.getItem(position) as FlightBean val bean = pageModel.rv!!.commonAdapter()!!.getItem(position) as FlightBean
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_FLIGHT_QUERY_DETAILS) ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_FLIGHT_QUERY_DETAILS)

View File

@@ -46,13 +46,29 @@
android:layout_weight="1" /> android:layout_weight="1" />
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
hint='@{"请输入航程"}' hint='@{"始发站"}'
setTextAllCaps="@{true}" setTextAllCaps="@{true}"
type="@{SearchLayoutType.INPUT}" type="@{SearchLayoutType.INPUT}"
value="@={viewModel.range}" value="@={viewModel.dep}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="0.6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="-"
android:textSize="16sp" />
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
hint='@{"目的站"}'
setTextAllCaps="@{true}"
type="@{SearchLayoutType.INPUT}"
value="@={viewModel.dest}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6" />
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
hint='@{"请选择地区类型"}' hint='@{"请选择地区类型"}'
@@ -127,7 +143,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text='@{"合计:"+viewModel.count+"条"}' android:text='@{"合计"+viewModel.count+"条"}'
android:textColor="@color/bottom_tool_tips_text_color" android:textColor="@color/bottom_tool_tips_text_color"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"