class LocationButton : ViewGroup


A widget that provides a session-based precise location permission button. It either draws the button remotely rendered by the system on Build.VERSION_CODES.CINNAMON_BUN and above platforms, or falls back to a locally rendered button on platforms before Build.VERSION_CODES.CINNAMON_BUN.

On platforms before Build.VERSION_CODES.CINNAMON_BUN, the button click delegates to OnRequestPermissionsListener if provided, allowing the app to handle the click manually (e.g., by requesting permissions or displaying rationale). If no custom listener is provided, the library automatically requests location permissions.

Summary

Public constructors

LocationButton(
    context: Context,
    attrs: AttributeSet?,
    defStyleAttr: Int,
    defStyleRes: Int
)

Public functions

open Unit
addView(child: View?)
open Unit
addView(child: View?, index: Int)
open Unit
addView(child: View?, params: ViewGroup.LayoutParams?)
open Unit
addView(child: View?, index: Int, params: ViewGroup.LayoutParams?)
open Unit
addView(child: View?, width: Int, height: Int)
Int

Gets the composition order of the underlying SurfaceView.

open Unit
Unit

Controls the composition order of the underlying SurfaceView.

Unit

Sets the corner radius of the button background.

Unit
setIconTint(color: Int)

Sets the color tint applied to the location icon.

Unit

Sets the listener to receive remote session errors on Build.VERSION_CODES.CINNAMON_BUN and above platforms.

Unit

Sets the listener to receive permission results.

Unit

Sets the listener to handle permission requests on platforms before Build.VERSION_CODES.CINNAMON_BUN.

open Unit
setPadding(left: Int, top: Int, right: Int, bottom: Int)
open Unit
setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int)
Unit

Sets the corner radius of the button background when the user presses it.

Unit

Sets the width of the button's outer stroke border.

Unit
setStrokeWidth(strokeWidth: Int)

Sets the width of the button's outer stroke border.

Unit
setTextColor(color: Int)

Sets the color of the text displayed inside the button.

Unit
setTextType(textType: Int)

Sets the text content displayed inside the button.

Protected functions

open Boolean
addViewInLayout(child: View?, index: Int, params: ViewGroup.LayoutParams?)
open Unit
open Unit
open Unit
open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)
open Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
open Unit
onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int)

Public properties

Activity?

The Activity that hosts this button.

Extension functions

Unit

Sets the LocationButtonProvider to provide a location button.

Inherited functions

From android.view.accessibility.AccessibilityEventSource
From android.graphics.drawable.Drawable.Callback
open Unit
open Unit
scheduleDrawable(who: Drawable, what: Runnable, when: Long)
open Unit
From android.view.KeyEvent.Callback
open Boolean
onKeyDown(keyCode: Int, event: KeyEvent)
open Boolean
onKeyLongPress(keyCode: Int, event: KeyEvent)
open Boolean
onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent)
open Boolean
onKeyUp(keyCode: Int, event: KeyEvent)
From android.view.View
open Unit
open Unit
addExtraDataToAccessibilityNodeInfo(
    info: AccessibilityNodeInfo,
    extraDataKey: String,
    arguments: Bundle?
)
open Unit
addFocusables(views: ArrayList<View>, direction: Int)
open Unit
addFocusables(views: ArrayList<View>, direction: Int, focusableMode: Int)
open Unit
addKeyboardNavigationClusters(
    views: MutableCollection<View>,
    direction: Int
)
open Unit
open Unit
open Unit
open Unit
open ViewPropertyAnimator
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Boolean
open Boolean
awakenScrollBars(startDelay: Int)
open Boolean
awakenScrollBars(startDelay: Int, invalidate: Boolean)
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Unit
open Unit
Unit
open Boolean
open Unit
open Unit
open Unit
open Unit
open Int
open Int
open Int
open Unit
open WindowInsets
open Int
open Int
open Int
open AccessibilityNodeInfo
open Unit
open Unit

This function is deprecated. Deprecated in Java

open WindowInsets
open Boolean
open Unit
open Unit
dispatchCreateViewTranslationRequest(
    viewIds: MutableMap<AutofillIdLongArray>,
    supportedFormats: IntArray,
    capability: TranslationCapability?,
    requests: MutableList<ViewTranslationRequest>
)
open Unit
open Boolean
open Unit
open Unit
open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean)
open Boolean
dispatchNestedPreFling(velocityX: Float, velocityY: Float)
open Boolean
dispatchNestedPrePerformAccessibilityAction(
    action: Int,
    arguments: Bundle?
)
open Boolean
dispatchNestedPreScroll(
    dx: Int,
    dy: Int,
    consumed: IntArray?,
    offsetInWindow: IntArray?
)
open Boolean
dispatchNestedScroll(
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int,
    offsetInWindow: IntArray?
)
open Unit
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
dispatchScrollCaptureSearch(
    localVisibleRect: Rect,
    windowOffset: Point,
    targets: Consumer<ScrollCaptureTarget>
)
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Boolean
open Boolean
open Boolean
dispatchUnhandledMove(focused: View, direction: Int)
open Unit
dispatchVisibilityChanged(changedView: View, visibility: Int)
open Unit
open Unit
open Unit
open WindowInsets
open WindowInsetsAnimation.Bounds
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
draw(canvas: Canvas)
open Unit
open Unit
open View
OnBackInvokedDispatcher?
T
<T : View> findViewById(id: Int)
T
<T : View> findViewWithTag(tag: Any)
open Unit
findViewsWithText(
    outViews: ArrayList<View>,
    text: CharSequence,
    flags: Int
)
open Boolean

This function is deprecated. Deprecated in Java

open View
focusSearch(direction: Int)
open Unit
forceHasOverlappingRendering(hasOverlappingRendering: Boolean)
open Unit
open Boolean
open Unit
generateDisplayHash(
    hashAlgorithm: String,
    bounds: Rect?,
    executor: Executor,
    callback: DisplayHashResultCallback
)
open IntArray
open Unit
getDrawingRect(outRect: Rect)
open ArrayList<View>
getFocusables(direction: Int)
open Unit
Boolean
open Boolean
getGlobalVisibleRect(r: Rect, globalOffset: Point)
open Unit
getHitRect(outRect: Rect)
open Int
@ViewDebug.ExportedProperty(category = "layout", mapping = [@ViewDebug.IntToString(from = 0, to = "RESOLVED_DIRECTION_LTR"), @ViewDebug.IntToString(from = 1, to = "RESOLVED_DIRECTION_RTL")])
getLayoutDirection()
Boolean
open Unit
open Unit
open Unit
ViewParent
open ViewParent
open Int
@ViewDebug.ExportedProperty(category = "text", mapping = [@ViewDebug.IntToString(from = 0, to = "INHERIT"), @ViewDebug.IntToString(from = 1, to = "GRAVITY"), @ViewDebug.IntToString(from = 2, to = "TEXT_START"), @ViewDebug.IntToString(from = 3, to = "TEXT_END"), @ViewDebug.IntToString(from = 4, to = "CENTER"), @ViewDebug.IntToString(from = 5, to = "VIEW_START"), @ViewDebug.IntToString(from = 6, to = "VIEW_END")])
getTextAlignment()
open Int
@ViewDebug.ExportedProperty(category = "text", mapping = [@ViewDebug.IntToString(from = 0, to = "INHERIT"), @ViewDebug.IntToString(from = 1, to = "FIRST_STRONG"), @ViewDebug.IntToString(from = 2, to = "ANY_RTL"), @ViewDebug.IntToString(from = 3, to = "LTR"), @ViewDebug.IntToString(from = 4, to = "RTL"), @ViewDebug.IntToString(from = 5, to = "LOCALE"), @ViewDebug.IntToString(from = 6, to = "FIRST_STRONG_LTR"), @ViewDebug.IntToString(from = 7, to = "FIRST_STRONG_RTL")])
getTextDirection()
open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Unit
open Unit
invalidate(dirty: Rect)

This function is deprecated. Deprecated in Java

open Unit
invalidate(l: Int, t: Int, r: Int, b: Int)

This function is deprecated. Deprecated in Java

open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Unit
open View
keyboardNavigationClusterSearch(currentCluster: View, direction: Int)
Unit
layout(l: Int, t: Int, r: Int, b: Int)
Unit
measure(widthMeasureSpec: Int, heightMeasureSpec: Int)
open Unit
open Unit
open Unit
open Unit
open WindowInsets
open Unit
open Boolean
open Boolean
open Unit
open IntArray
open InputConnection
open Unit
onCreateViewTranslationRequest(
    supportedFormats: IntArray,
    requestsCollector: Consumer<ViewTranslationRequest>
)
open Unit
onCreateVirtualViewTranslationRequests(
    virtualIds: LongArray,
    supportedFormats: IntArray,
    requestsCollector: Consumer<ViewTranslationRequest>
)
open Unit
open Boolean
open Unit
onDraw(canvas: Canvas)
open Unit
Unit
open Boolean
open Unit
open Unit
open Unit
onFocusChanged(
    gainFocus: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect?
)
open Boolean
open Unit
open Boolean
open Unit
open Unit
open Boolean
onKeyPreIme(keyCode: Int, event: KeyEvent)
open Boolean
onKeyShortcut(keyCode: Int, event: KeyEvent)
open Unit
onOverScrolled(
    scrollX: Int,
    scrollY: Int,
    clampedX: Boolean,
    clampedY: Boolean
)
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open ContentInfo?
open PointerIcon
onResolvePointerIcon(event: MotionEvent, pointerIndex: Int)
open Unit
open Unit
onRtlPropertiesChanged(layoutDirection: Int)
open Parcelable?
open Unit
onScreenStateChanged(screenState: Int)
open Unit
onScrollCaptureSearch(
    localVisibleRect: Rect,
    windowOffset: Point,
    targets: Consumer<ScrollCaptureTarget>
)
open Unit
onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int)
open Boolean
onSetAlpha(alpha: Int)
open Unit
open Boolean
open Boolean
open Unit
open Unit
open Unit
open Unit
onVisibilityChanged(changedView: View, visibility: Int)
open Unit
onWindowFocusChanged(hasWindowFocus: Boolean)
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Boolean
overScrollBy(
    deltaX: Int,
    deltaY: Int,
    scrollX: Int,
    scrollY: Int,
    scrollRangeX: Int,
    scrollRangeY: Int,
    maxOverScrollX: Int,
    maxOverScrollY: Int,
    isTouchEvent: Boolean
)
open Boolean
performAccessibilityAction(action: Int, arguments: Bundle?)
open Boolean
open Boolean
open Boolean
open Boolean
performHapticFeedback(feedbackConstant: Int)
open Boolean
open Boolean
performHapticFeedback(feedbackConstant: Int, flags: Int)
open Boolean
open Boolean
open ContentInfo?
open Unit
playSoundEffect(soundConstant: Int)
open Boolean
post(action: Runnable)
open Boolean
postDelayed(action: Runnable, delayMillis: Long)
open Unit
open Unit
postInvalidate(left: Int, top: Int, right: Int, bottom: Int)
open Unit
postInvalidateDelayed(delayMilliseconds: Long)
open Unit
postInvalidateDelayed(
    delayMilliseconds: Long,
    left: Int,
    top: Int,
    right: Int,
    bottom: Int
)
open Unit
open Unit
postInvalidateOnAnimation(left: Int, top: Int, right: Int, bottom: Int)
open Unit
open Unit
postOnAnimationDelayed(action: Runnable, delayMillis: Long)
open Unit
open Unit
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

Boolean
Boolean
requestFocus(direction: Int)
open Boolean
requestFocus(direction: Int, previouslyFocusedRect: Rect)
Boolean
open Unit
open Unit
open Unit
open Boolean
open Boolean
requestRectangleOnScreen(rectangle: Rect, immediate: Boolean)
open Boolean
requestRectangleOnScreen(rectangle: Rect, immediate: Boolean, source: Int)
Unit
Unit
T
<T : View> requireViewById(id: Int)
open Unit
open Boolean
open Unit
Unit
saveAttributeDataForStyleable(
    context: Context,
    styleable: IntArray,
    attrs: AttributeSet?,
    t: TypedArray,
    defStyleAttr: Int,
    defStyleRes: Int
)
open Unit
open Unit
scrollBy(x: Int, y: Int)
open Unit
scrollTo(x: Int, y: Int)
open Unit
setAccessibilityDataSensitive(accessibilityDataSensitive: Int)
open Unit
setAllowClickWhenDisabled(clickableWhenDisabled: Boolean)
open Unit
open Unit
open Unit
setAutofillHints(vararg autofillHints: String?)
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
setHandwritingBoundsOffsets(
    offsetLeft: Float,
    offsetTop: Float,
    offsetRight: Float,
    offsetBottom: Float
)
open Unit
setHasTransientState(hasTransientState: Boolean)
open Unit
setIsCredential(isCredential: Boolean)

This function is deprecated. Deprecated in Java

open Unit
setIsHandwritingDelegate(isHandwritingDelegate: Boolean)
open Unit
open Unit
setLayerType(layerType: Int, paint: Paint?)
Unit
setLeftTopRightBottom(left: Int, top: Int, right: Int, bottom: Int)
Unit
setMeasuredDimension(measuredWidth: Int, measuredHeight: Int)
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
setOnReceiveContentListener(
    mimeTypes: Array<String>?,
    listener: OnReceiveContentListener?
)
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
setRenderEffect(renderEffect: RenderEffect?)
Unit
open Unit
open Unit
open Unit
setWillNotCacheDrawing(willNotCacheDrawing: Boolean)

This function is deprecated. Deprecated in Java

open Unit
setWillNotDraw(willNotDraw: Boolean)
open Unit
open Boolean
open Boolean
open ActionMode
open ActionMode
open Unit
Boolean
startDrag(
    data: ClipData,
    shadowBuilder: View.DragShadowBuilder,
    myLocalState: Any,
    flags: Int
)

This function is deprecated. Deprecated in Java

Boolean
startDragAndDrop(
    data: ClipData,
    shadowBuilder: View.DragShadowBuilder,
    myLocalState: Any,
    flags: Int
)
open Boolean
open Unit
open Unit
open Unit
open Unit
Unit
open Boolean
open Boolean

This function is deprecated. Deprecated in Java

open Boolean
@ViewDebug.ExportedProperty(category = "drawing")
willNotDraw()
From android.view.ViewGroup
open Boolean
open Boolean
addViewInLayout(
    child: View,
    index: Int,
    params: ViewGroup.LayoutParams,
    preventRequestLayout: Boolean
)
open Unit
attachLayoutAnimationParameters(
    child: View,
    params: ViewGroup.LayoutParams,
    index: Int,
    count: Int
)
open Unit
attachViewToParent(child: View, index: Int, params: ViewGroup.LayoutParams)
open Boolean
open Boolean
open Unit
open Unit
open Unit
debug(depth: Int)
open Unit
open Unit
open Unit
open Unit
detachViewsFromParent(start: Int, count: Int)
open Unit
open Unit
open Boolean
drawChild(canvas: Canvas, child: View, drawingTime: Long)
open Unit
open ViewGroup.LayoutParams
open ViewGroup.LayoutParams
open ViewGroup.LayoutParams
open View
getChildAt(index: Int)
Int
getChildDrawingOrder(drawingPosition: Int)
open Int
getChildDrawingOrder(childCount: Int, drawingPosition: Int)
open Boolean
open Int
open Unit
measureChild(
    child: View,
    parentWidthMeasureSpec: Int,
    parentHeightMeasureSpec: Int
)
open Unit
measureChildWithMargins(
    child: View,
    parentWidthMeasureSpec: Int,
    widthUsed: Int,
    parentHeightMeasureSpec: Int,
    heightUsed: Int
)
open Unit
measureChildren(widthMeasureSpec: Int, heightMeasureSpec: Int)
Unit
Unit
open Boolean
open Boolean
open Boolean
onRequestFocusInDescendants(direction: Int, previouslyFocusedRect: Rect)
open Boolean
open Unit
onViewAdded(child: View)
open Unit
open Unit
propagateRequestedFrameRate(frameRate: Float, forceOverride: Boolean)
open Unit
open Unit
open Unit
removeDetachedView(child: View, animate: Boolean)
open Unit
removeViewAt(index: Int)
open Unit
open Unit
removeViews(start: Int, count: Int)
open Unit
removeViewsInLayout(start: Int, count: Int)
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Boolean
open Unit
open Unit
open Unit
From android.view.ViewManager
open Unit
open Unit
From android.view.ViewParent
open Unit
open Unit
open Unit
childHasTransientStateChanged(
    child: View,
    childHasTransientState: Boolean
)
open Unit
open OnBackInvokedDispatcher?
open View
focusSearch(focused: View, direction: Int)
open Unit
open Boolean
getChildVisibleRect(child: View, r: Rect, offset: Point)
Unit
invalidateChild(child: View, dirty: Rect)

This function is deprecated. Deprecated in Java

open ViewParent
invalidateChildInParent(location: IntArray, dirty: Rect)

This function is deprecated. Deprecated in Java

open Unit
notifySubtreeAccessibilityStateChanged(
    child: View,
    source: View,
    changeType: Int
)
open Unit
onDescendantInvalidated(child: View, target: View)
open Boolean
onNestedFling(
    target: View,
    velocityX: Float,
    velocityY: Float,
    consumed: Boolean
)
open Boolean
onNestedPreFling(target: View, velocityX: Float, velocityY: Float)
open Boolean
onNestedPrePerformAccessibilityAction(
    target: View,
    action: Int,
    args: Bundle?
)
open Unit
onNestedPreScroll(target: View, dx: Int, dy: Int, consumed: IntArray)
open Unit
onNestedScroll(
    target: View,
    dxConsumed: Int,
    dyConsumed: Int,
    dxUnconsumed: Int,
    dyUnconsumed: Int
)
open Unit
onNestedScrollAccepted(child: View, target: View, axes: Int)
open Boolean
onStartNestedScroll(child: View, target: View, nestedScrollAxes: Int)
open Unit
open Unit
open Unit
requestChildFocus(child: View, focused: View)
open Boolean
requestChildRectangleOnScreen(
    child: View,
    rectangle: Rect,
    immediate: Boolean
)
open Boolean
requestChildRectangleOnScreen(
    child: View,
    rectangle: Rect,
    immediate: Boolean,
    source: Int
)
open Unit
open Boolean
open Unit
open Boolean
open Boolean
showContextMenuForChild(originalView: View, x: Float, y: Float)
open ActionMode
startActionModeForChild(
    originalView: View,
    callback: ActionMode.Callback
)
open ActionMode
startActionModeForChild(
    originalView: View,
    callback: ActionMode.Callback,
    type: Int
)

Inherited properties

From android.view.View
open View.AccessibilityDelegate
open Int
open AccessibilityNodeProvider
open CharSequence?
open Int
open Int
open String?
open String?
open Float
open Animation
open Matrix?
open IBinder
open MutableMap<IntInt>
open Array<String>?
AutofillId
open Int
open AutofillValue?
open Drawable
open BlendMode?
open ColorStateList?
open PorterDuff.Mode?
open Int
Int
open Float
open Int
open Float
open Rect
Boolean
ContentCaptureSession?
open CharSequence
Int
Context
open ContextMenu.ContextMenuInfo
Boolean
open Display
IntArray
open Bitmap
open Int
open Int
open Long
open Float
open Int
open Boolean
open Boolean
open Int
open Drawable
open Int
open BlendMode?
open ColorStateList?
open PorterDuff.Mode?
open Float
open Handler
open Float
open Float
open Float
open Float
open Int
open Runnable?
Boolean
Int
open Int
open Int
open Drawable?
open Drawable?
open Int
open Int
open Int
open Int
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Boolean
Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Boolean
Boolean
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open KeyEvent.DispatcherState
open Int
open Int
open Int
open ViewGroup.LayoutParams
Int
open Float
open Int
open Matrix
Int
Int
Int
Int
Int
open Int
open Int
open Int
open Int
open Int
open Int
open Int
open Int
open View.OnFocusChangeListener
open Int
open ViewOutlineProvider
open Int
open Int
open Int
open Int
open Int
open Int
open Int
open Int
final ViewParent
open ViewParent
OutcomeReceiver<GetCredentialResponseGetCredentialException>?
GetCredentialRequest?
open Float
open Float
open PointerIcon
MutableList<Rect>
open Array<String>?
open Float
open Resources
Boolean
Int
open Float
open Int
open AttachedSurfaceControl?
open View
open WindowInsets
open Float
open Float
open Float
open Float
open Float
open Int
open Int
open Int
open Int
open Int
open Int
Int
Int
open Int
open Int
CharSequence?
open StateListAnimator
open Int
open Int
open CharSequence?
open MutableList<Rect>
open Int
open Any
open Int
open Int
open CharSequence?
Int
open Float
open Int
open TouchDelegate
open ArrayList<View>
open Float
open String
open Float
open Float
open Float
open Long
open Int
open Int
open Drawable?
open Drawable?
open Int
open ViewTranslationResponse?
open ViewTreeObserver
open Int
Int
open Int
open WindowId
open WindowInsetsController?
open Int
open IBinder
open Int
open Float
open Float
open Float
From android.view.ViewGroup

Constants

TEXT_TYPE_NEAR_MY_PRECISE_LOCATION

const val TEXT_TYPE_NEAR_MY_PRECISE_LOCATIONInt

TEXT_TYPE_NEAR_YOUR_PRECISE_LOCATION

const val TEXT_TYPE_NEAR_YOUR_PRECISE_LOCATIONInt

TEXT_TYPE_NONE

const val TEXT_TYPE_NONEInt

TEXT_TYPE_PRECISE_LOCATION

const val TEXT_TYPE_PRECISE_LOCATIONInt

TEXT_TYPE_SHARE_PRECISE_LOCATION

const val TEXT_TYPE_SHARE_PRECISE_LOCATIONInt

TEXT_TYPE_USE_PRECISE_LOCATION

const val TEXT_TYPE_USE_PRECISE_LOCATIONInt

Public constructors

LocationButton

Added in 1.0.0-alpha01
LocationButton(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = R.attr.locationButtonStyle,
    defStyleRes: Int = R.style.Widget_AndroidXCore_LocationButton
)

Public functions

addView

open fun addView(child: View?): Unit

addView

open fun addView(child: View?, index: Int): Unit

addView

open fun addView(child: View?, params: ViewGroup.LayoutParams?): Unit

addView

open fun addView(child: View?, index: Int, params: ViewGroup.LayoutParams?): Unit

addView

open fun addView(child: View?, width: Int, height: Int): Unit

getCompositionOrder

Added in 1.0.0-alpha01
fun getCompositionOrder(): Int

Gets the composition order of the underlying SurfaceView.

Returns
Int

The exact Z-order integer.

setBackgroundColor

open fun setBackgroundColor(color: Int): Unit

setCompositionOrder

Added in 1.0.0-alpha01
fun setCompositionOrder(order: Int): Unit

Controls the composition order of the underlying SurfaceView.

By default, this is set on Top in Z-order, as this button is a secure system component.

  • For developers migrating from legacy SurfaceView APIs:

  • setZOrderOnTop(true) is equivalent to passing 1.

  • setZOrderOnTop(false) is equivalent to passing -2.

Parameters
order: Int

The exact Z-order integer. Default is 1 (on top of the app window).

setCornerRadius

Added in 1.0.0-alpha01
fun setCornerRadius(radius: Float): Unit

Sets the corner radius of the button background.

Parameters
radius: Float

The desired corner radius in pixels.

setIconTint

Added in 1.0.0-alpha01
fun setIconTint(color: Int): Unit

Sets the color tint applied to the location icon.

Parameters
color: Int

The resolved ARGB color integer.

setOnErrorListener

Added in 1.0.0-alpha01
fun setOnErrorListener(listener: OnErrorListener?): Unit

Sets the listener to receive remote session errors on Build.VERSION_CODES.CINNAMON_BUN and above platforms.

Parameters
listener: OnErrorListener?

The OnErrorListener that will handle callbacks, or null to clear a previously set listener.

setOnPermissionResultListener

Added in 1.0.0-alpha01
fun setOnPermissionResultListener(listener: OnPermissionResultListener?): Unit

Sets the listener to receive permission results.

Note: On platforms before Build.VERSION_CODES.CINNAMON_BUN, if you rely on the default permission request flow (i.e. you do not provide a custom OnRequestPermissionsListener), the hosting Activity must implement androidx.activity.result.ActivityResultRegistryOwner and the LocationButton must have an android:id to deliver the permission result to this listener.

Parameters
listener: OnPermissionResultListener?

The OnPermissionResultListener that will handle callbacks, or null to clear a previously set listener.

setOnRequestPermissionsListener

Added in 1.0.0-alpha01
fun setOnRequestPermissionsListener(listener: OnRequestPermissionsListener?): Unit

Sets the listener to handle permission requests on platforms before Build.VERSION_CODES.CINNAMON_BUN.

Provide this listener if you want to customize the permission request flow (e.g. to show rationale) or if the hosting Activity does not implement androidx.activity.result.ActivityResultRegistryOwner on platforms before Build.VERSION_CODES.CINNAMON_BUN.

Parameters
listener: OnRequestPermissionsListener?

The OnRequestPermissionsListener that will handle callbacks, or null to clear a previously set listener.

setPadding

open fun setPadding(left: Int, top: Int, right: Int, bottom: Int): Unit

setPaddingRelative

open fun setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int): Unit

setPressedCornerRadius

Added in 1.0.0-alpha01
fun setPressedCornerRadius(radius: Float): Unit

Sets the corner radius of the button background when the user presses it.

Parameters
radius: Float

The desired pressed-state corner radius in pixels.

setStrokeColor

Added in 1.0.0-alpha01
fun setStrokeColor(color: Int): Unit

Sets the width of the button's outer stroke border.

Parameters
color: Int

The resolved ARGB color integer.

setStrokeWidth

Added in 1.0.0-alpha01
fun setStrokeWidth(strokeWidth: Int): Unit

Sets the width of the button's outer stroke border.

Parameters
strokeWidth: Int

The desired stroke width in pixels.

setTextColor

Added in 1.0.0-alpha01
fun setTextColor(color: Int): Unit

Sets the color of the text displayed inside the button.

Parameters
color: Int

The resolved ARGB color integer.

setTextType

Added in 1.0.0-alpha01
fun setTextType(textType: Int): Unit

Sets the text content displayed inside the button.

Parameters
textType: Int

The predefined LocationButtonTextType identifier.

Protected functions

addViewInLayout

protected open fun addViewInLayout(child: View?, index: Int, params: ViewGroup.LayoutParams?): Boolean

onAttachedToWindow

protected open fun onAttachedToWindow(): Unit

onConfigurationChanged

protected open fun onConfigurationChanged(newConfig: Configuration?): Unit

onDetachedFromWindow

protected open fun onDetachedFromWindow(): Unit

onLayout

protected open fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit

onMeasure

protected open fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit

onSizeChanged

protected open fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int): Unit

Public properties

parentActivity

Added in 1.0.0-alpha01
var parentActivityActivity?

The Activity that hosts this button.

This activity is used to host the location button. If not explicitly set, the library will attempt to resolve the hosting activity by traversing the Context wrapper chain of the context passed to the constructor.

Extension functions

LocationButton.setLocationButtonProvider

@RequiresApi(value = 37)
fun LocationButton.setLocationButtonProvider(
    provider: LocationButtonProvider?
): Unit

Sets the LocationButtonProvider to provide a location button.

Parameters
provider: LocationButtonProvider?

The LocationButtonProvider to use, or null to clear.