public
abstract
class
WatchFaceService.Engine
extends WallpaperService.Engine
java.lang.Object | ||
↳ | android.service.wallpaper.WallpaperService.Engine | |
↳ | android.support.wearable.watchface.WatchFaceService.Engine |
Known Direct Subclasses |
The actual implementation of a watch face. You must implement
onCreateEngine()
to return your concrete Engine implementation.
Public constructors | |
---|---|
WatchFaceService.Engine()
|
Public methods | |
---|---|
final
int
|
getInterruptionFilter()
Returns interruption filter selected by the user. |
final
int
|
getNotificationCount()
Returns the total number of notification cards in the stream. |
final
Rect
|
getPeekCardPosition()
Returns the location of the first peeking card. |
final
int
|
getUnreadCount()
Returns the number of unread notification cards in the stream. |
final
boolean
|
isInAmbientMode()
Returns whether the watch face is in ambient mode. |
void
|
onAmbientModeChanged(boolean inAmbientMode)
Called when the device enters or exits ambient mode. |
Bundle
|
onCommand(String action, int x, int y, int z, Bundle extras, boolean resultRequested)
|
void
|
onCreate(SurfaceHolder holder)
|
void
|
onDestroy()
|
void
|
onInterruptionFilterChanged(int interruptionFilter)
Called when the user changes interruption filter. |
void
|
onNotificationCountChanged(int count)
Called when the total number of notification cards in the stream has changed. |
void
|
onPeekCardPositionUpdate(Rect rect)
Called when the first, peeking card positions itself on the screen. |
void
|
onPropertiesChanged(Bundle properties)
Called when the properties of the device are determined. |
void
|
onTapCommand(int tapType, int x, int y, long eventTime)
Called when a tap or touch related event occurs. |
void
|
onTimeTick()
Called periodically to update the time shown by the watch face. |
void
|
onUnreadCountChanged(int count)
Called when the number of unread notification cards in the stream has changed. |
void
|
onVisibilityChanged(boolean visible)
Called to inform you of the watch face becoming visible or hidden. |
void
|
setWatchFaceStyle(WatchFaceStyle watchFaceStyle)
Sets the watch face style. |
Inherited methods | |
---|---|
From
class
android.service.wallpaper.WallpaperService.Engine
| |
From
class
java.lang.Object
|
WatchFaceService.Engine ()
int getInterruptionFilter ()
Returns interruption filter selected by the user.
Returns | |
---|---|
int |
INTERRUPTION_FILTER_NONE , INTERRUPTION_FILTER_PRIORITY ,
INTERRUPTION_FILTER_ALL , INTERRUPTION_FILTER_ALARMS ,
or INTERRUPTION_FILTER_UNKNOWN .
|
int getNotificationCount ()
Returns the total number of notification cards in the stream.
Returns | |
---|---|
int |
Rect getPeekCardPosition ()
Returns the location of the first peeking card. This doesn't provide information about all movements of the card, only about its location when it's peeking at the bottom and allowing the watch face to be exposed.
Returns | |
---|---|
Rect |
int getUnreadCount ()
Returns the number of unread notification cards in the stream.
Returns | |
---|---|
int |
boolean isInAmbientMode ()
Returns whether the watch face is in ambient mode. When true, the watch face should display in white on black.
Returns | |
---|---|
boolean |
void onAmbientModeChanged (boolean inAmbientMode)
Called when the device enters or exits ambient mode. The watch face should switch to a black and white display in ambient mode. If the watch face displays seconds, it should hide them in ambient mode.
Parameters | |
---|---|
inAmbientMode |
boolean
|
Bundle onCommand (String action, int x, int y, int z, Bundle extras, boolean resultRequested)
Parameters | |
---|---|
action |
String
|
x |
int
|
y |
int
|
z |
int
|
extras |
Bundle
|
resultRequested |
boolean
|
Returns | |
---|---|
Bundle |
void onCreate (SurfaceHolder holder)
Parameters | |
---|---|
holder |
SurfaceHolder
|
void onDestroy ()
void onInterruptionFilterChanged (int interruptionFilter)
Called when the user changes interruption filter. The watch face should adjust the
amount of information it displays. For example, if it displays the
number of pending emails, it should hide it if interruptionFilter is equal to INTERRUPTION_FILTER_NONE
. interruptionFilter
can be
INTERRUPTION_FILTER_NONE
, INTERRUPTION_FILTER_PRIORITY
,
INTERRUPTION_FILTER_ALL
, INTERRUPTION_FILTER_ALARMS
,
or INTERRUPTION_FILTER_UNKNOWN
.
Parameters | |
---|---|
interruptionFilter |
int
|
void onNotificationCountChanged (int count)
Called when the total number of notification cards in the stream has changed.
Parameters | |
---|---|
count |
int :
total number of the notification cards in the stream
|
void onPeekCardPositionUpdate (Rect rect)
Called when the first, peeking card positions itself on the screen. This is where the watch face can change its appearance depending on where the card is on the screen. This doesn't provide information about all movements of the card, only about its location when it's peeking at the bottom and allowing the watch face to be exposed.
Parameters | |
---|---|
rect |
Rect
|
void onPropertiesChanged (Bundle properties)
Called when the properties of the device are determined. These include
PROPERTY_BURN_IN_PROTECTION
and PROPERTY_LOW_BIT_AMBIENT
.
Parameters | |
---|---|
properties |
Bundle :
a bundle containing the hardware properties
|
void onTapCommand (int tapType, int x, int y, long eventTime)
Called when a tap or touch related event occurs.
Parameters | |
---|---|
tapType |
int :
Value representing the event sent to the wallpaper. |
x |
int :
X coordinate of the event. |
y |
int :
Y coordinate of the event. |
eventTime |
long :
The time, in millis, of the event.
|
void onTimeTick ()
Called periodically to update the time shown by the watch face. This method is called:
void onUnreadCountChanged (int count)
Called when the number of unread notification cards in the stream has changed.
Parameters | |
---|---|
count |
int :
number of the notification cards in the stream that haven't yet been seen by
the user
|
void onVisibilityChanged (boolean visible)
Called to inform you of the watch face becoming visible or hidden. If you decide to
override this method, you must call super.onVisibilityChanged(visible)
as the first statement in your override.
Parameters | |
---|---|
visible |
boolean
|
void setWatchFaceStyle (WatchFaceStyle watchFaceStyle)
Sets the watch face style. This affects how UI elements such as the battery indicator are
drawn on top of the watch face. Typically called in onCreate(SurfaceHolder)
but may be called
at any time, e.g. in response to the user changing the watch face configuration. Must be
called from the wallpaper thread.
Parameters | |
---|---|
watchFaceStyle |
WatchFaceStyle
|