コード例 #1
0
 /*
  * (non-Javadoc)
  *
  * @see android.widget.BaseAdapter#getItemViewType(int)
  */
 @Override
 public int getItemViewType(int position) {
   Listable item = getItem(position);
   if (item instanceof EquippedItem) {
     EquippedItem equippedItem = (EquippedItem) item;
     if (equippedItem.getItemSpecification() instanceof Armor) return ITEM_TYPE_VIEW;
     else return ITEM_TYPE_EDIT;
   } else if (item instanceof Attribute) {
     Attribute attribute = (Attribute) item;
     if (attribute.getType() == AttributeType.Ausweichen) {
       return ITEM_TYPE_EDIT;
     } else {
       return ITEM_TYPE_SEEK;
     }
   } else if (item instanceof Talent) {
     if (item instanceof CombatMeleeTalent) return ITEM_TYPE_COMBAT_TALENT;
     else return ITEM_TYPE_SIMPLE_TALENT;
   } else if (item instanceof Spell) {
     return ITEM_TYPE_SIMPLE_TALENT;
   } else if (item instanceof Art) {
     return ITEM_TYPE_SIMPLE_TALENT;
   } else if (item instanceof Modificator) {
     return ITEM_TYPE_MODIFIER;
   } else if (item instanceof HeaderListItem) {
     return ITEM_TYPE_HEADER;
   } else if (item instanceof FileListable) {
     return ITEM_TYPE_NOTES;
   } else if (item instanceof NotesItem) {
     return ITEM_TYPE_NOTES;
   } else if (item instanceof PurseListable) {
     return ITEM_TYPE_PURSE;
   } else {
     return IGNORE_ITEM_VIEW_TYPE;
   }
 }
コード例 #2
0
  protected View prepareView(
      Attribute attribute, int position, View convertView, ViewGroup parent) {
    if (attribute.getType() == AttributeType.Ausweichen) {
      return prepareAusweichenView(attribute, position, convertView, parent);
    } else {
      SeekViewHolder viewHolder = (SeekViewHolder) convertView.getTag();

      viewHolder.seek.setMax(attribute.getMaximum());
      viewHolder.seek.setMin(attribute.getMinimum());
      viewHolder.seek.setValue(attribute.getValue());
      viewHolder.seek.setLabel(viewHolder.value);
      viewHolder.seek.setTag(attribute);
      viewHolder.seek.setOnSeekBarChangeListener(this);

      viewHolder.text.setText(attribute.getType().code());
      Util.setLabel(viewHolder.text, attribute.getType(), probeListener, editListener);

      Util.setValue(hero, viewHolder.value, attribute, null, false, probeListener, editListener);

      return convertView;
    }
  }