Object ViewUtils
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
ViewUtils.DefaultAnimationListener
Implementation of Animator.AnimatorListener that does nothing. Used as base class for creating anonymous classes, which doesn't force you to override all the methods.
Also, ensures that DefaultAnimationListener.onAnimationFinished will be invoked not more than once per animation (which, for instance, can be possible on HTC One X).
public final class
ViewUtils.HardwareLayerAnimationListener
Applies View.LAYER_TYPE_HARDWARE to provided View on animation start and returns in to previous layer on animation finish.
-
Field Summary
Fields Modifier and Type Field Description private final Float
ALPHA_DEFAULT
private final Float
ALPHA_TRANSPARENT
private final Float
SCALE_DEFAULT
private final Float
TRANSLATION_DEFAULT
private ActionMode.Callback
DISABLED_ACTIONMODE_CALLBACK
public final static ViewUtils
INSTANCE
-
Method Summary
Modifier and Type Method Description final Unit
saveViewTransformation(View view)
Saves View transformation parameters (translation, imageScale, rotation, alpha), so they can later be restored with . final Unit
restoreViewTransformation(View view)
Restores transformation values. final Unit
postOnPreDraw(View view, Runnable runnable)
Executes Runnable right before global draw event, which is convenient if you want to be sure that provided View correctly calculated it's size. final Rect
getViewBounds(View view)
final Float
fitBitmapToView(Bitmap bitmap, View view, Float rotation)
Convenient alternative for . final Float
fitDrawableToView(Drawable drawable, View view, Float rotation)
Convenient alternative for . final static Float
fitRectToView(View view, Float rotation, RectF imageBounds)
final Float
getALPHA_DEFAULT()
final Float
getALPHA_TRANSPARENT()
final Float
getSCALE_DEFAULT()
final Float
getTRANSLATION_DEFAULT()
final ActionMode.Callback
getDISABLED_ACTIONMODE_CALLBACK()
Use this ActionMode.Callback if action mode should be disabled final Unit
setDISABLED_ACTIONMODE_CALLBACK(ActionMode.Callback DISABLED_ACTIONMODE_CALLBACK)
Use this ActionMode.Callback if action mode should be disabled -
-
Method Detail
-
saveViewTransformation
final Unit saveViewTransformation(View view)
Saves View transformation parameters (translation, imageScale, rotation, alpha), so they can later be restored with .restoreViewTransformation. Note, that this implementation uses View.setTag method to save parameters, so any existing tags will be overwritten.
-
restoreViewTransformation
final Unit restoreViewTransformation(View view)
Restores transformation values.
-
postOnPreDraw
final Unit postOnPreDraw(View view, Runnable runnable)
-
getViewBounds
final Rect getViewBounds(View view)
-
fitBitmapToView
final Float fitBitmapToView(Bitmap bitmap, View view, Float rotation)
Convenient alternative for .fitRectToView which creates rectangle from Bitmap
-
fitDrawableToView
final Float fitDrawableToView(Drawable drawable, View view, Float rotation)
Convenient alternative for .fitRectToView which creates rectangle from intrinsic size of Drawable
-
fitRectToView
final static Float fitRectToView(View view, Float rotation, RectF imageBounds)
-
getALPHA_DEFAULT
final Float getALPHA_DEFAULT()
-
getALPHA_TRANSPARENT
final Float getALPHA_TRANSPARENT()
-
getSCALE_DEFAULT
final Float getSCALE_DEFAULT()
-
getTRANSLATION_DEFAULT
final Float getTRANSLATION_DEFAULT()
-
getDISABLED_ACTIONMODE_CALLBACK
final ActionMode.Callback getDISABLED_ACTIONMODE_CALLBACK()
Use this ActionMode.Callback if action mode should be disabled
-
setDISABLED_ACTIONMODE_CALLBACK
final Unit setDISABLED_ACTIONMODE_CALLBACK(ActionMode.Callback DISABLED_ACTIONMODE_CALLBACK)
Use this ActionMode.Callback if action mode should be disabled
-
-
-
-