@Override public void onLoadingCancelled(final String imageUri, final View view) { if (view == null || imageUri == null || imageUri.equals(mLoadingUris.get(view))) return; mLoadingUris.remove(view); if (view instanceof ForegroundImageView) { ((ForegroundImageView) view).setForeground(null); } final ProgressBar progress = findProgressBar(view.getParent()); if (progress != null) { progress.setVisibility(View.GONE); } }
public static void setVideoIndicator(View view, ViewGroup parent) { if (view instanceof ForegroundImageView) { final Drawable foreground; if (isVideoItem(parent)) { foreground = ResourcesCompat.getDrawable(view.getResources(), R.drawable.ic_card_media_play, null); } else { foreground = null; } ((ForegroundImageView) view).setForeground(foreground); } }
@Override public void onLoadingFailed(final String imageUri, final View view, final FailReason reason) { if (view == null) return; if (view instanceof ForegroundImageView) { ((ImageView) view).setImageDrawable(null); final Drawable foreground = ResourcesCompat.getDrawable(view.getResources(), R.drawable.image_preview_refresh, null); ((ForegroundImageView) view).setForeground(foreground); } mLoadingUris.remove(view); final ProgressBar progress = findProgressBar(view.getParent()); if (progress != null) { progress.setVisibility(View.GONE); } }
@Override public void onLoadingStarted(final String imageUri, final View view) { if (view == null || imageUri == null || imageUri.equals(mLoadingUris.get(view))) return; ViewGroup parent = (ViewGroup) view.getParent(); if (view instanceof ForegroundImageView) { ((ForegroundImageView) view).setForeground(null); } mLoadingUris.put(view, imageUri); final ProgressBar progress = findProgressBar(parent); if (progress != null) { progress.setVisibility(View.VISIBLE); progress.setIndeterminate(true); progress.setMax(100); } }