TypedArrayKt

Added in 1.1.0

public final class TypedArrayKt


Summary

Public methods

static final boolean

Retrieve the boolean value for the attribute at index or throws IllegalArgumentException if not defined.

static final @ColorInt int

Retrieve the color value for the attribute at index or throws IllegalArgumentException if not defined.

static final @NonNull ColorStateList
getColorStateListOrThrow(
    @NonNull TypedArray receiver,
    @StyleableRes int index
)

Retrieve the color state list value for the attribute at index or throws IllegalArgumentException if not defined.

static final float

Retrieve the dimension value for the attribute at index or throws IllegalArgumentException if not defined.

static final @Dimension int
getDimensionPixelOffsetOrThrow(
    @NonNull TypedArray receiver,
    @StyleableRes int index
)

Retrieve the dimension pixel offset value for the attribute at index or throws IllegalArgumentException if not defined.

static final @Dimension int
getDimensionPixelSizeOrThrow(
    @NonNull TypedArray receiver,
    @StyleableRes int index
)

Retrieve the dimension pixel size value for the attribute at index or throws IllegalArgumentException if not defined.

static final @NonNull Drawable

Retrieve the drawable value for the attribute at index or throws IllegalArgumentException if not defined.

static final float

Retrieve the float value for the attribute at index or throws IllegalArgumentException if not defined.

static final @NonNull Typeface
@RequiresApi(value = 26)
getFontOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the font value for the attribute at index or throws IllegalArgumentException if not defined.

static final int
getIntOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the integer value for the attribute at index or throws IllegalArgumentException if not defined.

static final int

Retrieve the integer value for the attribute at index or throws IllegalArgumentException if not defined.

static final @AnyRes int

Retrieves the resource identifier for the attribute at index or throws IllegalArgumentException if not defined.

static final @NonNull String

Retrieve the string value for the attribute at index or throws IllegalArgumentException if not defined.

static final @NonNull CharSequence[]

Retrieve the text array value for the attribute at index or throws IllegalArgumentException if not defined.

static final @NonNull CharSequence
getTextOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the text value for the attribute at index or throws IllegalArgumentException if not defined.

static final @NonNull R
<R extends Object> use(
    @NonNull TypedArray receiver,
    @NonNull Function1<@NonNull TypedArray, @NonNull R> block
)

Executes the given block function on this TypedArray and then recycles it.

Public methods

getBooleanOrThrow

public static final boolean getBooleanOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the boolean value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getBoolean

getColorOrThrow

public static final @ColorInt int getColorOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the color value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getColor

getColorStateListOrThrow

public static final @NonNull ColorStateList getColorStateListOrThrow(
    @NonNull TypedArray receiver,
    @StyleableRes int index
)

Retrieve the color state list value for the attribute at index or throws IllegalArgumentException if not defined.

getDimensionOrThrow

public static final float getDimensionOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the dimension value for the attribute at index or throws IllegalArgumentException if not defined.

getDimensionPixelOffsetOrThrow

public static final @Dimension int getDimensionPixelOffsetOrThrow(
    @NonNull TypedArray receiver,
    @StyleableRes int index
)

Retrieve the dimension pixel offset value for the attribute at index or throws IllegalArgumentException if not defined.

getDimensionPixelSizeOrThrow

public static final @Dimension int getDimensionPixelSizeOrThrow(
    @NonNull TypedArray receiver,
    @StyleableRes int index
)

Retrieve the dimension pixel size value for the attribute at index or throws IllegalArgumentException if not defined.

getDrawableOrThrow

public static final @NonNull Drawable getDrawableOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the drawable value for the attribute at index or throws IllegalArgumentException if not defined.

getFloatOrThrow

public static final float getFloatOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the float value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getFloat

getFontOrThrow

@RequiresApi(value = 26)
public static final @NonNull Typeface getFontOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the font value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getFont

getIntOrThrow

public static final int getIntOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the integer value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getInt

getIntegerOrThrow

public static final int getIntegerOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the integer value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getInteger

getResourceIdOrThrow

public static final @AnyRes int getResourceIdOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieves the resource identifier for the attribute at index or throws IllegalArgumentException if not defined.

getStringOrThrow

public static final @NonNull String getStringOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the string value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getString

getTextArrayOrThrow

public static final @NonNull CharSequence[] getTextArrayOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the text array value for the attribute at index or throws IllegalArgumentException if not defined.

getTextOrThrow

public static final @NonNull CharSequence getTextOrThrow(@NonNull TypedArray receiver, @StyleableRes int index)

Retrieve the text value for the attribute at index or throws IllegalArgumentException if not defined.

See also
hasValue
getText

use

public static final @NonNull R <R extends Object> use(
    @NonNull TypedArray receiver,
    @NonNull Function1<@NonNull TypedArray, @NonNull R> block
)

Executes the given block function on this TypedArray and then recycles it.

See also
use