Package 

Class ResourceUtilsKt

    • Method Summary

      Modifier and Type Method Description
      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.
      final static TextStyle parseTextAppearance(Context context, @StyleRes() Integer id, Density density, Boolean setTextColors, FontFamily defaultFontFamily) Returns the given style resource ID as a TextStyle.
      final static FontFamilyWithWeight parseFontFamily(TypedArray $self, Integer index) Returns the given index as a FontFamilyWithWeight, or null if the value can't be coerced to a FontFamilyWithWeight.
      final static FontFamily parseXmlFontFamily(Resources $self, Integer id) Returns the given XML resource ID as a FontFamily, or null if the value can't be coerced to a FontFamily.
      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.
      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.
      final static CornerSize parseCornerSize(TypedArray $self, Integer index) Returns the given index as a CornerSize, or null if the value can't be coerced to a CornerSize.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
      • parseXmlFontFamily

         final static FontFamily parseXmlFontFamily(Resources $self, Integer id)

        Returns the given XML resource ID as a FontFamily, or null if 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 null if the value can't be coerced to a CornerSize.

        Parameters:
        index - Index of attribute to retrieve.