style: 優化後台貨道清單介面佈局與狀態顯示

- 狀態辨識度提升:
  1. 貨道編號新增「貨道」前綴字樣。
  2. 販售與停售狀態加入顏色識別,文字與 Switch 顏色會根據狀態動態切換(成功色/警告色)。
- 佈局與操作體驗優化:
  1. 重新排列操作區塊,將「清空貨道」按鈕移至卡片最下方。
  2. 放大庫存加減按鈕的觸控範圍(高度調整為 60dp)與字體大小,提升機台觸控體驗。
  3. 「清空貨道」按鈕改用 warning 警示色系。
- 視覺微調:移除卡片外框線,使列表視覺更為乾淨。
This commit is contained in:
TaiwanStar Developer 2026-06-09 16:14:36 +08:00
parent b1732987ce
commit 4d7717edc3
2 changed files with 38 additions and 33 deletions

View File

@ -64,7 +64,7 @@ public class RecyclerVmcSlotListAdpter extends RecyclerView.Adapter<RecyclerVmcS
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
SlotStructure slot = slotList.get(position);
holder.binding.textSlot.setText(String.valueOf(slot.getSlot()));
holder.binding.textSlot.setText("貨道" + slot.getSlot());
String productID = slot.getProduct().getProductID();
if (!productID.isEmpty() && !productID.equals("?")) {
holder.binding.textProductName.setText(slot.getProduct().getProductName());
@ -79,10 +79,16 @@ public class RecyclerVmcSlotListAdpter extends RecyclerView.Adapter<RecyclerVmcS
if (slot.isLock()) {
holder.binding.textLock.setChecked(false);
holder.binding.textLockStatus.setText("停售中");
holder.binding.textLockStatus.setTextColor(androidx.core.content.ContextCompat.getColor(context, R.color.warning));
holder.binding.textLock.setThumbTintList(android.content.res.ColorStateList.valueOf(androidx.core.content.ContextCompat.getColor(context, R.color.warning)));
holder.binding.textLock.setTrackTintList(android.content.res.ColorStateList.valueOf(androidx.core.graphics.ColorUtils.setAlphaComponent(androidx.core.content.ContextCompat.getColor(context, R.color.warning), 77)));
holder.binding.viewProductMask.setVisibility(View.VISIBLE);
} else {
holder.binding.textLock.setChecked(true);
holder.binding.textLockStatus.setText("販售中");
holder.binding.textLockStatus.setTextColor(androidx.core.content.ContextCompat.getColor(context, R.color.success));
holder.binding.textLock.setThumbTintList(android.content.res.ColorStateList.valueOf(androidx.core.content.ContextCompat.getColor(context, R.color.success)));
holder.binding.textLock.setTrackTintList(android.content.res.ColorStateList.valueOf(androidx.core.graphics.ColorUtils.setAlphaComponent(androidx.core.content.ContextCompat.getColor(context, R.color.success), 77)));
holder.binding.viewProductMask.setVisibility(View.GONE);
}
holder.binding.textLock.setOnClickListener(new textLockOnClickListener(position));

View File

@ -8,8 +8,7 @@
app:cardCornerRadius="8dp"
app:cardElevation="3dp"
app:cardBackgroundColor="@color/cardSurface"
app:strokeColor="@color/outline"
app:strokeWidth="1dp">
app:strokeWidth="0dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -22,9 +21,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="18sp"
android:textSize="15sp"
android:textStyle="bold"
android:text="1"
android:text="貨道1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/layoutLock" />
@ -43,7 +42,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:textSize="12sp"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="@color/black"
android:text="販售中" />
@ -103,41 +102,22 @@
app:layout_constraintTop_toBottomOf="@id/imageProduct"
android:layout_marginTop="0dp" />
<!-- 第四列:按鈕 -->
<LinearLayout
android:id="@+id/layoutButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@+id/textProductName">
<com.google.android.material.button.MaterialButton
android:id="@+id/textDelete"
style="@style/Widget.MaterialComponents.Button"
app:backgroundTint="@color/error"
android:textColor="@color/onError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="清空貨道" />
</LinearLayout>
<!-- 第五列:庫存數量控制列 - Minus -->
<!-- 第四列:庫存數量控制列 - Minus -->
<com.google.android.material.button.MaterialButton
android:id="@+id/buttonCountMinus"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginTop="10dp"
android:layout_height="60dp"
android:layout_marginTop="0dp"
android:text=""
android:textSize="24sp"
android:paddingHorizontal="0dp"
android:textSize="30sp"
app:backgroundTint="@color/background"
android:textColor="@color/primary"
app:layout_constraintTop_toBottomOf="@id/layoutButtons"
app:layout_constraintTop_toBottomOf="@+id/textProductName"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/textCount" />
<!-- 第五列:庫存數量控制列 - Count -->
<!-- 庫存數量控制列 - Count -->
<TextView
android:id="@+id/textCount"
android:layout_width="0dp"
@ -172,12 +152,12 @@
app:layout_constraintStart_toEndOf="@+id/buttonCountMinus"
app:layout_constraintEnd_toStartOf="@+id/buttonCountPlus" />
<!-- 第五列:庫存數量控制列 - Plus -->
<!-- 庫存數量控制列 - Plus -->
<com.google.android.material.button.MaterialButton
android:id="@+id/buttonCountPlus"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_height="60dp"
android:text="+"
android:textSize="24sp"
android:paddingHorizontal="0dp"
@ -188,6 +168,25 @@
app:layout_constraintStart_toEndOf="@+id/textCount"
app:layout_constraintEnd_toEndOf="parent" />
<!-- 第五列:按鈕 -->
<LinearLayout
android:id="@+id/layoutButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
app:layout_constraintTop_toBottomOf="@+id/buttonCountMinus">
<com.google.android.material.button.MaterialButton
android:id="@+id/textDelete"
style="@style/Widget.MaterialComponents.Button"
app:backgroundTint="@color/warning"
android:textColor="@color/onWarning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="清空貨道" />
</LinearLayout>
<!-- 隱藏元件,保留避免崩潰 -->
<Button
android:id="@+id/buttonRestocking"