style: 調整出貨清單 UI 的文字顏色與出貨中狀態格式
- 將商品名稱、順序(槽位號)與已出貨數量資訊的文字顏色改為黑色(@color/black) - 將出貨中狀態的格式「出貨中(1)」改為「出貨中(1件)」
This commit is contained in:
parent
f2ed393686
commit
d1bf7d18ce
@ -1,12 +1,13 @@
|
||||
package com.unibuy.smartdevice.ui.recycler;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.unibuy.smartdevice.R;
|
||||
@ -83,29 +84,31 @@ public class RecyclerDialogDispatchListAdpter extends RecyclerView.Adapter<Recyc
|
||||
|
||||
int price = machinePrice > 0? machinePrice: sellingPrice;
|
||||
|
||||
holder.binding.textCount.setText(String.valueOf(count));
|
||||
holder.binding.textQuantity.setText(String.valueOf(quantity));
|
||||
holder.binding.textCount.setText(String.format("已出貨數量(%d / %d)", count, quantity));
|
||||
|
||||
logs.info("isShipped:" + dispatchProduct.isShipped());
|
||||
|
||||
if (dispatchProduct.getCount() == dispatchProduct.getQuantity()) {
|
||||
holder.binding.textDispatchStatus.setText(context.getString(R.string.shipped));//已出貨
|
||||
holder.binding.textDispatchStatus.setTextColor(Color.RED);
|
||||
holder.binding.textDispatchStatus.setTextColor(ContextCompat.getColor(context, R.color.onSuccess));
|
||||
holder.binding.textDispatchStatus.setBackground(createTagBackground(R.color.success));
|
||||
} else if (dispatchProduct.isShipped()) {
|
||||
try {
|
||||
if (SlotField.getSlotField(dispatchProduct.getField()).isCanOneShipped()) {
|
||||
holder.binding.textDispatchStatus.setText(context.getString(R.string.shipping)+"("+(count+1)+")");//出貨中
|
||||
holder.binding.textDispatchStatus.setText(context.getString(R.string.shipping)+"("+(count+1)+"件)");//出貨中
|
||||
} else {
|
||||
holder.binding.textDispatchStatus.setText(context.getString(R.string.shipping)+"(All)");//出貨中
|
||||
}
|
||||
} catch (LogsEmptyException e) {
|
||||
holder.binding.textDispatchStatus.setText(context.getString(R.string.shipping)+"("+(count+1)+")");//出貨中
|
||||
holder.binding.textDispatchStatus.setText(context.getString(R.string.shipping)+"("+(count+1)+"件)");//出貨中
|
||||
}
|
||||
|
||||
holder.binding.textDispatchStatus.setTextColor(Color.RED);
|
||||
holder.binding.textDispatchStatus.setTextColor(ContextCompat.getColor(context, R.color.onPrimary));
|
||||
holder.binding.textDispatchStatus.setBackground(createTagBackground(R.color.primary));
|
||||
} else {
|
||||
holder.binding.textDispatchStatus.setText(context.getString(R.string.waiting));//等待中
|
||||
holder.binding.textDispatchStatus.setTextColor(Color.BLACK);
|
||||
holder.binding.textDispatchStatus.setTextColor(ContextCompat.getColor(context, R.color.black));
|
||||
holder.binding.textDispatchStatus.setBackground(createTagBackground(R.color.gray));
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,6 +124,14 @@ public class RecyclerDialogDispatchListAdpter extends RecyclerView.Adapter<Recyc
|
||||
delProductData(position);
|
||||
}
|
||||
}
|
||||
/** 建立圓角標籤背景 */
|
||||
private GradientDrawable createTagBackground(int colorResId) {
|
||||
GradientDrawable drawable = new GradientDrawable();
|
||||
drawable.setColor(ContextCompat.getColor(context, colorResId));
|
||||
drawable.setCornerRadius(context.getResources().getDisplayMetrics().density * 20);
|
||||
return drawable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dispatchList.size();
|
||||
|
||||
@ -1,136 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.google.android.material.card.MaterialCardView 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingBottom="1dp"
|
||||
>
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
app:cardBackgroundColor="@color/cardSurface"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="70dp"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="1dp"
|
||||
android:paddingBottom="1dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textSlot"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="0.3"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageProductPicture"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/default_product" />
|
||||
|
||||
<!-- 商品名稱 + 出貨狀況標籤(垂直排列) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:background="@color/white"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textSlot"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="0.3"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageProductPicture"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/default_product"
|
||||
app:layout_constraintDimensionRatio="16:9" />
|
||||
</RelativeLayout>
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textProductName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="3"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:text="@string/product_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textCount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="right|center"
|
||||
android:text="0"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:text="/"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textQuantity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="left|center"
|
||||
android:text="0"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textDelete"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@string/delete"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="1dp"
|
||||
android:background="@color/white"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textDispatchStatus"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:gravity="center"
|
||||
android:layout_weight="2"
|
||||
android:layout_marginTop="4dp"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:text="@string/shipping_status"
|
||||
android:textSize="24sp"/>
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textCount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.5"
|
||||
android:gravity="center"
|
||||
android:text="已出貨數量(0 / 0)"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textDelete"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@string/delete"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
Loading…
Reference in New Issue
Block a user