zoo_app/app/src/main/java/com/example/jhalloran/zoo/ui/manager/ZooItemCustomAdapter.java
@Override
  public void onBindViewHolder(ZooItemViewHolder viewHolder, final int position) {
    Object item = zoo.getAnyItemById(dataSet.get(position));
    viewHolder.getTextView().setText(item.toString());
    TextView hintView = viewHolder.getHintView();
    // Adds "unassigned" warning for animals and pens.
    if (item instanceof Animal) {
      Animal animal = (Animal) item;
      if (!animal.isAssigned()) {
        hintView.setText(R.string.unassigned);
      } else {
        hintView.setText("");
      }
      return;
    }
    if (item instanceof Enclosable) {
      Enclosable pen = (Enclosable) item;
      if (!pen.isAssigned()) {
        hintView.setText(R.string.unassigned);
      } else {
        hintView.setText("");
      }
    }
  }
// Binds model data to the zoo.
Binds model data to the zoo.
Binds model data to the zoo .
@Override
  public void onBindViewHolder(ZooItemViewHolder viewHolder, final int position) {
    Object item = zoo.getAnyItemById(dataSet.get(position));
    viewHolder.getTextView().setText(item.toString());
    TextView hintView = viewHolder.getHintView();
    if (item instanceof Animal) {
      Animal animal = (Animal) item;
      if (!animal.isAssigned()) {
        hintView.setText(R.string.unassigned);
      } else {
        hintView.setText("");
      }
      return;
    }
    if (item instanceof Enclosable) {
      Enclosable pen = (Enclosable) item;
      if (!pen.isAssigned()) {
        hintView.setText(R.string.unassigned);
      } else {
        hintView.setText("");
      }
    }
  }
@ Override public void onBindViewHolder ( ZooItemViewHolder viewHolder , final int position ) { Object item = zoo . getAnyItemById ( dataSet . get ( position ) ) ; viewHolder . getTextView ( ) . setText ( item . toString ( ) ) ; TextView hintView = viewHolder . getHintView ( ) ; if ( item instanceof Animal ) { Animal animal = ( Animal ) item ; if ( ! animal . isAssigned ( ) ) { hintView . setText ( R . string . unassigned ) ; } else { hintView . setText ( "" ) ; } return ; } if ( item instanceof Enclosable ) { Enclosable pen = ( Enclosable ) item ; if ( ! pen . isAssigned ( ) ) { hintView . setText ( R . string . unassigned ) ; } else { hintView . setText ( "" ) ; } } }
Binds model data to the zoo.
Binds model data to the zoo .
// Adds "unassigned" warning for animals and pens.