public void changePlayerProfile(PlayerProfile newProfile) {
   this.profile = newProfile;
   for (int id : Achievements.getAchievementIDs()) {
     this.list.put(id, newProfile.getPlayerAchievements().hasUnlocked(id));
   }
   //   sortList();
   this.notifyDataSetChanged();
 }
 public PlayerAchievementsListAdapter(FullscreenActivity fa, PlayerProfile playerProfile) {
   this.fa = fa;
   this.profile = playerProfile;
   this.layoutInflater = LayoutInflater.from(fa);
   this.list = new LinkedHashMap<>();
   for (int id : Achievements.getAchievementIDs()) {
     this.list.put(id, playerProfile.getPlayerAchievements().hasUnlocked(id));
   }
   //        sortList();
 }
  @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;
  }