ResType

enum ResType

This enum's constants are used to mark that Prop can receive resources of a corresponding Android resource type as values. In addition or instead of usual builder methods this will trigger generation of methods which expect Android resource values or ids as parameter values.

For example: If a CharSequence prop named title is marked as STRING, this will generate not only method title(CharSequence title) in the component builder, but also various methods that enable initializing the prop from a string resource or attribute:


  titleRes(@StringRes int resId)
  titleRes(@StringRes int resId, Object... formatArgs)
  titleAttr(@AttrRes int attrResId)
  titleAttr(@AttrRes int attrResId, @StringRes int defResId)
And if an int prop named size is marked as DIMEN_SIZE, this will not generate a size(int size) method, but will add a bunch of other methods that accept resources:

  sizePx(@Px int sizePx)
  sizeRes(@DimenRes int resId)
  sizeDip(@Dimension(unit = Dimension.DP) float dip)
  sizeAttr(@AttrRes int attrResId)
  sizeAttr(@AttrRes int attrResId, @DimenRes int defResId)

See also

ArrayRes
BoolRes
IntegerRes
StringRes
DimenRes
Dimension
DrawableRes
ColorRes
ColorInt
AttrRes

Entries

Link copied to clipboard

Prop is not related to Android resources.

Link copied to clipboard

Prop's value can be set from a StringRes resource.

Link copied to clipboard

Prop's value can be set from an ArrayRes resource which contains StringRess.

Link copied to clipboard

Prop's value can be set from an IntegerRes resource.

Link copied to clipboard

Prop's value can be set from an ArrayRes resource which contains IntegerRess.

Link copied to clipboard

Prop's value can be set from a BoolRes resource.

Link copied to clipboard

Prop's value can be set from a ColorRes resource or as a ColorInt value.

Link copied to clipboard

Prop's value can be set from a DimenRes resource or as a DP or PX value.

Link copied to clipboard

Prop's value can be set from a DimenRes resource or as a DP, SP or PX value.

Link copied to clipboard

Prop's value can be set from a DimenRes resource or as a DP, SP or PX value.

Link copied to clipboard

Prop's value can be set from a DimenRes resource.

Link copied to clipboard

Prop's value can be set from a DrawableRes resource.

Functions

Link copied to clipboard
open fun valueOf(name: String): ResType

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard
open fun values(): Array<ResType>

Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.