@Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder;

      if (convertView == null) {
        // inflate item layout
        LayoutInflater inflater =
            (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.item_exercise, parent, false);

        // initialize view holder
        holder = new ViewHolder();
        holder.thumbnail = (ImageView) convertView.findViewById(R.id.thumbnail);
        holder.description = (TextView) convertView.findViewById(R.id.description);
        holder.description.setTypeface(AndroidUtils.robotoRegular(getContext()));
        holder.minsValue = (TextView) convertView.findViewById(R.id.mins_value);
        holder.repsValue = (TextView) convertView.findViewById(R.id.reps_value);
        holder.setsValue = (TextView) convertView.findViewById(R.id.sets_value);
        convertView.setTag(holder);
      } else {
        // recycle view
        holder = (ViewHolder) convertView.getTag();
      }

      // update item view
      Exercise listItem = getItem(position);
      holder.description.setText(listItem.getDescription());
      holder.minsValue.setText(Utils.zeroPaddedNumber(listItem.getMinutes(), 2));
      holder.repsValue.setText(Utils.zeroPaddedNumber(listItem.getRepetitions(), 2));
      holder.setsValue.setText(Utils.zeroPaddedNumber(listItem.getSets(), 2));

      return convertView;
    }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_exercise, container, false);

    // set custom typeface on header text
    Typeface robotoRegular = AndroidUtils.robotoRegular(getActivity());
    TextView routineName = (TextView) view.findViewById(R.id.routine_name);
    routineName.setTypeface(robotoRegular);
    TextView routineDirections = (TextView) view.findViewById(R.id.routine_directions);
    routineDirections.setTypeface(robotoRegular);

    return view;
  }
예제 #3
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View row;
    if (convertView == null) {
      LayoutInflater menuInflator =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      row = menuInflator.inflate(R.layout.menu_row, parent, false);
    } else {
      row = convertView;
    }

    TextView rowText = (TextView) row.findViewById(R.id.row_text);
    rowText.setText(menuItemsTitles[position]);
    rowText.setTypeface(AndroidUtils.robotoRegular(context));

    return row;
  }