wjc
2024-12-02 f50e8e60e9da99e4f69d8ab76810dc7e5fb448bc
app/src/main/java/com/hdl/photovoltaic/ui/adapter/SearchDeviceAdapter.java
@@ -12,13 +12,13 @@
import androidx.recyclerview.widget.RecyclerView;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.ui.bean.DeviceBean;
import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean;
import java.util.ArrayList;
import java.util.List;
public class SearchDeviceAdapter extends RecyclerView.Adapter<SearchDeviceAdapter.MyViewHolder> {
    List<DeviceBean> mList;
    List<CloudInverterDeviceBean> mList;
    Context mContext;
@@ -38,10 +38,10 @@
    @Override
    public void onBindViewHolder(@NonNull SearchDeviceAdapter.MyViewHolder holder, int position) {
        DeviceBean deviceBean = this.mList.get(position);
        CloudInverterDeviceBean deviceBean = this.mList.get(position);
        holder.device_search_name_tv.setText(deviceBean.getHomeNameAndDeviceName());
        holder.device_search_sn_tv.setText(deviceBean.getOsn());
        holder.device_search_sn_tv.setText("SN:"+deviceBean.getOsn());
        holder.device_search_location_tv.setText(deviceBean.getHomeAddress());
        setTextViewStyle(holder.device_search_state_tv, deviceBean.getDeviceStatus());
        holder.itemView.setTag(position);
@@ -68,7 +68,7 @@
        this.mOnclickListener = onClickListener;
    }
    public void setList(List<DeviceBean> newData) {
    public void setList(List<CloudInverterDeviceBean> newData) {
        if (this.mList == null) {
            this.mList = new ArrayList<>();
        } else {
@@ -91,16 +91,16 @@
     */
    private void setTextViewStyle(TextView textView, int state_value) {
        String text = mContext.getString(R.string.my_power_station_operation);
        Drawable drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_06b92a);
        Drawable drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_state_ff38c494);
        switch (state_value) {
            case 1: {
                text = mContext.getString(R.string.my_power_station_connecting);
                drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300);
                drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_satte_ffb300);
            }
            break;
            case 2: {
                text = mContext.getString(R.string.my_power_station_malfunction);
                drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343);
                drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_state_fff55252);
            }
            break;
            case 3: {
@@ -110,7 +110,7 @@
            break;
            case 4: {
                text = mContext.getString(R.string.my_power_station_off_line);
                drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_b9b9b9);
                drawable = AppCompatResources.getDrawable(mContext, R.drawable.device_state_ffb9b9b9);
            }
            break;
@@ -122,7 +122,7 @@
    }
    public interface OnClickListener {
        void onClick(int position, DeviceBean deviceBean);
        void onClick(int position, CloudInverterDeviceBean deviceBean);
    }