public class PhotoView extends AppCompatImageView implements IPhotoView
DEFAULT_MAX_SCALE, DEFAULT_MID_SCALE, DEFAULT_MIN_SCALE, DEFAULT_ZOOM_DURATION| Constructor and Description |
|---|
PhotoView(android.content.Context context) |
PhotoView(android.content.Context context,
android.util.AttributeSet attr) |
PhotoView(android.content.Context context,
android.util.AttributeSet attr,
int defStyle) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canZoom()
Returns true if the PhotoView is set to allow zooming of Photos.
|
void |
getDisplayMatrix(android.graphics.Matrix matrix)
Copies the Display Matrix of the currently displayed Drawable.
|
android.graphics.RectF |
getDisplayRect()
Gets the Display Rectangle of the currently displayed Drawable.
|
android.graphics.Matrix |
getImageMatrix() |
IPhotoView |
getIPhotoViewImplementation()
Will return instance of IPhotoView (eg.
|
float |
getMaximumScale() |
float |
getMediumScale() |
float |
getMinimumScale() |
float |
getScale()
Returns the current scale value
|
ScaleType |
getScaleType()
Return the current scale type in use by the ImageView.
|
android.graphics.Bitmap |
getVisibleRectangleBitmap()
Extracts currently visible area to Bitmap object, if there is no image loaded yet or the
ImageView is already destroyed, returns
null |
protected void |
init() |
protected void |
onAttachedToWindow() |
protected void |
onDetachedFromWindow() |
void |
resetMatrix() |
void |
setAllowParentInterceptOnEdge(boolean allow)
Whether to allow the ImageView's parent to intercept the touch event when the photo is scroll
to it's horizontal edge.
|
boolean |
setDisplayMatrix(android.graphics.Matrix finalRectangle)
Sets the Display Matrix of the currently displayed Drawable.
|
protected boolean |
setFrame(int l,
int t,
int r,
int b) |
void |
setImageDrawable(android.graphics.drawable.Drawable drawable) |
void |
setImageResource(int resId) |
void |
setImageURI(android.net.Uri uri) |
void |
setMaximumScale(float maximumScale)
Sets the maximum scale level.
|
void |
setMediumScale(float mediumScale)
Sets the medium scale level.
|
void |
setMinimumScale(float minimumScale)
Sets the minimum scale level.
|
void |
setOnDoubleTapListener(android.view.GestureDetector.OnDoubleTapListener newOnDoubleTapListener)
Sets custom double tap listener, to intercept default given functions.
|
void |
setOnLongClickListener(OnLongClickListener l)
Register a callback to be invoked when the Photo displayed by this view is long-pressed.
|
void |
setOnMatrixChangeListener(PhotoViewAttacher.OnMatrixChangedListener listener)
Register a callback to be invoked when the Matrix has changed for this View.
|
void |
setOnPhotoTapListener(PhotoViewAttacher.OnPhotoTapListener listener)
Register a callback to be invoked when the Photo displayed by this View is tapped with a
single tap.
|
void |
setOnScaleChangeListener(PhotoViewAttacher.OnScaleChangeListener onScaleChangeListener)
Will report back about scale changes
|
void |
setOnSingleFlingListener(PhotoViewAttacher.OnSingleFlingListener onSingleFlingListener)
Will report back about fling(single touch)
|
void |
setOnViewTapListener(PhotoViewAttacher.OnViewTapListener listener)
Register a callback to be invoked when the View is tapped with a single tap.
|
void |
setRotationBy(float rotationDegree)
Enables rotation via PhotoView internal functions.
|
void |
setRotationTo(float rotationDegree)
Enables rotation via PhotoView internal functions.
|
void |
setScale(float scale)
Changes the current scale to the specified value.
|
void |
setScale(float scale,
boolean animate)
Changes the current scale to the specified value.
|
void |
setScale(float scale,
float focalX,
float focalY,
boolean animate)
Changes the current scale to the specified value, around the given focal point.
|
void |
setScaleLevels(float minimumScale,
float mediumScale,
float maximumScale)
Allows to set all three scale levels at once, so you don't run into problem with setting
medium/minimum scale before the maximum one
|
void |
setScaleType(ScaleType scaleType)
Controls how the image should be resized or moved to match the size of the ImageView.
|
void |
setZoomable(boolean zoomable)
Allows you to enable/disable the zoom functionality on the ImageView.
|
void |
setZoomTransitionDuration(int milliseconds)
Allows to change zoom transition speed, default value is 200 (PhotoViewAttacher.DEFAULT_ZOOM_DURATION).
|
public PhotoView(android.content.Context context)
public PhotoView(android.content.Context context,
android.util.AttributeSet attr)
public PhotoView(android.content.Context context,
android.util.AttributeSet attr,
int defStyle)
protected void init()
public void setRotationTo(float rotationDegree)
IPhotoViewsetRotationTo in interface IPhotoViewrotationDegree - - Degree to rotate PhotoView to, should be in range 0 to 360public void setRotationBy(float rotationDegree)
IPhotoViewsetRotationBy in interface IPhotoViewrotationDegree - - Degree to rotate PhotoView by, should be in range 0 to 360public boolean canZoom()
IPhotoViewcanZoom in interface IPhotoViewpublic android.graphics.RectF getDisplayRect()
IPhotoViewgetDisplayRect in interface IPhotoViewpublic void getDisplayMatrix(android.graphics.Matrix matrix)
IPhotoViewgetDisplayMatrix in interface IPhotoViewmatrix - target matrix to copy topublic boolean setDisplayMatrix(android.graphics.Matrix finalRectangle)
IPhotoViewsetDisplayMatrix in interface IPhotoViewfinalRectangle - target matrix to set PhotoView topublic float getMinimumScale()
getMinimumScale in interface IPhotoViewImageView.ScaleType.public float getMediumScale()
getMediumScale in interface IPhotoViewImageView.ScaleType.public float getMaximumScale()
getMaximumScale in interface IPhotoViewImageView.ScaleType.public float getScale()
IPhotoViewgetScale in interface IPhotoViewpublic ScaleType getScaleType()
IPhotoViewgetScaleType in interface IPhotoViewpublic android.graphics.Matrix getImageMatrix()
public void setAllowParentInterceptOnEdge(boolean allow)
IPhotoViewsetAllowParentInterceptOnEdge in interface IPhotoViewallow - whether to allow intercepting by parent element or notpublic void setMinimumScale(float minimumScale)
IPhotoViewImageView.ScaleType.setMinimumScale in interface IPhotoViewminimumScale - minimum allowed scalepublic void setMediumScale(float mediumScale)
IPhotoViewImageView.ScaleType.setMediumScale in interface IPhotoViewmediumScale - medium scale presetpublic void setMaximumScale(float maximumScale)
IPhotoViewImageView.ScaleType.setMaximumScale in interface IPhotoViewmaximumScale - maximum allowed scale presetpublic void setScaleLevels(float minimumScale,
float mediumScale,
float maximumScale)
IPhotoViewsetScaleLevels in interface IPhotoViewminimumScale - minimum allowed scalemediumScale - medium allowed scalemaximumScale - maximum allowed scale presetpublic void setImageDrawable(android.graphics.drawable.Drawable drawable)
public void setImageResource(int resId)
public void setImageURI(android.net.Uri uri)
protected boolean setFrame(int l,
int t,
int r,
int b)
public void setOnMatrixChangeListener(PhotoViewAttacher.OnMatrixChangedListener listener)
IPhotoViewsetOnMatrixChangeListener in interface IPhotoViewlistener - - Listener to be registered.public void setOnLongClickListener(OnLongClickListener l)
IPhotoViewsetOnLongClickListener in interface IPhotoViewl - - Listener to be registered.public void setOnPhotoTapListener(PhotoViewAttacher.OnPhotoTapListener listener)
IPhotoViewsetOnPhotoTapListener in interface IPhotoViewlistener - - Listener to be registered.public void setOnViewTapListener(PhotoViewAttacher.OnViewTapListener listener)
IPhotoViewsetOnViewTapListener in interface IPhotoViewlistener - - Listener to be registered.public void setScale(float scale)
IPhotoViewsetScale in interface IPhotoViewscale - - Value to scale topublic void setScale(float scale,
boolean animate)
IPhotoViewsetScale in interface IPhotoViewscale - - Value to scale toanimate - - Whether to animate the scalepublic void setScale(float scale,
float focalX,
float focalY,
boolean animate)
IPhotoViewsetScale in interface IPhotoViewscale - - Value to scale tofocalX - - X Focus PointfocalY - - Y Focus Pointanimate - - Whether to animate the scalepublic void setScaleType(ScaleType scaleType)
IPhotoViewImageView.ScaleType.setScaleType in interface IPhotoViewscaleType - - The desired scaling mode.public void setZoomable(boolean zoomable)
IPhotoViewsetZoomable in interface IPhotoViewzoomable - - Whether the zoom functionality is enabled.public android.graphics.Bitmap getVisibleRectangleBitmap()
IPhotoViewnullgetVisibleRectangleBitmap in interface IPhotoViewpublic void setZoomTransitionDuration(int milliseconds)
IPhotoViewsetZoomTransitionDuration in interface IPhotoViewmilliseconds - duration of zoom interpolationpublic IPhotoView getIPhotoViewImplementation()
IPhotoViewgetIPhotoViewImplementation in interface IPhotoViewpublic void setOnDoubleTapListener(android.view.GestureDetector.OnDoubleTapListener newOnDoubleTapListener)
IPhotoViewsetOnDoubleTapListener in interface IPhotoViewnewOnDoubleTapListener - custom OnDoubleTapListener to be set on ImageViewpublic void setOnScaleChangeListener(PhotoViewAttacher.OnScaleChangeListener onScaleChangeListener)
IPhotoViewsetOnScaleChangeListener in interface IPhotoViewonScaleChangeListener - OnScaleChangeListener instancepublic void setOnSingleFlingListener(PhotoViewAttacher.OnSingleFlingListener onSingleFlingListener)
IPhotoViewsetOnSingleFlingListener in interface IPhotoViewonSingleFlingListener - OnSingleFlingListener instanceprotected void onDetachedFromWindow()
protected void onAttachedToWindow()
public void resetMatrix()