Exemplo n.º 1
0
  protected View prepareView(Spell spell, int position, View convertView, ViewGroup parent) {
    TalentViewHolder holder = (TalentViewHolder) convertView.getTag();

    holder.text1.setText(spell.getName());

    Util.setVisibility(holder.text2, false, holder.text1);
    holder.text3.setText(spell.getProbeInfo().getAttributesString());

    if (spell.getValue() != null) {
      int modifier = hero.getModifier(spell);
      Util.setText(holder.text4, spell.getValue(), modifier, null);
    } else {
      Debug.warning(spell.getName() + " has no value");
    }
    Util.setVisibility(holder.text5, false, holder.text1);

    if (holder.indicator != null) {
      if (spell.hasFlag(Spell.Flags.ZauberSpezialisierung)
          || !TextUtils.isEmpty(spell.getZauberSpezialisierung())) {
        holder.indicator.setVisibility(View.VISIBLE);
        holder.indicator.setImageBitmap(indicatorFlash);
      } else if (spell.hasFlag(Spell.Flags.ÜbernatürlicheBegabung)) {
        holder.indicator.setVisibility(View.VISIBLE);
        holder.indicator.setImageBitmap(indicatorStar);
      } else if (spell.hasFlag(Spell.Flags.Hauszauber)) {
        holder.indicator.setVisibility(View.VISIBLE);
        holder.indicator.setImageBitmap(indicatorHouseGray);
      } else if (spell.hasFlag(Spell.Flags.Begabung)) {
        holder.indicator.setVisibility(View.VISIBLE);
        holder.indicator.setImageBitmap(indicatorStarGray);
      } else {
        holder.indicator.setVisibility(View.INVISIBLE);
      }
    }
    Util.applyRowStyle(spell, convertView, position);

    return convertView;
  }
Exemplo n.º 2
0
  protected View prepareView(Art art, int position, View convertView, ViewGroup parent) {
    TalentViewHolder holder = (TalentViewHolder) convertView.getTag();

    Util.setVisibility(holder.text5, false, holder.text1);

    holder.text1.setText(art.getFullName());
    ArtInfo artInfo = art.getInfo();

    StringBuilder info = new StringBuilder();
    if (artInfo != null && !TextUtils.isEmpty(artInfo.getTarget())) {
      info.append(artInfo.getTarget());
    }
    if (artInfo != null && !TextUtils.isEmpty(artInfo.getRange())) {
      if (info.length() > 0) info.append(",");
      info.append(artInfo.getRange());
    }
    if (artInfo != null && !TextUtils.isEmpty(artInfo.getCastDuration())) {
      if (info.length() > 0) info.append(",");
      info.append(artInfo.getCastDuration());
    }

    holder.text2.setText(info);

    if (art.hasCustomProbe() && !TextUtils.isEmpty(art.getProbeInfo().getAttributesString())) {
      holder.text3.setText(art.getProbeInfo().getAttributesString());
    } else if (!TextUtils.isEmpty(artInfo.getProbe())
        && art.getProbeInfo().getAttributeTypes() == null) {
      holder.text3.setText(artInfo.getProbe());
    } else {
      if (artInfo != null && !TextUtils.isEmpty(artInfo.getEffectDuration()))
        holder.text3.setText(artInfo.getEffectDuration());
      else holder.text3.setText(null);
    }
    if (art.getProbeInfo().getErschwernis() != null) {
      holder.text4.setText(Util.toProbe(art.getProbeInfo().getErschwernis()));
      holder.text4.setVisibility(View.VISIBLE);
    } else holder.text4.setVisibility(View.INVISIBLE);

    if (holder.indicator != null) {
      if (art.hasFlag(Art.Flags.Begabung)) {
        holder.indicator.setVisibility(View.VISIBLE);
        holder.indicator.setImageBitmap(indicatorStarGray);
      } else {
        holder.indicator.setVisibility(View.INVISIBLE);
      }
    }
    Util.applyRowStyle(art, convertView, position);

    return convertView;
  }
Exemplo n.º 3
0
  protected View prepareView(Talent talent, int position, View convertView, ViewGroup parent) {
    TalentViewHolder holder = (TalentViewHolder) convertView.getTag();

    holder.text1.setText(talent.getName());

    String be = talent.getProbeInfo().getBe();

    if (TextUtils.isEmpty(be)) {
      Util.setVisibility(holder.text2, false, holder.text1);
      holder.text2.setText(null);
    } else {
      Util.setVisibility(holder.text2, true, holder.text1);
      holder.text2.setText(be);
    }
    if (talent.getComplexity() != null) {
      Util.setVisibility(holder.text2, true, holder.text1);
      if (holder.text2.length() > 0) holder.text2.append(" ");
      holder.text2.append(Util.toString(talent.getComplexity()));
    }
    holder.text3.setText(talent.getProbeInfo().getAttributesString());

    if (talent instanceof CombatMeleeTalent) {
      CombatMeleeTalent meleeTalent = (CombatMeleeTalent) talent;

      if (meleeTalent.getAttack() != null && meleeTalent.getAttack().getValue() != null) {
        int modifier = 0;
        if (filter.getSettings().isIncludeModifiers()) {
          modifier = hero.getModifier(meleeTalent.getAttack());
        }
        Util.setText(holder.text4, meleeTalent.getAttack().getValue(), modifier, null);
        holder.text4.setOnClickListener(probeListener);
        holder.text4.setOnLongClickListener(editListener);
        holder.text4.setTag(R.id.TAG_KEY_VALUE, meleeTalent);
        holder.text4.setTag(R.id.TAG_KEY_PROBE, meleeTalent.getAttack());
        Util.setVisibility(holder.text4, true, holder.text1);
      } else {
        Util.setVisibility(holder.text4, false, holder.text1);
      }

      if (meleeTalent.getDefense() != null && meleeTalent.getDefense().getValue() != null) {
        int modifier = 0;
        if (filter.getSettings().isIncludeModifiers()) {
          modifier = hero.getModifier(meleeTalent.getDefense());
        }
        Util.setText(holder.text5, meleeTalent.getDefense().getValue(), modifier, null);
        holder.text5.setOnClickListener(probeListener);
        holder.text5.setOnLongClickListener(editListener);
        holder.text5.setTag(R.id.TAG_KEY_VALUE, meleeTalent);
        holder.text5.setTag(R.id.TAG_KEY_PROBE, meleeTalent.getDefense());
        Util.setVisibility(holder.text5, true, holder.text1);
      } else {
        holder.text5.setVisibility(View.INVISIBLE);
      }

    } else if (talent instanceof CombatDistanceTalent) {

      CombatDistanceTalent distanceTalent = (CombatDistanceTalent) talent;

      if (distanceTalent.getValue() != null) {
        int modifier = 0;

        if (filter.getSettings().isIncludeModifiers()) {
          modifier = hero.getModifier(distanceTalent);
        }
        Util.setText(holder.text4, distanceTalent.getValue(), modifier, null);
        holder.text4.setOnClickListener(null);
        holder.text4.setClickable(false);
        Util.setVisibility(holder.text4, true, holder.text1);
      } else {
        Util.setVisibility(holder.text4, false, holder.text1);
      }
      Util.setVisibility(holder.text5, false, holder.text1);
    } else {
      int modifier = 0;
      if (filter.getSettings().isIncludeModifiers()) {
        modifier = hero.getModifier(talent);
      }
      Util.setText(holder.text4, talent.getValue(), modifier, null);
      holder.text4.setOnClickListener(null);
      holder.text4.setClickable(false); // hide text5 and expand text1
      // with its width
      Util.setVisibility(holder.text5, false, holder.text1);
    }

    if (holder.indicator != null) {
      if (talent.hasFlag(Talent.Flags.TalentSpezialisierung)
          || !TextUtils.isEmpty(talent.getTalentSpezialisierung())) {
        holder.indicator.setVisibility(View.VISIBLE);
        holder.indicator.setImageBitmap(indicatorFlash);
      } else if (talent.hasFlag(Flags.Meisterhandwerk)) {
        holder.indicator.setVisibility(View.VISIBLE);
        holder.indicator.setImageBitmap(indicatorHouse);
      } else if (talent.hasFlag(Flags.Talentschub)) {
        holder.indicator.setVisibility(View.VISIBLE);
        holder.indicator.setImageBitmap(indicatorStar);
      } else if (talent.hasFlag(Flags.Begabung)) {
        holder.indicator.setVisibility(View.VISIBLE);
        holder.indicator.setImageBitmap(indicatorStarGray);
      } else {
        holder.indicator.setVisibility(View.INVISIBLE);
      }
    }

    Util.applyRowStyle(talent, convertView, position);
    return convertView;
  }