-
public class ViewUtilsUtils class for custom views.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceViewUtils.OnApplyWindowInsetsListenerWrapper around tds.androidx.core.view.OnApplyWindowInsetsListener which also passesthe initial padding set on the view. Used with doOnApplyWindowInsets.
public classViewUtils.RelativePaddingSimple data object to store the initial padding for a view.
-
Method Summary
Modifier and Type Method Description static PorterDuff.ModeparseTintMode(int value, PorterDuff.Mode defaultMode)static booleanisLayoutRtl(View view)static floatdpToPx(@NonNull() Context context, @Dimension(unit = Dimension.DP) int dp)static voidrequestFocusAndShowKeyboard(@NonNull() View view)static voiddoOnApplyWindowInsets(@NonNull() View view, @Nullable() AttributeSet attrs, int defStyleAttr, int defStyleRes)Wrapper around tds.androidx.core.view.OnApplyWindowInsetsListener that canautomatically apply inset padding based on view attributes. static voiddoOnApplyWindowInsets(@NonNull() View view, @Nullable() AttributeSet attrs, int defStyleAttr, int defStyleRes, @Nullable() ViewUtils.OnApplyWindowInsetsListener listener)Wrapper around tds.androidx.core.view.OnApplyWindowInsetsListener that canautomatically apply inset padding based on view attributes. static voiddoOnApplyWindowInsets(@NonNull() View view, @NonNull() ViewUtils.OnApplyWindowInsetsListener listener)Wrapper around tds.androidx.core.view.OnApplyWindowInsetsListener that records theinitial padding of the view and requests that insets are applied when attached. static voidrequestApplyInsetsWhenAttached(@NonNull() View view)Requests that insets should be applied to this view once it is attached. static floatgetParentAbsoluteElevation(@NonNull() View view)Returns the absolute elevation of the parent of the provided {@code view}, or in other words,the sum of the elevations of all ancestors of the{@code view}.static ViewOverlayImplgetOverlay(@Nullable() View view)Backward-compatible getOverlay. static ViewGroupgetContentView(@Nullable() View view)Returns the content view that is the parent of the provided view. static ViewOverlayImplgetContentViewOverlay(@NonNull() View view)Returns the content view overlay that can be used to add drawables on top of all other views. static voidaddOnGlobalLayoutListener(@Nullable() View view, @NonNull() ViewTreeObserver.OnGlobalLayoutListener victim)static voidremoveOnGlobalLayoutListener(@Nullable() View view, @NonNull() ViewTreeObserver.OnGlobalLayoutListener victim)static voidremoveOnGlobalLayoutListener(@NonNull() ViewTreeObserver viewTreeObserver, @NonNull() ViewTreeObserver.OnGlobalLayoutListener victim)-
-
Method Detail
-
parseTintMode
static PorterDuff.Mode parseTintMode(int value, PorterDuff.Mode defaultMode)
-
isLayoutRtl
static boolean isLayoutRtl(View view)
-
dpToPx
static float dpToPx(@NonNull() Context context, @Dimension(unit = Dimension.DP) int dp)
-
requestFocusAndShowKeyboard
static void requestFocusAndShowKeyboard(@NonNull() View view)
-
doOnApplyWindowInsets
static void doOnApplyWindowInsets(@NonNull() View view, @Nullable() AttributeSet attrs, int defStyleAttr, int defStyleRes)
Wrapper around tds.androidx.core.view.OnApplyWindowInsetsListener that canautomatically apply inset padding based on view attributes.
-
doOnApplyWindowInsets
static void doOnApplyWindowInsets(@NonNull() View view, @Nullable() AttributeSet attrs, int defStyleAttr, int defStyleRes, @Nullable() ViewUtils.OnApplyWindowInsetsListener listener)
Wrapper around tds.androidx.core.view.OnApplyWindowInsetsListener that canautomatically apply inset padding based on view attributes.
-
doOnApplyWindowInsets
static void doOnApplyWindowInsets(@NonNull() View view, @NonNull() ViewUtils.OnApplyWindowInsetsListener listener)
Wrapper around tds.androidx.core.view.OnApplyWindowInsetsListener that records theinitial padding of the view and requests that insets are applied when attached.
-
requestApplyInsetsWhenAttached
static void requestApplyInsetsWhenAttached(@NonNull() View view)
Requests that insets should be applied to this view once it is attached.
-
getParentAbsoluteElevation
static float getParentAbsoluteElevation(@NonNull() View view)
Returns the absolute elevation of the parent of the provided
{@code view}, or in other words,the sum of the elevations of all ancestors of the{@code view}.
-
getOverlay
@Nullable() static ViewOverlayImpl getOverlay(@Nullable() View view)
Backward-compatible getOverlay. TODO(b/144937975): Remove and use the officialversion from androidx when it's available.
-
getContentView
@Nullable() static ViewGroup getContentView(@Nullable() View view)
Returns the content view that is the parent of the provided view.
-
getContentViewOverlay
@Nullable() static ViewOverlayImpl getContentViewOverlay(@NonNull() View view)
Returns the content view overlay that can be used to add drawables on top of all other views.
-
addOnGlobalLayoutListener
static void addOnGlobalLayoutListener(@Nullable() View view, @NonNull() ViewTreeObserver.OnGlobalLayoutListener victim)
-
removeOnGlobalLayoutListener
static void removeOnGlobalLayoutListener(@Nullable() View view, @NonNull() ViewTreeObserver.OnGlobalLayoutListener victim)
-
removeOnGlobalLayoutListener
static void removeOnGlobalLayoutListener(@NonNull() ViewTreeObserver viewTreeObserver, @NonNull() ViewTreeObserver.OnGlobalLayoutListener victim)
-
-
-
-