LocationButtonRequest.Builder
public
static
final
class
LocationButtonRequest.Builder
extends Object
| java.lang.Object | |
| ↳ | android.app.permissionui.LocationButtonRequest.Builder |
Builder for LocationButtonRequest.
Summary
Public constructors | |
|---|---|
Builder(int width, int height, Configuration configuration)
Creates a new Builder with the required initial properties. |
|
Public methods | |
|---|---|
LocationButtonRequest
|
build()
Builds a |
LocationButtonRequest.Builder
|
setBackgroundColor(int backgroundColor)
Sets the background color of the button. |
LocationButtonRequest.Builder
|
setCornerRadius(float cornerRadius)
Sets the corner radius of the button. |
LocationButtonRequest.Builder
|
setIconTint(int iconTint)
Sets the icon tint color. |
LocationButtonRequest.Builder
|
setPaddingBottom(int paddingBottom)
Sets the bottom padding of the button. |
LocationButtonRequest.Builder
|
setPaddingLeft(int paddingLeft)
Sets the left padding of the button. |
LocationButtonRequest.Builder
|
setPaddingRight(int paddingRight)
Sets the right padding of the button. |
LocationButtonRequest.Builder
|
setPaddingTop(int paddingTop)
Sets the top padding of the button. |
LocationButtonRequest.Builder
|
setPressedCornerRadius(float cornerRadius)
Sets the corner radius of the button when pressed. |
LocationButtonRequest.Builder
|
setStrokeColor(int strokeColor)
Sets the stroke color of the button. |
LocationButtonRequest.Builder
|
setStrokeWidth(int strokeWidth)
Sets the stroke width of the button. |
LocationButtonRequest.Builder
|
setTextColor(int textColor)
Sets the text color of the button. |
LocationButtonRequest.Builder
|
setTextType(int textType)
Sets the text type of the button. |
Inherited methods | |
|---|---|
Public constructors
Builder
public Builder (int width,
int height,
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
public LocationButtonRequest build ()
Builds a LocationButtonRequest instance.
| Returns | |
|---|---|
LocationButtonRequest |
This value cannot be null. |
setBackgroundColor
public LocationButtonRequest.Builder setBackgroundColor (int backgroundColor)
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.
| Parameters | |
|---|---|
backgroundColor |
int |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setCornerRadius
public LocationButtonRequest.Builder setCornerRadius (float cornerRadius)
Sets the corner radius of the button.
The corner radius must be non-negative. Negative values will be clamped to 0.
| Parameters | |
|---|---|
cornerRadius |
float |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setIconTint
public LocationButtonRequest.Builder setIconTint (int iconTint)
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.
| Parameters | |
|---|---|
iconTint |
int |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setPaddingBottom
public LocationButtonRequest.Builder setPaddingBottom (int paddingBottom)
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.
| Parameters | |
|---|---|
paddingBottom |
int |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setPaddingLeft
public LocationButtonRequest.Builder setPaddingLeft (int paddingLeft)
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.
| Parameters | |
|---|---|
paddingLeft |
int |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setPaddingRight
public LocationButtonRequest.Builder setPaddingRight (int paddingRight)
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.
| Parameters | |
|---|---|
paddingRight |
int |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setPaddingTop
public LocationButtonRequest.Builder setPaddingTop (int paddingTop)
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.
| Parameters | |
|---|---|
paddingTop |
int |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setPressedCornerRadius
public LocationButtonRequest.Builder setPressedCornerRadius (float cornerRadius)
Sets the corner radius of the button when pressed.
The corner radius must be non-negative. Negative values will be clamped to 0.
| Parameters | |
|---|---|
cornerRadius |
float |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setStrokeColor
public LocationButtonRequest.Builder setStrokeColor (int strokeColor)
Sets the stroke color of the button.
If not explicitly set, the stroke color will default to the button's background color.
| Parameters | |
|---|---|
strokeColor |
int |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setStrokeWidth
public LocationButtonRequest.Builder setStrokeWidth (int strokeWidth)
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.
| Parameters | |
|---|---|
strokeWidth |
int |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setTextColor
public LocationButtonRequest.Builder setTextColor (int textColor)
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.
| Parameters | |
|---|---|
textColor |
int |
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |
setTextType
public LocationButtonRequest.Builder setTextType (int textType)
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.
| Returns | |
|---|---|
LocationButtonRequest.Builder |
This value cannot be null. |