@Override public void bindView(View view) { ViewHolder holder = (ViewHolder) view.getTag(); if (holder.photoViews != null) { final int viewCount = holder.photoViews.length; final int photoCount = mAlbumPhotos != null ? mAlbumPhotos.length : 0; if (photoCount < 3) { holder.albumTitle.setVisibility(View.GONE); } else { holder.albumTitle.setVisibility(View.VISIBLE); holder.albumTitle.setText(mContext.getString(R.string.album_title, photoTotal)); } for (int i = 0; i < viewCount; ++i) { if (i < photoCount) { holder.photoViews[i].setVisibility(View.VISIBLE); mAlbumManager.displayPhotoThumb( mAlbumPhotos[i].getPhotoThumb(), holder.photoViews[i], R.drawable.pic_loading); } else { holder.photoViews[i].setBackgroundResource(R.drawable.null_pic); } } } view.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (mAlbumPhotos != null) { UILauncher.launchAlbumGalleryUI(mContext, new LiteStranger(mUserContact)); } } }); }
public AlbumItem(Context context, UserContact userContact) { mContext = context; if (userContact != null) { photoTotal = userContact.getMyPhotoTotal(); mUserContact = userContact; mAlbumPhotos = userContact.getAlbumPhotos(); } mAlbumManager = AlbumManager.getInstance(mContext); }