#
whycq
2025-01-21 9c414520fd00319683a0021bb512f5003aff2800
app/src/main/java/com/example/agvcontroller/ItemAdapter.java
@@ -1,8 +1,5 @@
package com.example.agvcontroller;
import static androidx.core.content.ContextCompat.startActivity;
import android.content.Intent;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
@@ -17,9 +14,9 @@
public class ItemAdapter extends RecyclerView.Adapter<ItemAdapter.ViewHolder> {
    private List<Item> itemList;
    private List<AGVCar> itemList;
    public ItemAdapter(List<Item> itemList) {
    public ItemAdapter(List<AGVCar> itemList) {
        this.itemList = itemList;
    }
@@ -86,14 +83,14 @@
            // 默认显示页面
            //return 1;
        } else {
            Item item = itemList.get(position);
            AGVCar item = itemList.get(position);
            int status = item.getStatus();
            switch (status) {
                case 0:
                    holder.itemView.setBackgroundColor(Color.GRAY);
                    holder.itemView.setBackgroundColor(Color.parseColor("#D3D3D3"));
                    break;
               default:
                   holder.itemView.setBackgroundColor(Color.GREEN);
                   holder.itemView.setBackgroundColor(Color.parseColor("#90EE90"));
                   break;
            }
            holder.agvNo.setText("AGV_NO: " + item.getAgvNo());
@@ -114,7 +111,7 @@
        }
    }
    public void addItem (Item item) {
    public void addItem (AGVCar item) {
        itemList.add(item);
        notifyItemInserted(itemList.size() - 1);
    }