Added in API level 29

IntFlagMapping


class IntFlagMapping
kotlin.Any
   ↳ android.view.inspector.IntFlagMapping

Maps the values of an int property to sets of string for properties that encode flags. An InspectionCompanion may provide an instance of this class to a PropertyMapper for flag values packed into primitive int properties. Each flag has a mask and a target value, for non-exclusive flags, the target can also be used as the mask. A given integer value is compared against each flag to find what flags are active for it by bitwise anding it with the mask and comparing the result against the target, that is, (value & mask) == target.

Summary

Public constructors

Public methods
Unit
add(mask: Int, target: Int, name: String)

Add a mutually exclusive flag to the map.

MutableSet<String!>
get(value: Int)

Get a set of the names of enabled flags for a given property value.

Public constructors

IntFlagMapping

IntFlagMapping()

Public methods

add

Added in API level 29
fun add(
    mask: Int,
    target: Int,
    name: String
): Unit

Add a mutually exclusive flag to the map.

Parameters
mask Int: The bit mask to compare to and with a value
target Int: The target value to compare the masked value with
name String: The name of the flag to include if enabled This value cannot be null.

get

Added in API level 29
fun get(value: Int): MutableSet<String!>

Get a set of the names of enabled flags for a given property value.

Parameters
value Int: The value of the property
Return
MutableSet<String!> The names of the enabled flags, empty if no flags enabled This value cannot be null.