style(ui): 优化界面布局和颜色配置
- 修改 RecyclerView 高度设置以改进布局 - 更新颜色值,移除 alpha 通道简化颜色定义 - 重构调味配置界面布局,提升视觉效果 - 调整项目条目样式,包括文字颜色和字体粗细 - 更新分割线为 Material Divider 组件 - 统一调整文本颜色和大小以增强可读性 - 优化调味网格适配器中的文字颜色显示 - 调整布局间距和尺寸参数以改善界面美观 - 优化重量数据显示,增加小数位数控制功能
This commit is contained in:
@@ -103,8 +103,9 @@ class Seasoning18GridAdapter(
|
||||
holder.b.root.setBackgroundResource(R.drawable.shape_scale_cell)
|
||||
val normal = ContextCompat.getColor(holder.b.root.context, R.color.home_title)
|
||||
val sub = ContextCompat.getColor(holder.b.root.context, R.color.home_sub_title)
|
||||
val black = ContextCompat.getColor(holder.b.root.context, R.color.black)
|
||||
holder.b.tvAddress.setTextColor(sub)
|
||||
holder.b.tvName.setTextColor(sub)
|
||||
holder.b.tvName.setTextColor(black)
|
||||
holder.b.tvWeight.setTextColor(normal)
|
||||
holder.b.tvState.setTextColor(sub)
|
||||
}
|
||||
|
||||
@@ -109,8 +109,9 @@ class Seasoning22GridAdapter(
|
||||
holder.b.root.setBackgroundResource(R.drawable.shape_scale_cell)
|
||||
val normal = ContextCompat.getColor(holder.b.root.context, R.color.home_title)
|
||||
val sub = ContextCompat.getColor(holder.b.root.context, R.color.home_sub_title)
|
||||
val black = ContextCompat.getColor(holder.b.root.context, R.color.black)
|
||||
holder.b.tvAddress.setTextColor(sub)
|
||||
holder.b.tvName.setTextColor(sub)
|
||||
holder.b.tvName.setTextColor(black)
|
||||
holder.b.tvWeight.setTextColor(normal)
|
||||
holder.b.tvState.setTextColor(sub)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.ViewGroup
|
||||
import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||
import com.shuwei.dish.match.databinding.ItemSeasoningWeightBinding
|
||||
import com.shuwei.dish.match.utils.ext.roundedDecimalPlace
|
||||
|
||||
/**
|
||||
* 调料使用重量列表 Adapter
|
||||
@@ -50,7 +51,8 @@ class SeasoningWeightAdapter : BaseQuickAdapter<SeasoningWeightAdapter.Item, Sea
|
||||
override fun onBindViewHolder(holder: VH, position: Int, item: Item?) {
|
||||
item ?: return
|
||||
holder.binding.tvSeasoningName.text = item.goodsName
|
||||
holder.binding.tvSeasoningWeight.text = "${item.useWeight}g"
|
||||
val showWeight = "${item.useWeight.roundedDecimalPlace(1)}g"
|
||||
holder.binding.tvSeasoningWeight.text = showWeight
|
||||
}
|
||||
|
||||
inner class VH(var binding: ItemSeasoningWeightBinding) : QuickViewHolder(binding.root)
|
||||
|
||||
@@ -40,6 +40,8 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
||||
|
||||
/** 高亮自动恢复时间(毫秒) */
|
||||
private const val HIGHLIGHT_DURATION_MS = 5_000L
|
||||
|
||||
private const val RV_LEFT_RIGHT_SPACE = 10
|
||||
}
|
||||
|
||||
override fun inflateBinding(
|
||||
@@ -54,7 +56,7 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
||||
private val adapter18 by lazy {
|
||||
Seasoning18GridAdapter(
|
||||
showNameOnly = true,
|
||||
leftRightSpace = 20.dp
|
||||
leftRightSpace = 1.dp * RV_LEFT_RIGHT_SPACE
|
||||
)
|
||||
}
|
||||
|
||||
@@ -245,7 +247,7 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
||||
// }
|
||||
|
||||
|
||||
private val size by lazy { SizeTool.getFlexLayoutSize(20.dp) }
|
||||
private val size by lazy { SizeTool.getFlexLayoutSize(1.dp * RV_LEFT_RIGHT_SPACE) }
|
||||
|
||||
/** 构建上层(22格)Adapter,需要先计算格子尺寸 */
|
||||
private fun buildAdapter22(): Seasoning22GridAdapter {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!-- 秤格子背景:白色底 + 灰色描边 + 圆角,与页面蓝色背景形成对比 -->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#FFFFFF" />
|
||||
<solid android:color="@color/white" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/gray_d6" />
|
||||
|
||||
@@ -45,8 +45,7 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvCollectedFood"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
tools:itemCount="5"
|
||||
tools:listitem="@layout/list_item_collected_food" />
|
||||
|
||||
@@ -1,103 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg_color"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="5dp"
|
||||
tools:background="@color/bg_color">
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="点击分格配置调料"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="上层调料区"
|
||||
android:textColor="@color/home_title"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvTop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/shape_white_30_corners"
|
||||
android:orientation="vertical">
|
||||
android:overScrollMode="never" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="106dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:background="@drawable/bg_bottom_line">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="下层调料区"
|
||||
android:textColor="@color/home_title"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="调料区设置"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvBottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="点击分格配置调料"
|
||||
android:textColor="@color/gray_b4"
|
||||
android:textSize="28sp" />
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="油盆配置区"
|
||||
android:textColor="@color/home_title"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:text="上层调料区"
|
||||
android:textColor="@color/home_title"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/tvOilSlot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/shape_scale_cell"
|
||||
android:clipToOutline="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:text="-"
|
||||
android:textColor="@color/home_title"
|
||||
android:textSize="28sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvTop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:text="下层调料区"
|
||||
android:textColor="@color/home_title"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvBottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:text="油盆配置区"
|
||||
android:textColor="@color/home_title"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvOilSlot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/shape_scale_cell"
|
||||
android:gravity="center"
|
||||
android:text="-"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:clipToOutline="true"
|
||||
android:textColor="@color/home_title"
|
||||
android:textSize="28sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginHorizontal="4dp"
|
||||
android:layout_marginVertical="4dp"
|
||||
android:background="@drawable/shape_scale_cell"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/shape_scale_cell"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:layout_marginHorizontal="4dp"
|
||||
android:layout_marginVertical="4dp">
|
||||
android:paddingHorizontal="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSeasoningName"
|
||||
@@ -16,15 +17,19 @@
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/black666"
|
||||
android:textSize="24sp" />
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="土豆丝" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSeasoningWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp" />
|
||||
android:textColor="@color/dish_green"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="100g" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
@@ -11,7 +12,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="32dp"
|
||||
android:paddingVertical="24dp">
|
||||
|
||||
<!-- 食材名称和采集数量 -->
|
||||
@@ -19,6 +19,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="64dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
@@ -43,18 +44,19 @@
|
||||
<!-- 删除按钮 -->
|
||||
<ImageView
|
||||
android:id="@+id/ivDelete"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:padding="25dp"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="110dp"
|
||||
android:padding="32dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:src="@drawable/ic_close_red"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 分割线 -->
|
||||
<View
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginHorizontal="32dp"
|
||||
android:background="#FFE8EDF2" />
|
||||
android:layout_marginHorizontal="64dp"
|
||||
app:dividerColor="#FFE8EDF2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/home_sub_title" />
|
||||
android:textColor="@color/black"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvWeight"
|
||||
@@ -33,8 +34,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/home_title"
|
||||
android:textStyle="bold" />
|
||||
android:textColor="@color/home_title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvState"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
android:id="@+id/tvScaleLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/home_sub_title"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
tools:text="秤 1" />
|
||||
|
||||
@@ -26,8 +26,9 @@
|
||||
android:id="@+id/tvName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/home_sub_title"
|
||||
android:textSize="22sp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
android:text="-" />
|
||||
|
||||
<!-- 重量 -->
|
||||
@@ -37,8 +38,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/home_title"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="22sp"
|
||||
tools:text="235.5 g" />
|
||||
|
||||
<!-- 状态 -->
|
||||
|
||||
@@ -51,17 +51,17 @@
|
||||
android:id="@+id/tvName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="22sp"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
android:includeFontPadding="false"
|
||||
android:textColor="@color/home_sub_title"
|
||||
android:textColor="@color/black"
|
||||
android:text="-" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="22sp"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:textColor="@color/home_title"
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="black">#000000</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
|
||||
<color name="bg_color">#F0F5FF</color>
|
||||
<color name="home_title">#FF000A2D</color>
|
||||
|
||||
Reference in New Issue
Block a user