ViewUtils

open class ViewUtils

Utils class for custom views.

Types

Link copied to clipboard
Wrapper around androidx.core.view.OnApplyWindowInsetsListener which also passes the initial padding set on the view.
Link copied to clipboard
open class RelativePadding
Simple data object to store the initial padding for a view.

Properties

Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Wrapper around androidx.core.view.OnApplyWindowInsetsListener that records the initial padding of the view and requests that insets are applied when attached.
open fun doOnApplyWindowInsets(@NonNull view: View, @Nullable attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int)
open fun doOnApplyWindowInsets(@NonNull view: View, @Nullable attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int, @Nullable listener: ViewUtils.OnApplyWindowInsetsListener)
Wrapper around androidx.core.view.OnApplyWindowInsetsListener that can automatically apply inset padding based on view attributes.
Link copied to clipboard
open fun dpToPx(@NonNull context: Context, @Dimension(unit = Dimension.DP) dp: Int): Float
Link copied to clipboard
Returns the color if it can be retrieved from the view's background drawable, or null otherwise.
Link copied to clipboard
Link copied to clipboard
Returns the content view that is the parent of the provided view.
Link copied to clipboard
Returns the content view overlay that can be used to add drawables on top of all other views.
Link copied to clipboard
Backward-compatible getOverlay.
Link copied to clipboard
Returns the absolute elevation of the parent of the provided view, or in other words, the sum of the elevations of all ancestors of the view.
Link copied to clipboard
open fun hideKeyboard(@NonNull view: View)
open fun hideKeyboard(@NonNull view: View, useWindowInsetsController: Boolean)
Link copied to clipboard
open fun isLayoutRtl(view: View): Boolean
Link copied to clipboard
open fun parseTintMode(value: Int, defaultMode: PorterDuff.Mode): PorterDuff.Mode
Link copied to clipboard
Requests that insets should be applied to this view once it is attached.
Link copied to clipboard
open fun requestFocusAndShowKeyboard(@NonNull view: View, useWindowInsetsController: Boolean)
Link copied to clipboard
open fun setBoundsFromRect(@NonNull view: View, @NonNull rect: Rect)
Link copied to clipboard
open fun showKeyboard(@NonNull view: View)
open fun showKeyboard(@NonNull view: View, useWindowInsetsController: Boolean)