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.Bounds |
static class |
Settings.ExitType |
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() |
Settings.Bounds |
getBoundsType() |
float |
getDoubleTapZoom() |
Settings.ExitType |
getExitType() |
Settings.Fit |
getFitMethod() |
int |
getGravity() |
int |
getImageH() |
int |
getImageW() |
float |
getMaxZoom() |
float |
getMinZoom() |
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 |
isFlingEnabled() |
boolean |
isGesturesEnabled() |
boolean |
isPanEnabled() |
boolean |
isRestrictBounds() |
boolean |
isRestrictRotation() |
boolean |
isRotationEnabled() |
boolean |
isZoomEnabled() |
Settings |
setAnimationsDuration(long duration)
Duration of animations.
|
Settings |
setBoundsType(Settings.Bounds boundsType)
Setting movement bounds restriction type.
|
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 |
setExitType(Settings.ExitType type)
Sets which gestures to use to detect exit.
|
Settings |
setFillViewport(boolean isFitViewport)
If set to true small images 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 |
setFlingEnabled(boolean enabled)
Sets whether fling (inertial motion after scroll) is enabled or not.
|
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 |
setMinZoom(float minZoom)
Setting min 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 |
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)
@NonNull public Settings setViewport(int width, int height)
Should only be used when implementing custom GestureView.
width - Viewport widthheight - Viewport height@NonNull public Settings setMovementArea(int width, int height)
width - Movement area widthheight - Movement area height@NonNull public Settings setImage(int width, int height)
Should only be used when implementing custom GestureView.
width - Image widthheight - Image height@NonNull public Settings setMinZoom(float minZoom)
Default value is 0.
minZoom - Min zoom level, or 0 to use zoom level which fits the image into the viewport.@NonNull public Settings setMaxZoom(float maxZoom)
Default value is MAX_ZOOM.
maxZoom - Max zoom level, or 0 to use zoom level which fits the image into the viewport.@NonNull public Settings setDoubleTapZoom(float doubleTapZoom)
getMaxZoom().
Defaults to getMaxZoom() if <= 0.
Default value is -1.
doubleTapZoom - Double tap zoom level@NonNull public Settings setOverzoomFactor(float factor)
Default value is OVERZOOM_FACTOR.
factor - Overzoom factor@NonNull public Settings setOverscrollDistance(float distanceX, float distanceY)
Default value is 0.
distanceX - Horizontal overscroll distance in pixelsdistanceY - Vertical overscroll distance in pixels@NonNull public Settings setOverscrollDistance(@NonNull 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 dp@NonNull public Settings setFillViewport(boolean isFitViewport)
Default value is false.
isFitViewport - Whether image should fit viewport or not@NonNull public Settings setGravity(int gravity)
Default value is Gravity.CENTER.
gravity - Image gravity, one of Gravity constants@NonNull public Settings setFitMethod(@NonNull Settings.Fit fitMethod)
Default value is Settings.Fit.INSIDE.
fitMethod - Fit method@NonNull public Settings setBoundsType(@NonNull Settings.Bounds boundsType)
Default value is Settings.Bounds.NORMAL.
boundsType - Bounds restrictions type@NonNull public Settings setPanEnabled(boolean enabled)
Default value is true.
enabled - Whether panning should be enabled or not@NonNull public Settings setFlingEnabled(boolean enabled)
Default value is true.
enabled - Whether fling should be enabled or not@NonNull public Settings setZoomEnabled(boolean enabled)
Default value is true.
enabled - Whether zooming should be enabled or not@NonNull public Settings setRotationEnabled(boolean enabled)
Default value is false.
enabled - Whether rotation should be enabled or not@NonNull public Settings setRestrictRotation(boolean restrict)
isRestrictBounds() is true as well.
Default value is false.
restrict - Whether rotation should be restricted or not@NonNull public Settings setDoubleTapEnabled(boolean enabled)
Default value is true.
enabled - Whether double tap should be enabled or not@NonNull public Settings setExitEnabled(boolean enabled)
Default value is true.
enabled - Whether exit gesture should be enabled or not@NonNull public Settings setExitType(@NonNull Settings.ExitType type)
Default value is Settings.ExitType.ALL.
type - Exit type@NonNull public 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()
@NonNull public Settings enableGestures()
disableGestures() method.disableGestures() N times
you should call this method N times to re-enable all gestures.
See also disableGestures()
@NonNull 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()
@NonNull public Settings enableBounds()
disableBounds() method.disableBounds() N times
you should call this method N times to re-enable bounds restrictions.
See also disableBounds()
@NonNull public 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 getMinZoom()
public float getMaxZoom()
public float getDoubleTapZoom()
public float getOverzoomFactor()
public float getOverscrollDistanceX()
public float getOverscrollDistanceY()
public boolean isFillViewport()
public int getGravity()
@NonNull public Settings.Fit getFitMethod()
@NonNull public Settings.Bounds getBoundsType()
public boolean isPanEnabled()
public boolean isFlingEnabled()
public boolean isZoomEnabled()
public boolean isRotationEnabled()
public boolean isRestrictRotation()
public boolean isDoubleTapEnabled()
public boolean isExitEnabled()
@NonNull public Settings.ExitType getExitType()
public boolean isGesturesEnabled()
public boolean isRestrictBounds()
public long getAnimationsDuration()
public boolean isEnabled()
public boolean hasImageSize()
public boolean hasViewportSize()