Source:
public void init(int position, Contribution contribution) { this.contribution=contribution; this.position=position; String imageSource = contribution.thumbUrl; if (TextUtils.isEmpty(imageSource)) { imageSource = contribution.getLocalUri() != null ? contribution.getLocalUri().toString() : null; } if (!TextUtils.isEmpty(imageSource)) { final ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageSource)).setProgressiveRenderingEnabled(true).setProgressiveRenderingEnabled(true) .build(); imageView.setImageRequest(imageRequest); } titleView.setText(contribution.getDisplayTitle()); seqNumView.setText(String.valueOf(position + 1)); seqNumView.setVisibility(View.VISIBLE); switch (contribution.getState()) { case Contribution.STATE_COMPLETED: stateView.setVisibility(View.GONE); progressView.setVisibility(View.GONE); failedImageOptions.setVisibility(View.GONE); stateView.setText(""); break; case Contribution.STATE_QUEUED: stateView.setVisibility(View.VISIBLE); progressView.setVisibility(View.GONE); stateView.setText(R.string.contribution_state_queued); failedImageOptions.setVisibility(View.GONE); break; case Contribution.STATE_IN_PROGRESS: stateView.setVisibility(View.GONE); progressView.setVisibility(View.VISIBLE); failedImageOptions.setVisibility(View.GONE); long total = contribution.getDataLength(); long transferred = contribution.getTransferred(); if (transferred == 0 || transferred >= total) { progressView.setIndeterminate(true); } else { progressView.setProgress((int)(((double)transferred / (double)total) * 100)); } break; case Contribution.STATE_FAILED: stateView.setVisibility(View.VISIBLE); stateView.setText(R.string.contribution_state_failed); progressView.setVisibility(View.GONE); failedImageOptions.setVisibility(View.VISIBLE); break; } }

Target:
public void init(int position, Contribution contribution) { this.contribution = contribution; this.position = position; imageView.getHierarchy().setPlaceholderImage(new ColorDrawable( Color.argb(100, random.nextInt(256), random.nextInt(256), random.nextInt(256)))); String imageSource = chooseImageSource(contribution.thumbUrl, contribution.getLocalUri()); if (!TextUtils.isEmpty(imageSource)) { final ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageSource)) .setProgressiveRenderingEnabled(true) .build(); imageView.setImageRequest(imageRequest); } titleView.setText(contribution.getDisplayTitle()); seqNumView.setText(String.valueOf(position + 1)); seqNumView.setVisibility(View.VISIBLE); switch (contribution.getState()) { case Contribution.STATE_COMPLETED: stateView.setVisibility(View.GONE); progressView.setVisibility(View.GONE); failedImageOptions.setVisibility(View.GONE); stateView.setText(""); break; case Contribution.STATE_QUEUED: stateView.setVisibility(View.VISIBLE); progressView.setVisibility(View.GONE); stateView.setText(R.string.contribution_state_queued); failedImageOptions.setVisibility(View.GONE); break; case Contribution.STATE_IN_PROGRESS: stateView.setVisibility(View.GONE); progressView.setVisibility(View.VISIBLE); failedImageOptions.setVisibility(View.GONE); long total = contribution.getDataLength(); long transferred = contribution.getTransferred(); if (transferred == 0 || transferred >= total) { progressView.setIndeterminate(true); } else { progressView.setProgress((int)(((double)transferred / (double)total) * 100)); } break; case Contribution.STATE_FAILED: stateView.setVisibility(View.VISIBLE); stateView.setText(R.string.contribution_state_failed); progressView.setVisibility(View.GONE); failedImageOptions.setVisibility(View.VISIBLE); break; } }