refactor: 优化国际进港电报解析列表项UI对齐设计稿
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,6 @@ import com.lukouguoji.gjj.databinding.ItemIntImpMsgParseBinding
|
|||||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
import com.lukouguoji.module_base.bean.MsgReceivePool
|
import com.lukouguoji.module_base.bean.MsgReceivePool
|
||||||
|
|
||||||
/**
|
|
||||||
* 国际进港电报解析列表项ViewHolder
|
|
||||||
*/
|
|
||||||
class IntImpMsgParseViewHolder(view: View) :
|
class IntImpMsgParseViewHolder(view: View) :
|
||||||
BaseViewHolder<MsgReceivePool, ItemIntImpMsgParseBinding>(view) {
|
BaseViewHolder<MsgReceivePool, ItemIntImpMsgParseBinding>(view) {
|
||||||
|
|
||||||
@@ -17,15 +14,12 @@ class IntImpMsgParseViewHolder(view: View) :
|
|||||||
binding.position = position
|
binding.position = position
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
|
|
||||||
// 添加卡片点击事件 - 查看详情
|
// 卡片点击 - 查看详情
|
||||||
notifyItemClick(position, binding.cardView)
|
notifyItemClick(position, binding.llContent)
|
||||||
|
|
||||||
// 添加选择图标点击事件 - 切换选择状态
|
// 选择框点击 - 切换选择状态
|
||||||
binding.ivCheck.setOnClickListener {
|
binding.ivCheck.setOnClickListener {
|
||||||
// 反转checked状态
|
|
||||||
bean.checked.set(!bean.checked.get())
|
bean.checked.set(!bean.checked.get())
|
||||||
|
|
||||||
// 立即更新UI
|
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
module_gjj/src/main/res/drawable/bg_circle_checked.xml
Normal file
18
module_gjj/src/main/res/drawable/bg_circle_checked.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="20dp"
|
||||||
|
android:height="20dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<!-- 蓝色圆形背景 -->
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/colorPrimary"
|
||||||
|
android:pathData="M12,12m-11,0a11,11 0,1 1,22 0a11,11 0,1 1,-22 0" />
|
||||||
|
<!-- 白色勾 -->
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/transparent"
|
||||||
|
android:strokeColor="#FFFFFF"
|
||||||
|
android:strokeWidth="2.5"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="M7,12.5L10.5,16L17,8.5" />
|
||||||
|
</vector>
|
||||||
11
module_gjj/src/main/res/drawable/bg_circle_unchecked.xml
Normal file
11
module_gjj/src/main/res/drawable/bg_circle_unchecked.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<stroke
|
||||||
|
android:width="1.5dp"
|
||||||
|
android:color="#CCCCCC" />
|
||||||
|
<solid android:color="@android:color/transparent" />
|
||||||
|
<size
|
||||||
|
android:width="20dp"
|
||||||
|
android:height="20dp" />
|
||||||
|
</shape>
|
||||||
6
module_gjj/src/main/res/drawable/bg_status_error.xml
Normal file
6
module_gjj/src/main/res/drawable/bg_status_error.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#E57373" />
|
||||||
|
<corners android:radius="100dp" />
|
||||||
|
</shape>
|
||||||
6
module_gjj/src/main/res/drawable/bg_status_success.xml
Normal file
6
module_gjj/src/main/res/drawable/bg_status_success.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#4CAF50" />
|
||||||
|
<corners android:radius="100dp" />
|
||||||
|
</shape>
|
||||||
13
module_gjj/src/main/res/drawable/ic_chevron_right.xml
Normal file
13
module_gjj/src/main/res/drawable/ic_chevron_right.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="20dp"
|
||||||
|
android:height="20dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/transparent"
|
||||||
|
android:strokeColor="#CCCCCC"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:pathData="M9,6L15,12L9,18" />
|
||||||
|
</vector>
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
@@ -16,159 +15,172 @@
|
|||||||
type="Integer" />
|
type="Integer" />
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:id="@+id/cardView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
app:cardBackgroundColor="@android:color/white"
|
|
||||||
app:cardCornerRadius="8dp"
|
|
||||||
app:cardElevation="2dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:layout_marginHorizontal="5dp"
|
||||||
android:padding="12dp">
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="@drawable/bg_white_radius_8"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<!-- 顶部:选择图标 + 报文类型 + 状态标签 -->
|
<!-- 上部内容区 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:paddingBottom="12dp">
|
||||||
|
|
||||||
|
<!-- 第一行:报文类型 + 状态标签 -->
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<!-- 选择图标 -->
|
<LinearLayout
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_check"
|
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="24dp"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
loadImage="@{bean.checked.get() ? @drawable/img_plane_s : @drawable/img_plane}"
|
|
||||||
android:src="@drawable/img_plane"
|
|
||||||
tools:src="@drawable/img_plane" />
|
|
||||||
|
|
||||||
<!-- 报文类型标题 -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_msg_type"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginLeft="10dp"
|
android:orientation="horizontal">
|
||||||
android:layout_toRightOf="@id/iv_check"
|
|
||||||
android:text="@{`报文类型 ` + bean.msgType}"
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="报文类型"
|
||||||
|
android:textColor="@color/text_gray_l"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:text="@{bean.msgType}"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="16sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
tools:text="FFM" />
|
||||||
tools:text="报文类型 FFM" />
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 状态标签 -->
|
<!-- 状态标签 -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_status"
|
android:id="@+id/tv_status"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:background="@{bean.isGenerated() ? @drawable/bg_status_success : @drawable/bg_status_error}"
|
android:background="@{bean.isGenerated() ? @drawable/bg_status_success : @drawable/bg_status_error}"
|
||||||
android:paddingHorizontal="8dp"
|
android:paddingHorizontal="12dp"
|
||||||
android:paddingVertical="4dp"
|
android:paddingVertical="4dp"
|
||||||
android:text="@{bean.getStatusLabel()}"
|
android:text="@{bean.getStatusLabel()}"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="12sp"
|
android:textSize="13sp"
|
||||||
tools:text="已生成" />
|
tools:text="未生成" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<!-- 收报时间 -->
|
<!-- 第二行:收报时间 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="12dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="收报时间"
|
android:text="收报时间"
|
||||||
android:textColor="@color/text_normal"
|
android:textColor="@color/text_gray_l"
|
||||||
android:textSize="14sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_marginStart="16dp"
|
||||||
android:text="@{bean.receiveTime}"
|
android:text="@{bean.receiveTime}"
|
||||||
android:textColor="@color/text_normal"
|
android:textColor="@color/text_normal"
|
||||||
android:textSize="14sp"
|
android:textSize="15sp"
|
||||||
tools:text="2025-08-27 12:22:34" />
|
tools:text="2025-08-27 12:22:34" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 报文内容 -->
|
<!-- 第三行:报文内容 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="12dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="报文内容"
|
android:text="报文内容"
|
||||||
android:textColor="@color/text_normal"
|
android:textColor="@color/text_gray_l"
|
||||||
android:textSize="14sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="4"
|
android:lineSpacingExtra="3dp"
|
||||||
|
android:maxLines="6"
|
||||||
android:text="@{bean.teleContent}"
|
android:text="@{bean.teleContent}"
|
||||||
android:textColor="@color/text_gray"
|
android:textColor="@color/text_normal"
|
||||||
android:textSize="13sp"
|
android:textSize="15sp"
|
||||||
tools:text="ZCZC DFA0156 270443 QK\nHFEFI8X.\nSELFMKE 270443 FFM/4\n1/KE135/\n27AUG/ICN/HL8348 HFE/NIL\nLAST" />
|
tools:text="ZCZC DFA0156 270443 QK\nHFEFI8X.\nSELFMKE 270443 FFM/4\n1/KE135/\n27AUG/ICN/HL8348 HFE/NIL\nLAST" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 查看详情按钮 -->
|
</LinearLayout>
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
|
<!-- 分隔线 -->
|
||||||
<View
|
<View
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="1dp"
|
||||||
android:layout_weight="1" />
|
android:background="@color/line" />
|
||||||
|
|
||||||
|
<!-- 底部操作栏:圆形选择框 + 查看详情 + 箭头 -->
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:paddingHorizontal="16dp">
|
||||||
|
|
||||||
|
<!-- 左侧:选择框 + 查看详情 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="16dp"
|
android:id="@+id/iv_check"
|
||||||
android:layout_height="16dp"
|
android:layout_width="20dp"
|
||||||
android:src="@drawable/ic_arrow_right"
|
android:layout_height="20dp"
|
||||||
app:tint="@color/colorPrimary" />
|
loadImage="@{bean.checked.get() ? @drawable/bg_circle_checked : @drawable/bg_circle_unchecked}" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="4dp"
|
android:layout_marginStart="10dp"
|
||||||
android:text="查看详情"
|
android:text="查看详情"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/text_gray"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
<!-- 右侧箭头 -->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_arrow"
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:src="@drawable/ic_chevron_right" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user