/* * (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; } }
@Override public void onStopTrackingTouch(SeekBar seekBar) { SeekBarEx seekBarEx = (SeekBarEx) seekBar; Attribute attribute = (Attribute) seekBar.getTag(); if (attribute != null) { attribute.setValue(seekBarEx.getValue()); } }
protected View prepareAusweichenView( Attribute attribute, int position, View convertView, ViewGroup parent) { ViewHolder holder = (ViewHolder) convertView.getTag(); holder.icon1.setOnClickListener(getProbeListener()); holder.icon1.setOnLongClickListener(getEditListener()); holder.icon1.setImageResource(R.drawable.icon_ausweichen); holder.icon1.setVisibility(View.VISIBLE); holder.icon2.setImageResource(R.drawable.icon_target); holder.icon2.setVisibility(View.VISIBLE); holder.icon2.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (ausweichenModificationDialog == null) { ausweichenModificationDialog = new EvadeChooserDialog(main); } ausweichenModificationDialog.show(); } }); StyleableSpannableStringBuilder title = new StyleableSpannableStringBuilder(); title.append(attribute.getName()); Util.appendValue( hero, title, attribute, null, getFilter() != null ? getFilter().getSettings().isIncludeModifiers() : true); holder.text1.setText(title); holder.text2.setText("Modifikator " + Util.toProbe(attribute.getProbeInfo().getErschwernis())); holder.icon1.setTag(attribute); holder.icon_chain_top.setVisibility(View.GONE); holder.icon_chain_bottom.setVisibility(View.GONE); return convertView; }
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; } }