ContextKt
public final class ContextKt
Summary
Public methods |
|
|---|---|
static final T |
<T extends Object> getSystemService(@NonNull Context receiver)Return the handle to a system-level service by class. |
static final void |
withStyledAttributes(Executes |
static final void |
withStyledAttributes(Executes |
Public methods
getSystemService
public static final T <T extends Object> getSystemService(@NonNull Context receiver)
Return the handle to a system-level service by class.
| See also | |
|---|---|
getSystemService |
withStyledAttributes
public static final void withStyledAttributes(
@NonNull Context receiver,
@StyleRes int resourceId,
@NonNull int[] attrs,
@NonNull Function1<@NonNull TypedArray, Unit> block
)
Executes block on a TypedArray receiver. The TypedArray holds the values defined by the style resource resourceId which are listed in attrs.
withStyledAttributes
public static final void withStyledAttributes(
@NonNull Context receiver,
AttributeSet set,
@NonNull int[] attrs,
@AttrRes int defStyleAttr,
@StyleRes int defStyleRes,
@NonNull Function1<@NonNull TypedArray, Unit> block
)
Executes block on a TypedArray receiver. The TypedArray holds the attribute values in set that are listed in attrs. In addition, if the given AttributeSet specifies a style class (through the style attribute), that style will be applied on top of the base attributes it defines.
| Parameters | |
|---|---|
AttributeSet set |
The base set of attribute values. |
@NonNull int[] attrs |
The desired attributes to be retrieved. These attribute IDs must be sorted in ascending order. |
@AttrRes int defStyleAttr |
An attribute in the current theme that contains a reference to a style resource that supplies defaults values for the |
@StyleRes int defStyleRes |
A resource identifier of a style resource that supplies default values for the |
@NonNull Function1<@NonNull TypedArray, Unit> block |
The block that will be executed. |