public class ViewUtils
Contains tools for usage in View animations and transformations. Also contains methods to handle major ui bug-fixes.
| Modifier and Type | Class and Description |
|---|---|
static 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
will be invoked not more than once per animation (which, for instance, can be possible on HTC One X). |
static class |
ViewUtils.HardwareLayerAnimationListener
Applies
View#LAYER_TYPE_HARDWARE to provided View on animation start and returns in to previous layer on animation finish. |
| Modifier and Type | Field and Description |
|---|---|
static float |
ALPHA_DEFAULT |
static float |
ALPHA_TRANSPARENT |
static android.view.ActionMode.Callback |
DISABLED_ACTIONMODE_CALLBACK
Use this ActionMode.Callback if action mode should be disabled
|
static float |
SCALE_DEFAULT |
static float |
TRANSLATION_DEFAULT |
| Modifier and Type | Method and Description |
|---|---|
static float |
fitBitmapToView()
Convenient alternative for
which creates rectangle from Bitmap |
static float |
fitDrawableToView()
Convenient alternative for
which creates rectangle from intrinsic size of Drawable |
static float |
fitRectToView() |
static android.graphics.Rect |
getViewBounds() |
static void |
postOnPreDraw()
Executes Runnable right before global draw event, which is convenient if you want to be sure that provided View correctly calculated it's size.
|
static void |
restoreViewTransformation()
Restores transformation values.
|
static void |
saveViewTransformation()
Saves View transformation parameters (translation, scale, rotation, alpha), so they can later be restored with
. Note, that this implementation uses View#setTag(Object) method to save parameters, so any existing tags will be overwritten. |
public static float ALPHA_DEFAULT
public static float ALPHA_TRANSPARENT
public static float SCALE_DEFAULT
public static float TRANSLATION_DEFAULT
public static android.view.ActionMode.Callback DISABLED_ACTIONMODE_CALLBACK
Use this ActionMode.Callback if action mode should be disabled
public static void saveViewTransformation()
Saves View transformation parameters (translation, scale, rotation, alpha), so they can later be restored with . Note, that this implementation uses ViewUtils.restoreViewTransformationView#setTag(Object) method to save parameters, so any existing tags will be overwritten.
ViewUtils.restoreViewTransformationpublic static void restoreViewTransformation()
Restores transformation values.
View#setTag(Object))public static void postOnPreDraw()
Executes Runnable right before global draw event, which is convenient if you want to be sure that provided View correctly calculated it's size.
public static android.graphics.Rect getViewBounds()
public static float fitBitmapToView()
Convenient alternative for which creates rectangle from BitmapViewUtils.fitRectToView
ViewUtils.fitRectToViewpublic static float fitDrawableToView()
Convenient alternative for which creates rectangle from intrinsic size of DrawableViewUtils.fitRectToView
ViewUtils.fitRectToViewpublic static float fitRectToView()