Builder
class Builder
| kotlin.Any | |
| ↳ | android.app.permissionui.LocationButtonRequest.Builder |
Builder for LocationButtonRequest.
Summary
| Public constructors | |
|---|---|
Builder(width: Int, height: Int, configuration: Configuration)Creates a new Builder with the required initial properties. |
|
| Public methods | |
|---|---|
| LocationButtonRequest |
build()Builds a |
| LocationButtonRequest.Builder |
setBackgroundColor(backgroundColor: Int)Sets the background color of the button. |
| LocationButtonRequest.Builder |
setCornerRadius(cornerRadius: Float)Sets the corner radius of the button. |
| LocationButtonRequest.Builder |
setIconTint(iconTint: Int)Sets the icon tint color. |
| LocationButtonRequest.Builder |
setPaddingBottom(paddingBottom: Int)Sets the bottom padding of the button. |
| LocationButtonRequest.Builder |
setPaddingLeft(paddingLeft: Int)Sets the left padding of the button. |
| LocationButtonRequest.Builder |
setPaddingRight(paddingRight: Int)Sets the right padding of the button. |
| LocationButtonRequest.Builder |
setPaddingTop(paddingTop: Int)Sets the top padding of the button. |
| LocationButtonRequest.Builder |
setPressedCornerRadius(cornerRadius: Float)Sets the corner radius of the button when pressed. |
| LocationButtonRequest.Builder |
setStrokeColor(strokeColor: Int)Sets the stroke color of the button. |
| LocationButtonRequest.Builder |
setStrokeWidth(strokeWidth: Int)Sets the stroke width of the button. |
| LocationButtonRequest.Builder |
setTextColor(textColor: Int)Sets the text color of the button. |
| LocationButtonRequest.Builder |
setTextType(textType: Int)Sets the text type of the button. |
Public constructors
Builder
Builder(
width: Int,
height: Int,
configuration: Configuration)
Creates a new Builder with the required initial properties.
The provided width must be at least 48dp. The provided height must be between 48dp and 136dp (inclusive). Values outside these ranges will be clamped by the system during session creation and resizing.
| Parameters | |
|---|---|
width |
Int: The total width of the button in pixels. |
height |
Int: The total height of the button in pixels. |
configuration |
Configuration: The Configuration of the context hosting the button. This value cannot be null. |
Public methods
build
fun build(): LocationButtonRequest
Builds a LocationButtonRequest instance.
| Return | |
|---|---|
LocationButtonRequest |
This value cannot be null. |
setBackgroundColor
fun setBackgroundColor(backgroundColor: Int): LocationButtonRequest.Builder
Sets the background color of the button.
The system will ensure the background color is fully opaque by overriding its alpha channel to 255. If not explicitly set, it defaults to a system default color.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setCornerRadius
fun setCornerRadius(cornerRadius: Float): LocationButtonRequest.Builder
Sets the corner radius of the button.
The corner radius must be non-negative. Negative values will be clamped to 0.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setIconTint
fun setIconTint(iconTint: Int): LocationButtonRequest.Builder
Sets the icon tint color.
The system will automatically adjust the provided color if necessary to ensure it meets a minimum contrast ratio of 4.5:1 against the button's background color. If not explicitly set, it defaults to a system default color.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setPaddingBottom
fun setPaddingBottom(paddingBottom: Int): LocationButtonRequest.Builder
Sets the bottom padding of the button.
The padding must be between 0 and 8dp (inclusive). Values outside this range will be clamped. If not explicitly set, it defaults to 0.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setPaddingLeft
fun setPaddingLeft(paddingLeft: Int): LocationButtonRequest.Builder
Sets the left padding of the button.
The padding must be between 0 and 8dp (inclusive). Values outside this range will be clamped. If not explicitly set, it defaults to 0.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setPaddingRight
fun setPaddingRight(paddingRight: Int): LocationButtonRequest.Builder
Sets the right padding of the button.
The padding must be between 0 and 8dp (inclusive). Values outside this range will be clamped. If not explicitly set, it defaults to 0.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setPaddingTop
fun setPaddingTop(paddingTop: Int): LocationButtonRequest.Builder
Sets the top padding of the button.
The padding must be between 0 and 8dp (inclusive). Values outside this range will be clamped. If not explicitly set, it defaults to 0.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setPressedCornerRadius
fun setPressedCornerRadius(cornerRadius: Float): LocationButtonRequest.Builder
Sets the corner radius of the button when pressed.
The corner radius must be non-negative. Negative values will be clamped to 0.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setStrokeColor
fun setStrokeColor(strokeColor: Int): LocationButtonRequest.Builder
Sets the stroke color of the button.
If not explicitly set, the stroke color will default to the button's background color.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setStrokeWidth
fun setStrokeWidth(strokeWidth: Int): LocationButtonRequest.Builder
Sets the stroke width of the button.
The stroke width must be between 0 and 3dp (inclusive). Values outside this range will be clamped. If not explicitly set, it defaults to 0.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setTextColor
fun setTextColor(textColor: Int): LocationButtonRequest.Builder
Sets the text color of the button.
The system will automatically adjust the provided color if necessary to ensure it meets a minimum contrast ratio of 4.5:1 against the button's background color. If not explicitly set, it defaults to a system default color.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setTextType
fun setTextType(textType: Int): LocationButtonRequest.Builder
Sets the text type of the button.
Unsupported text types will be treated as LocationButtonSession.TEXT_TYPE_NONE. If not explicitly set, it defaults to LocationButtonSession.TEXT_TYPE_NONE.
| Return | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |