@Override public boolean onInterceptMoveRight(float origX, float origY) { if (!mCallback.isFragmentActive(this)) { // we're not in the foreground; don't intercept any touches return false; } return (mPhotoView != null && mPhotoView.interceptMoveRight(origX, origY)); }
@Override public void onDestroyView() { // Clean up views and other components if (mPhotoView != null) { mPhotoView.clear(); mPhotoView = null; } super.onDestroyView(); }
/** Binds an image to the photo view. */ private void bindPhoto(Drawable drawable) { if (drawable != null) { if (mPhotoView != null) { mPhotoView.bindDrawable(drawable); } enableImageTransforms(true); mPhotoPreviewAndProgress.setVisibility(View.GONE); mProgressBarNeeded = false; } }
protected void initializeView(View view) { mPhotoView = (PhotoView) view.findViewById(R.id.photo_view); mPhotoView.setMaxInitialScale(mIntent.getFloatExtra(Intents.EXTRA_MAX_INITIAL_SCALE, 1)); mPhotoView.setOnClickListener(this); mPhotoView.setFullScreen(mFullScreen, false); mPhotoView.enableImageTransforms(false); mPhotoPreviewAndProgress = view.findViewById(R.id.photo_preview); mPhotoPreviewImage = (ImageView) view.findViewById(R.id.photo_preview_image); mThumbnailShown = false; final ProgressBar indeterminate = (ProgressBar) view.findViewById(R.id.indeterminate_progress); final ProgressBar determinate = (ProgressBar) view.findViewById(R.id.determinate_progress); mPhotoProgressBar = new ProgressBarWrapper(determinate, indeterminate, true); mEmptyText = (TextView) view.findViewById(R.id.empty_text); mRetryButton = (ImageView) view.findViewById(R.id.retry_button); // Don't call until we've setup the entire view setViewVisibility(); }
/** Returns {@code true} if a photo has been bound. Otherwise, returns {@code false}. */ public boolean isPhotoBound() { return (mPhotoView != null && mPhotoView.isPhotoBound()); }
/** Reset the views to their default states */ public void resetViews() { if (mPhotoView != null) { mPhotoView.resetTransformations(); } }
/** Resets the photo view to it's default state w/ no bound photo. */ private void resetPhotoView() { if (mPhotoView != null) { mPhotoView.bindPhoto(null); } }
/** * Enable or disable image transformations. When transformations are enabled, this view consumes * all touch events. */ public void enableImageTransforms(boolean enable) { mPhotoView.enableImageTransforms(enable); }
public Drawable getDrawable() { return (mPhotoView != null ? mPhotoView.getDrawable() : null); }