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

    if (row == null) {
      row = inflater.inflate(R.layout.item_project, parent, false);

      holder = new ViewHolder();
      if (row != null) {
        holder.image = (ImageView) row.findViewById(R.id.projectImage);
        holder.title = (TextView) row.findViewById(R.id.txt_project_title);
        holder.description = (TextView) row.findViewById(R.id.txt_project_description);
        holder.likes = (TextView) row.findViewById(R.id.txt_project_likes);
        row.setTag(holder);
      }
    } else {
      holder = (ViewHolder) row.getTag();
    }

    Project item = getItem(position);
    holder.title.setText(item.getTitle());
    holder.description.setText(item.getDescription());
    holder.likes.setText(String.format("%d", item.getLikes()));

    AQuery itemAq = aq.recycle(row);
    if (item.getPicture().length() > 0) itemAq.id(holder.image).image(item.getPicture());

    return row;
  }
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    itemPosition = position;
    if (convertView == null) {
      convertView = myInflater.inflate(R.layout.main, null);

      holder = new ViewHolder();
      holder.text = (TextView) convertView.findViewById(R.id.list_text);
      holder.description = (TextView) convertView.findViewById(R.id.description_text);

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.text.setPadding(20, 8, 0, 0);
    holder.description.setPadding(20, 40, 0, 0);

    holder.text.setText(mixListView.getDataSourceMenu().get(position));
    holder.description.setText(mixListView.getDataSourceDescription().get(position));

    int colorPos = position % bgcolors.length;
    convertView.setBackgroundColor(bgcolors[colorPos]);
    holder.text.setTextColor(textcolors[colorPos]);
    holder.description.setTextColor(descriptioncolors[colorPos]);

    return convertView;
  }
    @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;
    }
예제 #4
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // ViewHolder will buffer the assess to the individual fields of the row
    // layout

    ViewHolder holder;
    // Recycle existing view if passed as parameter
    // This will save memory and time on Android
    // This only works if the base layout for all classes are the same
    View rowView = convertView;
    if (rowView == null) {
      LayoutInflater inflater = context.getLayoutInflater();
      rowView = inflater.inflate(R.layout.detours_list_item, null, true);
      holder = new ViewHolder();
      holder.description = (TextView) rowView.findViewById(R.id.SD_description);
      holder.routes = (TextView) rowView.findViewById(R.id.SD_routes);
      rowView.setTag(holder);
    } else {
      holder = (ViewHolder) rowView.getTag();
    }

    holder.routes.setText(items.get(position).getRoutes());
    holder.description.setText(items.get(position).getDesc());

    return rowView;
  }
예제 #5
0
  public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View view;
    final ViewHolder holder = new ViewHolder();

    if (!mIsList) {
      view = mInflater.inflate(R.layout.application_boxed, parent, false);
    } else {
      view = mInflater.inflate(R.layout.application_list, parent, false);
      holder.description = (TextView) view.findViewById(R.id.description);
      holder.icon = (ImageView) view.findViewById(R.id.icon);
    }

    holder.name = (TextView) view.findViewById(R.id.name);

    holder.idIndex = cursor.getColumnIndexOrThrow(LiveFolders._ID);
    holder.nameIndex = cursor.getColumnIndexOrThrow(LiveFolders.NAME);
    holder.descriptionIndex = cursor.getColumnIndex(LiveFolders.DESCRIPTION);
    holder.intentIndex = cursor.getColumnIndex(LiveFolders.INTENT);
    holder.iconBitmapIndex = cursor.getColumnIndex(LiveFolders.ICON_BITMAP);
    holder.iconResourceIndex = cursor.getColumnIndex(LiveFolders.ICON_RESOURCE);
    holder.iconPackageIndex = cursor.getColumnIndex(LiveFolders.ICON_PACKAGE);

    view.setTag(holder);

    return view;
  }
예제 #6
0
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder holder = null;
   if (convertView == null) {
     convertView = LayoutInflater.from(mContext).inflate(R.layout.recommend_item, null);
     holder = new ViewHolder();
     holder.title = (TextView) convertView.findViewById(R.id.recommend_item_title);
     holder.title_line = (ImageView) convertView.findViewById(R.id.recommend_item_title_line);
     holder.icon = (ImageView) convertView.findViewById(R.id.recommend_item_icon);
     holder.name = (TextView) convertView.findViewById(R.id.recommend_item_name);
     holder.description = (TextView) convertView.findViewById(R.id.recommend_item_description);
     convertView.setTag(holder);
   } else {
     holder = (ViewHolder) convertView.getTag();
   }
   RecommendResult result = mResults.get(position);
   if (mIsOfficial) {
     holder.description.setVisibility(View.GONE);
     if (result.isTitle()) {
       holder.title.setVisibility(View.VISIBLE);
       holder.title_line.setVisibility(View.VISIBLE);
       holder.title.setText(result.getTitleName());
     } else {
       holder.title.setVisibility(View.GONE);
       holder.title_line.setVisibility(View.GONE);
     }
   } else {
     holder.description.setVisibility(View.VISIBLE);
     holder.title.setVisibility(View.GONE);
     holder.title_line.setVisibility(View.GONE);
     holder.description.setText(result.getDescription());
   }
   holder.icon.setImageBitmap(mKXApplication.getRecommend(result.getIcon()));
   holder.name.setText(result.getName());
   return convertView;
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    View view;
    if (convertView == null) {
      view = mInflater.inflate(mViewId, null, false);
      holder = new ViewHolder();
      holder.icon = (ImageView) view.findViewById(android.R.id.icon);
      holder.description = (TextView) view.findViewById(android.R.id.text1);
      view.setTag(holder);
    } else {
      view = convertView;
      holder = (ViewHolder) view.getTag();
    }

    CountryCode e = mData.get(position);

    StringBuilder text =
        new StringBuilder(3)
            .append('+')
            .append(e.countryCode)
            .append(" (")
            .append(e.regionName)
            .append(')');

    holder.description.setText(text);

    int flagId = getFlag(e.regionCode);
    if (flagId > 0) holder.icon.setImageResource(flagId);
    else holder.icon.setImageDrawable(null);

    return view;
  }
예제 #8
0
 @Override
 public View newView(Context context, Cursor cursor, ViewGroup parent) {
   View view = LayoutInflater.from(context).inflate(R.layout.list_item_hashtags, parent, false);
   ViewHolder holder = new ViewHolder();
   assert view != null;
   holder.name = (TextView) view.findViewById(R.id.name);
   holder.description = (ImageButton) view.findViewById(R.id.description);
   view.setTag(holder);
   return view;
 }
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      final ViewHolder viewHolder;
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

      if (convertView == null) {
        viewHolder = new ViewHolder();
        convertView = inflater.inflate(R.layout.listviewadaptor, null);
        viewHolder.title = (TextView) convertView.findViewById(R.id.textTitleOfTask);
        viewHolder.description = (TextView) convertView.findViewById(R.id.textDescription);
        viewHolder.importanceRating =
            (RatingBar) convertView.findViewById(R.id.listItemRatingImporatnce);
        viewHolder.isCompleted = (CheckBox) convertView.findViewById(R.id.checkWorkCompleted);
        viewHolder.date = (TextView) convertView.findViewById(R.id.lastDate);
        viewHolder.deleteItem = (ImageView) convertView.findViewById(R.id.deleteItem);
        convertView.setTag(viewHolder);

      } else {
        viewHolder = (ViewHolder) convertView.getTag();
      }
      viewHolder.title.setText(tasks.get(position).getTaskTitle());
      int a =
          tasks.get(position).isCompleted()
              ? viewHolder.title.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG
              : 0;
      viewHolder.title.setPaintFlags(a);
      //////////////////////////////////////////////////////////////////
      viewHolder.date.setText("Last Date: \n" + tasks.get(position).getTaskDate());
      viewHolder.deleteItem.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              //  onclick.
              onDeleteClicked(position);
            }
          });
      //////////////////////////////////////////////////////////////////
      viewHolder.isCompleted.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              //  onclick.
              onClickCheckbox(position, tasks.get(position).isCompleted());
            }
          });
      viewHolder.description.setText(tasks.get(position).getTaskDescription());
      viewHolder.importanceRating.setProgress(tasks.get(position).getImportanceStarRating() * 2);
      viewHolder.isCompleted.setChecked(tasks.get(position).isCompleted());
      return convertView;
    }
    public View getView(int position, View convertView, ViewGroup parent) {

      ViewHolder holder;
      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.title_and_description_cell, null);
        holder = new ViewHolder();
        holder.text = (TextView) convertView.findViewById(R.id.title);
        holder.description = (TextView) convertView.findViewById(R.id.description);
        convertView.setTag(holder);
      } else {

        holder = (ViewHolder) convertView.getTag();
      }
      holder.text.setText(((IntentObject) intentsArray.get(position)).title);
      holder.description.setText(((IntentObject) intentsArray.get(position)).description);
      return convertView;
    }
예제 #11
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder holder;
   if (convertView == null) {
     holder = new ViewHolder();
     convertView = (View) inflater.inflate(R.layout.recipe_list_item, parent, false);
     holder.recipe_name = (TextView) convertView.findViewById(R.id.recipe_name);
     holder.description = (TextView) convertView.findViewById(R.id.description);
     convertView.setTag(holder);
   } else holder = (ViewHolder) convertView.getTag();
   RecipeInfo recipeInfo = (RecipeInfo) getItem(position);
   if (recipeInfoList != null && recipeInfoList.size() > 0) {
     holder.recipe_name.setText(String.valueOf(recipeInfo.getName()));
     holder.description.setText(recipeInfo.getDescription());
   }
   return convertView;
 }
예제 #12
0
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      View view = convertView;
      final ViewHolder holder;
      if (convertView == null) {
        view = LayoutInflater.from(context).inflate(R.layout.timeline_item, parent, false);
        holder = new ViewHolder();
        holder.location = (TextView) view.findViewById(R.id.tv_location);
        holder.time = (TextView) view.findViewById(R.id.tv_time);
        holder.description = (TextView) view.findViewById(R.id.tv_desc);
        holder.image = (ImageView) view.findViewById(R.id.iv_coverimg);
        view.setTag(holder);
      } else {
        holder = (ViewHolder) view.getTag();
      }
      final IndexModel model = data.get(position);
      holder.location.setText(model.location);
      Handler handler =
          new Handler() {

            @Override
            public void handleMessage(Message msg) {
              // TODO Auto-generated method stub
              super.handleMessage(msg);
              imageLoader.displayImage(
                  (String) msg.obj, holder.image, options, animateFirstListener);
            }
          };
      Hack.downloadPhoto(activity, model.coverImgUrl, handler);
      holder.image.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              // TODO Auto-generated method stub
              Intent intent = new Intent(activity, WaterfallActivity.class);
              intent.putExtra("galleryid", model.galleryID);
              activity.startActivity(intent);
            }
          });
      holder.time.setText(model.timeStart + "-" + model.timeEnd);
      holder.description.setText(model.galleryID);
      return view;
    }
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   final ViewHolder holder;
   if (inflater == null)
     inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   if (convertView == null) {
     convertView = inflater.inflate(R.layout.customlist_item, null);
     holder = new ViewHolder();
     holder.title = (TextView) convertView.findViewById(R.id.title);
     holder.description = (TextView) convertView.findViewById(R.id.description);
     convertView.setTag(holder);
   } else {
     holder = (ViewHolder) convertView.getTag();
   }
   Item item = items.get(position);
   holder.title.setText(item.getTitle());
   holder.description.setText(item.getDescription());
   return convertView;
 }
예제 #14
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    ViewHolder holder = null;

    if (view == null) {
      view = context.getLayoutInflater().inflate(R.layout.program_list_widget, null);
      holder = new ViewHolder();
      holder.title = (TextView) view.findViewById(R.id.title);
      holder.state = (ImageView) view.findViewById(R.id.state);
      holder.time = (TextView) view.findViewById(R.id.time);
      holder.date = (TextView) view.findViewById(R.id.date);
      holder.duration = (TextView) view.findViewById(R.id.duration);
      holder.progress = (TextView) view.findViewById(R.id.progress);
      holder.seriesInfo = (TextView) view.findViewById(R.id.series_info);
      holder.contentType = (TextView) view.findViewById(R.id.content_type);
      holder.summary = (TextView) view.findViewById(R.id.summary);
      holder.description = (TextView) view.findViewById(R.id.description);
      holder.genre = (TextView) view.findViewById(R.id.genre);
      view.setTag(holder);
    } else {
      holder = (ViewHolder) view.getTag();
    }

    // Get the program and assign all the values
    Program p = getItem(position);
    if (p != null) {
      holder.title.setText(p.title);
      Utils.setState(holder.state, p.recording);
      Utils.setDate(holder.date, p.start);
      Utils.setTime(holder.time, p.start, p.stop);
      Utils.setDuration(holder.duration, p.start, p.stop);
      Utils.setProgressText(holder.progress, p.start, p.stop);
      Utils.setDescription(null, holder.summary, p.summary);
      Utils.setDescription(null, holder.description, p.description);
      Utils.setContentType(null, holder.contentType, p.contentType);
      Utils.setSeriesInfo(null, holder.seriesInfo, p.seriesInfo);
      Utils.setGenreColor(context, holder.genre, p, TAG);
    }
    return view;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    ViewHolder viewHolder;

    if (v == null) {
      LayoutInflater inflater =
          (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      v = inflater.inflate(R.layout.list_item_photo_gallery, null, false);

      viewHolder = new ViewHolder();
      if (v != null) {
        viewHolder.thumbnail = (NetworkImageView) v.findViewById(R.id.thumbnail);
        viewHolder.description = (TextView) v.findViewById(R.id.description);
        v.setTag(viewHolder);
      }
    } else {
      viewHolder = (ViewHolder) v.getTag();
    }

    Result result = mOriginalList.get(position);

    viewHolder.thumbnail.setDefaultImageResId(android.R.drawable.ic_menu_gallery);
    viewHolder.thumbnail.setErrorImageResId(android.R.drawable.ic_menu_delete);

    if (result != null) {
      if (Constants.USER_NETWORK_IMAGE_VIEWS) {
        viewHolder.thumbnail.setImageUrl(result.tbUrl, VolleyApp.getImageLoader());
      } else {
        requestImage(viewHolder.thumbnail, result.tbUrl);
      }
    }

    viewHolder.description.setText(result.titleNoFormatting);

    if (closeToEnd(position)) {
      loadMoreData();
    }

    return v;
  }
예제 #16
0
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

      ViewHolder vh;
      final Computation comp = data.get(position);

      if (convertView == null) {
        LayoutInflater inflater =
            (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.list_comps, parent, false);

        vh = new ViewHolder();

        vh.name = (TextView) convertView.findViewById(R.id.comp_name_text);
        vh.description = (TextView) convertView.findViewById(R.id.comp_desc_text);
        vh.checkBox = (CheckBox) convertView.findViewById(R.id.checkBox);
        convertView.setTag(vh);
      } else {
        vh = (ViewHolder) convertView.getTag();
      }

      vh.name.setText(comp.getName());
      vh.description.setText(comp.getTopics());

      vh.checkBox.setTag(position);
      vh.checkBox.setChecked(checkedState[position]);

      vh.checkBox.setOnCheckedChangeListener(
          new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              int pos = (int) buttonView.getTag();
              checkedState[pos] = isChecked;
            }
          });

      return convertView;
    }
예제 #17
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View rowView = convertView;
    if (rowView == null) {
      LayoutInflater inflater = this.context.getLayoutInflater();
      rowView = inflater.inflate(R.layout.row_waypoint, null);
      ViewHolder viewHolder = new ViewHolder();
      viewHolder.description = (TextView) rowView.findViewById(R.id.description);
      viewHolder.location = (TextView) rowView.findViewById(R.id.location);
      viewHolder.enter = (ImageView) rowView.findViewById(R.id.enter);
      viewHolder.leave = (ImageView) rowView.findViewById(R.id.leave);

      rowView.setTag(viewHolder);
    }

    Waypoint w = getItem(position);

    ViewHolder holder = (ViewHolder) rowView.getTag();
    holder.description.setText(w.getDescription());
    holder.location.setText(w.getLatitude() + ":" + w.getLongitude());

    if ((w.getRadius() != null) && (w.getRadius() > 0)) {

      if ((w.getTransitionType() & Geofence.GEOFENCE_TRANSITION_ENTER) != 0)
        holder.enter.setVisibility(View.VISIBLE);
      else holder.enter.setVisibility(View.GONE);

      if ((w.getTransitionType() & Geofence.GEOFENCE_TRANSITION_EXIT) != 0)
        holder.leave.setVisibility(View.VISIBLE);
      else holder.leave.setVisibility(View.GONE);

    } else {
      holder.enter.setVisibility(View.GONE);
      holder.leave.setVisibility(View.GONE);
    }

    return rowView;
  }
예제 #18
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // Get the data item for this position
    Cb.RssItem item = this.getItem(position);

    // Check if an existing view is being reused, otherwise inflate the view
    ViewHolder viewHolder;
    if (convertView == null) {
      viewHolder = new ViewHolder();
      LayoutInflater inflater = LayoutInflater.from(getContext());
      convertView = inflater.inflate(R.layout.rss_item, parent, false);
      viewHolder.title = (TextView) convertView.findViewById(R.id.rss_title);
      viewHolder.description = (TextView) convertView.findViewById(R.id.rss_description);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }
    // Populate the data into the template view using the data object
    viewHolder.title.setText(item.getTitle());
    viewHolder.description.setText(item.getDescription());
    // Return the completed view to render on screen
    return convertView;
  }
예제 #19
0
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    // Get the current location object
    LocationModel lm = (LocationModel) getItem(position);

    // Inflate the view
    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.item, null);
      holder = new ViewHolder();
      holder.title = (TextView) convertView.findViewById(R.id.it_location_title);
      holder.description = (TextView) convertView.findViewById(R.id.it_location_description);

      convertView.setTag(holder);

    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.title.setText(lm.getName());
    holder.description.setText(lm.getDescription());

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

    if (convertView == null) {
      LayoutInflater inflater = LayoutInflater.from(getContext());
      convertView = inflater.inflate(R.layout.listview_item, parent, false);

      viewHolder = new ViewHolder();
      viewHolder.description = (TextView) convertView.findViewById(R.id.type);
      viewHolder.player1 = (TextView) convertView.findViewById(R.id.player1);
      viewHolder.player2 = (TextView) convertView.findViewById(R.id.player2);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }
    // update the item view
    ListViewItem item = getItem(position);
    viewHolder.description.setText(item.description);
    viewHolder.player1.setText(item.player1);
    viewHolder.player2.setText(item.player2);

    return convertView;
  }
예제 #21
0
  @Override
  public View getView(int i, View view, ViewGroup viewGroup) {
    ViewHolder holder = null;
    if (view == null) {
      holder = new ViewHolder();
      view = inflater.inflate(R.layout.userlist_item, null);

      holder.profileImage = (SmartImageView) view.findViewById(R.id.profile_img);
      holder.screenName = (TextView) view.findViewById(R.id.screen_name);
      holder.gender = (TextView) view.findViewById(R.id.gender);
      holder.location = (TextView) view.findViewById(R.id.location);
      holder.weiboCnt = (TextView) view.findViewById(R.id.weibo_cnt);
      holder.followCnt = (TextView) view.findViewById(R.id.follow_cnt);
      holder.fansCnt = (TextView) view.findViewById(R.id.fans_cnt);
      holder.description = (TextView) view.findViewById(R.id.description);
      view.setTag(holder);
    } else {
      holder = (ViewHolder) view.getTag();
    }
    final User user = this.users.get(i);
    holder.profileImage.setImageUrl(user.getProfileImageUrl());
    holder.screenName.setText(user.getScreenName());
    if (user.getGender().equals("m")) {
      holder.gender.setText("男");
    } else if (user.getGender().equals("f")) {
      holder.gender.setText("女");
    } else {
      holder.gender.setText("未知");
    }
    holder.location.setText(user.getLocation());
    holder.weiboCnt.setText(user.getStatusesCount() + "微博");
    holder.followCnt.setText(user.getFriendsCount() + "关注");
    holder.fansCnt.setText(user.getFollowersCount() + "粉丝");
    holder.description.setText("");
    return view;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder;
    if (convertView == null) {
      convertView = layoutInflater.inflate(R.layout.listitem_player_achievement, parent, false);
      holder = new ViewHolder();
      holder.icon = (ImageView) convertView.findViewById(R.id.iv_listitem_player_achievement_icon);
      holder.title = (TextView) convertView.findViewById(R.id.tv_listitem_player_achievement_title);
      holder.progress =
          (ProgressBar) convertView.findViewById(R.id.pb_listitem_player_achievement_progress);
      holder.description =
          (TextView) convertView.findViewById(R.id.tv_listitem_player_achievement_description);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    boolean unlocked = getItem(position);
    Achievement ach = Achievements.getAchievement(position);

    holder.title.setText(ach.getTitle());
    holder.icon.setImageResource(ach.getDrawableID());

    if (unlocked) {
      holder.title.setTextColor(Color.parseColor("#000000"));
      holder.progress.setVisibility(View.GONE);
      holder.description.setText(ach.getUnlockedDescription());
      holder.description.setTextColor(Color.parseColor("#000000"));
      holder.icon.clearColorFilter();
    } else {
      // grayscale
      holder.title.setTextColor(Color.parseColor("#999999"));

      long maxAmount = ach.getUnlockAmount();
      long amount = profile.getPlayerStatistics().getAmount(ach.getStatType());

      holder.description.setText(
          String.format(
              fa.getResources().getString(R.string.listitem_player_achievements_progress),
              amount,
              maxAmount,
              fa.getResources().getString(ach.getUnlockDescription())));
      holder.description.setTextColor(Color.parseColor("#999999"));

      // if(amount > 0){
      holder.progress.setVisibility(View.VISIBLE);
      holder.progress.setMax((int) maxAmount);
      holder.progress.setProgress((int) amount);
      /*}else{
          holder.progress.setVisibility(View.GONE);
      }*/

      // TODO: maybe use special not-unlocked icons?
      ColorMatrix matrix = new ColorMatrix();
      matrix.setSaturation(0); // 0 means grayscale
      ColorMatrixColorFilter cf = new ColorMatrixColorFilter(matrix);

      holder.icon.setColorFilter(cf);
    }

    return convertView;
  }