public class Settings
extends java.lang.Object
GestureController and for StateController.
Required settings are viewport size (setViewport(int, int))
and image size setImage(int, int)
| Modifier and Type | Class and Description |
|---|---|
static class |
Settings.Fit |
| Modifier and Type | Field and Description |
|---|---|
static long |
ANIMATIONS_DURATION |
static float |
MAX_ZOOM |
static float |
OVERZOOM_FACTOR |
| Modifier and Type | Method and Description |
|---|---|
Settings |
disableBounds()
Disable bounds restrictions.
Calls to this method are counted, so if you called it N times you should call enableBounds() N times to re-enable bounds restrictions. |
Settings |
disableGestures()
Disable all gestures.
Calls to this method are counted, so if you called it N times you should call enableGestures() N times to re-enable all gestures. |
Settings |
enableBounds()
Re-enable bounds restrictions disabled by
disableBounds() method.Calls to this method are counted, so if you called disableBounds() N times
you should call this method N times to re-enable bounds restrictions. |
Settings |
enableGestures()
Re-enable all gestures disabled by
disableGestures() method.Calls to this method are counted, so if you called disableGestures() N times
you should call this method N times to re-enable all gestures. |
long |
getAnimationsDuration() |
float |
getDoubleTapZoom() |
Settings.Fit |
getFitMethod() |
int |
getGravity() |
int |
getImageH() |
int |
getImageW() |
float |
getMaxZoom() |
int |
getMovementAreaH() |
int |
getMovementAreaW() |
float |
getOverscrollDistanceX() |
float |
getOverscrollDistanceY() |
float |
getOverzoomFactor() |
int |
getViewportH() |
int |
getViewportW() |
boolean |
hasImageSize() |
boolean |
hasViewportSize() |
void |
initFromAttributes(android.content.Context context,
android.util.AttributeSet attrs) |
boolean |
isDoubleTapEnabled() |
boolean |
isEnabled() |
boolean |
isExitEnabled() |
boolean |
isFillViewport() |
boolean |
isGesturesEnabled() |
boolean |
isPanEnabled() |
boolean |
isRestrictBounds() |
boolean |
isRestrictRotation() |
boolean |
isRotationEnabled() |
boolean |
isZoomEnabled() |
Settings |
setAnimationsDuration(long duration)
Duration of animations.
|
Settings |
setDoubleTapEnabled(boolean enabled)
Sets whether zooming by double tap is enabled or not.
|
Settings |
setDoubleTapZoom(float doubleTapZoom)
Setting double tap zoom level, should not be greater than
getMaxZoom(). |
Settings |
setExitEnabled(boolean enabled)
Sets whether to detect and animate exit from gesture views.
|
Settings |
setFillViewport(boolean isFitViewport)
If set to true small image will be scaled to fit entire viewport (or entire movement area
if it was set) even if this will require zoom level above max zoom level.
|
Settings |
setFitMethod(Settings.Fit fitMethod)
Setting image fitting method within viewport area.
|
Settings |
setGravity(int gravity)
Setting image gravity inside viewport area.
|
Settings |
setImage(int width,
int height)
Setting full image size.
|
Settings |
setMaxZoom(float maxZoom)
Setting max zoom level.
|
Settings |
setMovementArea(int width,
int height)
Setting movement area size.
|
Settings |
setOverscrollDistance(android.content.Context context,
float distanceXDp,
float distanceYDp)
Same as
setOverscrollDistance(float, float) but accepts distance in DP. |
Settings |
setOverscrollDistance(float distanceX,
float distanceY)
Setting overscroll distance in pixels.
|
Settings |
setOverzoomFactor(float factor)
Setting overzoom factor.
|
Settings |
setPanEnabled(boolean enabled)
Sets whether panning is enabled or not.
|
Settings |
setRestrictBounds(boolean restrict)
Deprecated.
Use
disableBounds() and enableBounds() methods instead. |
Settings |
setRestrictRotation(boolean restrict)
Sets whether image rotation should stick to 90 degrees intervals or can be free.
|
Settings |
setRotationEnabled(boolean enabled)
Sets whether rotation gesture is enabled or not.
|
Settings |
setViewport(int width,
int height)
Setting viewport size.
|
Settings |
setZoomEnabled(boolean enabled)
Sets whether zooming is enabled or not.
|
public static final float MAX_ZOOM
public static final float OVERZOOM_FACTOR
public static final long ANIMATIONS_DURATION
public void initFromAttributes(@NonNull
android.content.Context context,
@Nullable
android.util.AttributeSet attrs)
public Settings setViewport(int width, int height)
Should only be used when implementing custom GestureView.
width - Viewport widthheight - Viewport heightpublic Settings setMovementArea(int width, int height)
width - Movement area widthheight - Movement area heightpublic Settings setImage(int width, int height)
Should only be used when implementing custom GestureView.
width - Image widthheight - Image heightpublic Settings setMaxZoom(float maxZoom)
Default value is MAX_ZOOM.
maxZoom - Max zoom levelpublic Settings setDoubleTapZoom(float doubleTapZoom)
getMaxZoom().
Defaults to getMaxZoom() if <= 0.
Default value is -1.
doubleTapZoom - Double tap zoom levelpublic Settings setOverzoomFactor(float factor)
Default value is OVERZOOM_FACTOR.
factor - Overzoom factorpublic Settings setOverscrollDistance(float distanceX, float distanceY)
Default value is 0.
distanceX - Horizontal overscroll distance in pixelsdistanceY - Vertical overscroll distance in pixelspublic Settings setOverscrollDistance(android.content.Context context, float distanceXDp, float distanceYDp)
setOverscrollDistance(float, float) but accepts distance in DP.context - ContextdistanceXDp - Horizontal overscroll distance in dpdistanceYDp - Vertical overscroll distance in dppublic Settings setFillViewport(boolean isFitViewport)
Default value is false.
isFitViewport - Whether image should fit viewport or notpublic Settings setGravity(int gravity)
Default value is Gravity.CENTER.
gravity - Image gravity, one of Gravity constantspublic Settings setFitMethod(@NonNull Settings.Fit fitMethod)
Default value is Settings.Fit.INSIDE.
fitMethod - Fit methodpublic Settings setPanEnabled(boolean enabled)
Default value is true.
enabled - Whether panning should be enabled or notpublic Settings setZoomEnabled(boolean enabled)
Default value is true.
enabled - Whether zooming should be enabled or notpublic Settings setRotationEnabled(boolean enabled)
Default value is false.
enabled - Whether rotation should be enabled or notpublic Settings setRestrictRotation(boolean restrict)
isRestrictBounds() is true as well.
Default value is false.
restrict - Whether rotation should be restricted or notpublic Settings setDoubleTapEnabled(boolean enabled)
Default value is true.
enabled - Whether double tap should be enabled or notpublic Settings setExitEnabled(boolean enabled)
Default value is true.
enabled - Whether exit gesture should be enabled or notpublic Settings disableGestures()
enableGestures() N times to re-enable all gestures.
Useful when you need to temporary disable touch gestures during animation or image loading.
See also enableGestures()
public Settings enableGestures()
disableGestures() method.disableGestures() N times
you should call this method N times to re-enable all gestures.
See also disableGestures()
public Settings disableBounds()
enableBounds() N times to re-enable bounds restrictions.
Useful when you need to temporary disable bounds restrictions during animation.
See also enableBounds()
public Settings enableBounds()
disableBounds() method.disableBounds() N times
you should call this method N times to re-enable bounds restrictions.
See also disableBounds()
@Deprecated public Settings setRestrictBounds(boolean restrict)
disableBounds() and enableBounds() methods instead.restrict - Whether image bounds should be restricted or notpublic Settings setAnimationsDuration(long duration)
duration - Animation duration in millisecondspublic int getViewportW()
public int getViewportH()
public int getMovementAreaW()
public int getMovementAreaH()
public int getImageW()
public int getImageH()
public float getMaxZoom()
public float getDoubleTapZoom()
public float getOverzoomFactor()
public float getOverscrollDistanceX()
public float getOverscrollDistanceY()
public boolean isFillViewport()
public int getGravity()
public Settings.Fit getFitMethod()
public boolean isPanEnabled()
public boolean isZoomEnabled()
public boolean isRotationEnabled()
public boolean isRestrictRotation()
public boolean isDoubleTapEnabled()
public boolean isExitEnabled()
public boolean isGesturesEnabled()
public boolean isRestrictBounds()
public long getAnimationsDuration()
public boolean isEnabled()
public boolean hasImageSize()
public boolean hasViewportSize()