public class ViewUtils
Contains tools for usage in View animations and transformations. Also contains methods to handle major ui bug-fixes.
public static ViewUtils INSTANCE
Contains tools for usage in View animations and transformations. Also contains methods to handle major ui bug-fixes.
public float getALPHA_DEFAULT()
public float getALPHA_TRANSPARENT()
public float getSCALE_DEFAULT()
public float getTRANSLATION_DEFAULT()
@NotNull public android.view.ActionMode.Callback getDISABLED_ACTIONMODE_CALLBACK()
Use this ActionMode.Callback if action mode should be disabled
public void setDISABLED_ACTIONMODE_CALLBACK(@NotNull
android.view.ActionMode.Callback p)
Use this ActionMode.Callback if action mode should be disabled
public void saveViewTransformation(@NotNull
android.view.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.
public void restoreViewTransformation(@NotNull
android.view.View view)
Restores transformation values.
IllegalStateException - if values were corrupted (by direct invocation of View.setTag)public void postOnPreDraw(@NotNull
android.view.View view,
@NotNull
java.lang.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.
view - runnable - @NotNull
public android.graphics.Rect getViewBounds(@NotNull
android.view.View view)
public float fitBitmapToView(@Nullable
android.graphics.Bitmap bitmap,
@NotNull
android.view.View view,
float rotation)
Convenient alternative for .fitRectToView which creates rectangle from Bitmap
public float fitDrawableToView(@Nullable
android.graphics.drawable.Drawable drawable,
@NotNull
android.view.View view,
float rotation)
Convenient alternative for .fitRectToView which creates rectangle from intrinsic size of Drawable
@JvmStatic
public static float fitRectToView(@NotNull
android.view.View view,
float rotation,
@NotNull
android.graphics.RectF imageBounds)
view - View in which rectangle should fitrotation - rotation of RectF in degrees relatively to its centerimageBounds - RectF to fit