| | |
| | | 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; |
| | | |
| | |
| | | |
| | | @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); |
| | |
| | | this.mOnclickListener = onClickListener; |
| | | } |
| | | |
| | | public void setList(List<DeviceBean> newData) { |
| | | public void setList(List<CloudInverterDeviceBean> newData) { |
| | | if (this.mList == null) { |
| | | this.mList = new ArrayList<>(); |
| | | } else { |
| | |
| | | } |
| | | |
| | | public interface OnClickListener { |
| | | void onClick(int position, DeviceBean deviceBean); |
| | | void onClick(int position, CloudInverterDeviceBean deviceBean); |
| | | |
| | | } |
| | | |