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.bean.MsgReceivePool
|
||||
|
||||
/**
|
||||
* 国际进港电报解析列表项ViewHolder
|
||||
*/
|
||||
class IntImpMsgParseViewHolder(view: View) :
|
||||
BaseViewHolder<MsgReceivePool, ItemIntImpMsgParseBinding>(view) {
|
||||
|
||||
@@ -17,15 +14,12 @@ class IntImpMsgParseViewHolder(view: View) :
|
||||
binding.position = position
|
||||
binding.executePendingBindings()
|
||||
|
||||
// 添加卡片点击事件 - 查看详情
|
||||
notifyItemClick(position, binding.cardView)
|
||||
// 卡片点击 - 查看详情
|
||||
notifyItemClick(position, binding.llContent)
|
||||
|
||||
// 添加选择图标点击事件 - 切换选择状态
|
||||
// 选择框点击 - 切换选择状态
|
||||
binding.ivCheck.setOnClickListener {
|
||||
// 反转checked状态
|
||||
bean.checked.set(!bean.checked.get())
|
||||
|
||||
// 立即更新UI
|
||||
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"?>
|
||||
<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">
|
||||
|
||||
<data>
|
||||
@@ -16,159 +15,172 @@
|
||||
type="Integer" />
|
||||
</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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp">
|
||||
android:layout_marginHorizontal="5dp"
|
||||
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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- 选择图标 -->
|
||||
<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"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_toRightOf="@id/iv_check"
|
||||
android:text="@{`报文类型 ` + bean.msgType}"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<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:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="报文类型 FFM" />
|
||||
android:textSize="15sp"
|
||||
tools:text="FFM" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 状态标签 -->
|
||||
<TextView
|
||||
android:id="@+id/tv_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@{bean.isGenerated() ? @drawable/bg_status_success : @drawable/bg_status_error}"
|
||||
android:paddingHorizontal="8dp"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:text="@{bean.getStatusLabel()}"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12sp"
|
||||
tools:text="已生成" />
|
||||
android:textSize="13sp"
|
||||
tools:text="未生成" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- 收报时间 -->
|
||||
<!-- 第二行:收报时间 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="收报时间"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="14sp" />
|
||||
android:textColor="@color/text_gray_l"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="@{bean.receiveTime}"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="14sp"
|
||||
android:textSize="15sp"
|
||||
tools:text="2025-08-27 12:22:34" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 报文内容 -->
|
||||
<!-- 第三行:报文内容 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="报文内容"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="14sp" />
|
||||
android:textColor="@color/text_gray_l"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="4"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:maxLines="6"
|
||||
android:text="@{bean.teleContent}"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="13sp"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="15sp"
|
||||
tools:text="ZCZC DFA0156 270443 QK\nHFEFI8X.\nSELFMKE 270443 FFM/4\n1/KE135/\n27AUG/ICN/HL8348 HFE/NIL\nLAST" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 查看详情按钮 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 分隔线 -->
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/line" />
|
||||
|
||||
<!-- 底部操作栏:圆形选择框 + 查看详情 + 箭头 -->
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:paddingHorizontal="16dp">
|
||||
|
||||
<!-- 左侧:选择框 + 查看详情 -->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:src="@drawable/ic_arrow_right"
|
||||
app:tint="@color/colorPrimary" />
|
||||
android:id="@+id/iv_check"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
loadImage="@{bean.checked.get() ? @drawable/bg_circle_checked : @drawable/bg_circle_unchecked}" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="查看详情"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</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>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user