예제 #1
0
  protected View prepareView(Modificator item, int position, View convertView, ViewGroup parent) {
    ModifierViewHolder holder = (ModifierViewHolder) convertView.getTag();

    if (item instanceof AbstractModificator) {
      AbstractModificator modificator = (AbstractModificator) item;
      holder.active.setVisibility(View.VISIBLE);
      holder.active.setChecked(modificator.isActive());
      holder.active.setClickable(false);
      holder.active.setFocusable(false);
      holder.active.setTag(modificator);
    } else {
      holder.active.setVisibility(View.GONE);
    }

    holder.flip.setBackgroundResource(0);
    holder.flip.setScaleType(ScaleType.CENTER);
    if (item instanceof WoundModificator) {
      if (item.isActive()) holder.flip.setImageResource(R.drawable.icon_wound_selected);
      else holder.flip.setImageResource(R.drawable.icon_wound_normal);
    } else if (item instanceof RulesModificator) {
      holder.flip.setImageResource(Util.getThemeResourceId(getContext(), R.attr.imgSettings));
    } else if (item instanceof CustomModificator) {
      holder.flip.setImageResource(Util.getThemeResourceId(getContext(), R.attr.imgModifier));
    }

    if (item != null) {
      holder.text1.setText(item.getModificatorName());
      holder.text2.setText(item.getModificatorInfo());
    } else {
      holder.text1.setText(null);
      holder.text2.setText(null);
    }

    return convertView;
  }
예제 #2
0
  protected View prepareView(NotesItem e, int position, View convertView, ViewGroup parent) {
    EventViewHolder holder = (EventViewHolder) convertView.getTag();

    if (e.getCategory() != null) {

      if (holder.flip != null) {
        holder.flip.setImageResource(e.getCategory().getDrawableId());
      }

      if (holder.icon2 != null) {
        if (e instanceof Event) {
          if (((Event) e).getAudioPath() != null) {
            holder.icon2.setVisibility(View.VISIBLE);
            holder.icon2.setImageResource(
                Util.getThemeResourceId(getContext(), R.attr.imgActionMicrophone));
          } else {
            holder.icon2.setVisibility(View.GONE);
          }
        } else {
          holder.icon2.setVisibility(View.GONE);
        }
      }
    }

    if (e.getCategory().hasName() && !TextUtils.isEmpty(e.getName())) {
      holder.text1.setText(e.getName().trim());
      holder.text2.setText(e.getComment().trim());
      holder.text2.setVisibility(View.VISIBLE);
    } else {
      holder.text1.setText(e.getComment().trim());
      holder.text2.setVisibility(View.GONE);
    }

    holder.text3.setText(e.getCategory().name());

    return convertView;
  }