@Override public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) { Log.d(TAG, "onUnbindViewHolder"); ImageCardView cardView = (ImageCardView) viewHolder.view; // Remove references to images so that the garbage collector can free up memory cardView.setBadgeImage(null); cardView.setMainImage(null); }
protected void updateCardViewImage(Context context, String link) { if (link == null || link.isEmpty()) { mCardView.setMainImage(context.getDrawable(R.drawable.recording_unkown)); return; } Picasso.with(context) .load(link) .resize(266, 400) .centerCrop() .error(context.getDrawable(R.drawable.recording_unkown)) .placeholder(context.getDrawable(R.drawable.recording_unkown)) .into(mImageCardViewTarget); }
@Override public void onBitmapFailed(Drawable drawable) { mImageCardView.setMainImage(drawable); }
@Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) { Drawable bitmapDrawable = new BitmapDrawable(mContext.getResources(), bitmap); mImageCardView.setMainImage(bitmapDrawable); }