Interface LocationButtonBridge
The platform half of LocationButton.
A port implements this only when the platform draws a location button of
its own -- one the system renders and the system therefore trusts, so that
a tap grants precise location for a single session without the app holding
a persistent grant. Ports that have no such control implement nothing and
com.codename1.ui.Display#getLocationButtonBridge() keeps returning null,
which makes LocationButton fall back to an
ordinary Codename One button that asks for location the usual way.
Obtained through com.codename1.ui.Display#getLocationButtonBridge().
Application code never touches it.
-
Method Summary
Modifier and TypeMethodDescriptioncreateButton(int textType, int backgroundColor, int textColor, SuccessCallback<Boolean> onResult, Runnable onUnavailable) Creates the native button.booleanTrue when this device will actually draw the system button.
-
Method Details
-
isSupported
boolean isSupported()True when this device will actually draw the system button.
Separate from the bridge merely existing, because the answer is a runtime one: Android's button is system-rendered only from API 37, and the same build of the same port runs on both sides of that line. Below the line there is no system button to render and the caller uses its own, which is also what the platform's own compatibility path would fall back to.
Returns
whether a tap will go through the system's own button
-
createButton
PeerComponent createButton(int textType, int backgroundColor, int textColor, SuccessCallback<Boolean> onResult, Runnable onUnavailable) Creates the native button.
The result reports only whether precise location was granted -- turning a grant into a fix is
LocationButton's job, and it is the same job on every port.Parameters
textType: one of theTEXT_constants onLocationButtonbackgroundColor: an RRGGBB colour, or -1 to keep the platform's owntextColor: an RRGGBB colour, or -1 to keep the platform's ownonResult: invoked with the grant result, on any threadonUnavailable: invoked, on any thread, when the system button this device promised turns out not to work -- the platform session can fail after the control is already on screen, and what is left behind is a button that draws and does nothing. The caller replaces it with its own.
Returns
the peer, or null when this device cannot draw one
-