ResourcesCompat

Helper for accessing features in Resources.

Types

Link copied to clipboard
abstract class FontCallback
Interface used to receive asynchronous font fetching events.
Link copied to clipboard
Provides backward-compatible implementations for new Theme APIs.

Properties

Link copied to clipboard
val ID_NULL: Int = 0
The null resource ID.

Functions

Link copied to clipboard
open fun clearCachesForTheme(@NonNull theme: @NonNull Resources.Theme)
Clears cached values associated with the specified Theme.
Link copied to clipboard
@Nullable
open fun getCachedFont(@NonNull context: @NonNull Context, @FontRes id: Int): @Nullable Typeface
Returns a cached font Typeface associated with a particular resource ID.
Link copied to clipboard
open fun getColor(@NonNull res: @NonNull Resources, @ColorRes id: Int, @Nullable theme: @Nullable Resources.Theme): Int
Returns a themed color integer associated with a particular resource ID.
Link copied to clipboard
@Nullable
open fun getColorStateList(@NonNull res: @NonNull Resources, @ColorRes id: Int, @Nullable theme: @Nullable Resources.Theme): @Nullable ColorStateList
Returns a themed color state list associated with a particular resource ID.
Link copied to clipboard
@Nullable
open fun getDrawable(@NonNull res: @NonNull Resources, @DrawableRes id: Int, @Nullable theme: @Nullable Resources.Theme): @Nullable Drawable
Return a drawable object associated with a particular resource ID and styled for the specified theme.
Link copied to clipboard
@Nullable
open fun getDrawableForDensity(@NonNull res: @NonNull Resources, @DrawableRes id: Int, density: Int, @Nullable theme: @Nullable Resources.Theme): @Nullable Drawable
Return a drawable object associated with a particular resource ID for the given screen density in DPI and styled for the specified theme.
Link copied to clipboard
open fun getFloat(@NonNull res: @NonNull Resources, @DimenRes id: Int): Float
Retrieve a floating-point value for a particular resource ID.
Link copied to clipboard
@Nullable
open fun getFont(@NonNull context: @NonNull Context, @FontRes id: Int): @Nullable Typeface
Returns a font Typeface associated with a particular resource ID.
open fun getFont(@NonNull context: @NonNull Context, @FontRes id: Int, @NonNull fontCallback: @NonNull ResourcesCompat.FontCallback, @Nullable handler: @Nullable Handler)
Returns a font Typeface associated with a particular resource ID asynchronously.
@Nullable
open fun getFont(@NonNull context: @NonNull Context, @FontRes id: Int, @NonNull value: @NonNull TypedValue, style: Int, @Nullable fontCallback: @Nullable ResourcesCompat.FontCallback): @Nullable Typeface
Used by TintTypedArray.