| | |
| | | |
| | | @Override |
| | | public int getItemViewType(int position) { |
| | | if (itemList == null || itemList.isEmpty()) { |
| | | return R.layout.item_layout; |
| | | } else { |
| | | return R.layout.item_view_linear; |
| | | } |
| | | return R.layout.item_view_linear; |
| | | //if (itemList == null || itemList.isEmpty()) { |
| | | // return R.layout.item_layout; |
| | | //} else { |
| | | // return R.layout.item_view_linear; |
| | | //} |
| | | } |
| | | @NonNull |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void onBindViewHolder(@NonNull ViewHolder holder, int position) { |
| | | if (itemList == null || itemList.isEmpty()) { |
| | | // 默认显示页面 |
| | | //return 1; |
| | | } else { |
| | | // 数据显示页面 |
| | | Item item = itemList.get(position); |
| | | holder.ip.setText("设备IP: " + item.getIp()); |
| | | holder.title.setText("设备编号: " + item.getText()); |
| | | } |
| | | Item item = itemList.get(position); |
| | | holder.ip.setText("设备IP: " + item.getIp()); |
| | | holder.title.setText("设备编号: " + item.getText()); |
| | | //if (itemList == null || itemList.isEmpty()) { |
| | | // // 默认显示页面 |
| | | // //return 1; |
| | | //} else { |
| | | // // 数据显示页面 |
| | | // Item item = itemList.get(position); |
| | | // holder.ip.setText("设备IP: " + item.getIp()); |
| | | // holder.title.setText("设备编号: " + item.getText()); |
| | | //} |
| | | } |
| | | |
| | | @Override |
| | | public int getItemCount() { |
| | | if (itemList == null || itemList.isEmpty()) { |
| | | return 1; |
| | | } else { |
| | | return itemList.size(); |
| | | } |
| | | return itemList.size(); |
| | | //if (itemList == null || itemList.isEmpty()) { |
| | | // return 1; |
| | | //} else { |
| | | // return itemList.size(); |
| | | //} |
| | | } |
| | | |
| | | public void addItem (Item item) { |