-
public final class ResourceUtilsKt
-
-
Method Summary
Modifier and Type Method Description final static ColorparseColor(TypedArray $self, Integer index, Color fallbackColor)Returns the given index as a Color, or fallbackColor if the value can't be coerced to a Color. final static TextStyleparseTextAppearance(Context context, @StyleRes() Integer id, Density density, Boolean setTextColors, FontFamily defaultFontFamily)Returns the given style resource ID as a TextStyle. final static FontFamilyWithWeightparseFontFamily(TypedArray $self, Integer index)Returns the given index as a FontFamilyWithWeight, or nullif the value can't be coerced to a FontFamilyWithWeight.final static FontFamilyparseXmlFontFamily(Resources $self, Integer id)Returns the given XML resource ID as a FontFamily, or nullif the value can't be coerced to a FontFamily.final static TextUnitparseTextUnit(TypedArray $self, Integer index, Density density, TextUnit fallbackTextUnit)Returns the given index as a TextUnit, or fallbackTextUnit if the value can't be coerced to a TextUnit. final static CornerBasedShapeparseShapeAppearance(Context context, @StyleRes() Integer id, LayoutDirection layoutDirection, CornerBasedShape fallbackShape)Returns the given style resource ID as a CornerBasedShape, or fallbackShape if the value can't be coerced to a CornerBasedShape. final static CornerSizeparseCornerSize(TypedArray $self, Integer index)Returns the given index as a CornerSize, or nullif the value can't be coerced to a CornerSize.-
-
Method Detail
-
parseColor
final static Color parseColor(TypedArray $self, Integer index, Color fallbackColor)
Returns the given index as a Color, or fallbackColor if the value can't be coerced to a Color.
- Parameters:
index- Index of attribute to retrieve.fallbackColor- Value to return if the attribute is not defined or can't be coerced to a Color.
-
parseTextAppearance
final static TextStyle parseTextAppearance(Context context, @StyleRes() Integer id, Density density, Boolean setTextColors, FontFamily defaultFontFamily)
Returns the given style resource ID as a TextStyle.
- Parameters:
context- The current context.id- ID of style resource to retrieve.density- The current display density.setTextColors- Whether to read and set text colors from the style.defaultFontFamily- Optional default font family to use in TextStyles.
-
parseFontFamily
final static FontFamilyWithWeight parseFontFamily(TypedArray $self, Integer index)
Returns the given index as a FontFamilyWithWeight, or
nullif the value can't be coerced to a FontFamilyWithWeight.- Parameters:
index- Index of attribute to retrieve.
-
parseXmlFontFamily
final static FontFamily parseXmlFontFamily(Resources $self, Integer id)
Returns the given XML resource ID as a FontFamily, or
nullif the value can't be coerced to a FontFamily.- Parameters:
id- ID of XML resource to retrieve.
-
parseTextUnit
final static TextUnit parseTextUnit(TypedArray $self, Integer index, Density density, TextUnit fallbackTextUnit)
Returns the given index as a TextUnit, or fallbackTextUnit if the value can't be coerced to a TextUnit.
- Parameters:
index- Index of attribute to retrieve.density- The current display density.fallbackTextUnit- Value to return if the attribute is not defined or can't be coerced to a TextUnit.
-
parseShapeAppearance
final static CornerBasedShape parseShapeAppearance(Context context, @StyleRes() Integer id, LayoutDirection layoutDirection, CornerBasedShape fallbackShape)
Returns the given style resource ID as a CornerBasedShape, or fallbackShape if the value can't be coerced to a CornerBasedShape.
- Parameters:
context- The current context.id- ID of style resource to retrieve.layoutDirection- The current display layout direction.fallbackShape- Value to return if the style resource ID is not defined or can't be coerced to a CornerBasedShape.
-
parseCornerSize
final static CornerSize parseCornerSize(TypedArray $self, Integer index)
Returns the given index as a CornerSize, or
nullif the value can't be coerced to a CornerSize.- Parameters:
index- Index of attribute to retrieve.
-
-
-
-