Example #1
0
  public void loadNoPhoto(String bioguide_id) {
    VoterAdapter.ViewHolder holder = new VoterAdapter.ViewHolder();
    holder.bioguide_id = bioguide_id;

    View result = getListView().findViewWithTag(holder);
    if (result != null)
      ((ImageView) result.findViewById(R.id.photo)).setImageResource(R.drawable.no_photo_female);
  }
Example #2
0
  public void onLoadPhoto(Drawable photo, Object tag) {
    loadPhotoTasks.remove(tag);

    VoterAdapter.ViewHolder holder = new VoterAdapter.ViewHolder();
    holder.bioguide_id = (String) tag;

    View result = getListView().findViewWithTag(holder);
    if (result != null) {
      if (photo != null) ((ImageView) result.findViewById(R.id.photo)).setImageDrawable(photo);
      else // don't know the gender from here, default to female (to balance out how the shortcut
           // image defaults to male)
      ((ImageView) result.findViewById(R.id.photo)).setImageResource(R.drawable.no_photo_female);
    }

    // if there's any in the queue, send the next one
    if (!queuedPhotos.isEmpty()) loadPhoto(queuedPhotos.remove(0));
  }