public
final
class
DeviceWearableButtonsProvider
extends Object
implements
WearableButtonsProvider
java.lang.Object
|
↳ |
androidx.wear.input.DeviceWearableButtonsProvider
|
Default implementation of WearableButtonsProvider
, that reads the button locations from
the platform.
Summary
Inherited methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
|
Public constructors
public DeviceWearableButtonsProvider ()
Public methods
getAvailableButtonKeyCodes
public int[] getAvailableButtonKeyCodes (Context context)
Get the keycodes of available hardware buttons on device. This function based on key's
locations from system property. This count includes the primary stem key as well as any
secondary stem keys available.
Parameters |
context |
Context : The context of the current activity |
Returns |
int[] |
An int array of available button keycodes, or null if no keycodes could be read.
|
getButtonInfo
public Bundle getButtonInfo (Context context,
int keycode)
Returns a bundle containing the metadata of a specific button. Currently, only location is
supported. Use with WearableInputDevice.X_KEY
and
WearableInputDevice.Y_KEY
. The key will not be
present if the information is not available for the requested keycode.
The location returned is a Cartesian coordinate where the bottom left corner of the screen
is the origin. The unit of measurement is in pixels. The coordinates do not take rotation
into account and assume that the device is in the standard upright position.
Parameters |
context |
Context : The context of the current activity |
keycode |
int : The keycode associated with the hardware button of interest |
Returns |
Bundle |
A Bundle containing the metadata for the given keycode
|