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 |
表盘的实际执行情况。 您必须实现onCreateEngine()
才能返回具体的Engine实现。
Public constructors |
|
---|---|
WatchFaceService.Engine() |
Public methods |
|
---|---|
final int |
getInterruptionFilter() 返回用户选择的中断过滤器。 |
final int |
getNotificationCount() 返回流中通知卡的总数。 |
final Rect |
getPeekCardPosition() 返回第一张偷看卡的位置。 |
final int |
getUnreadCount() 返回流中未读通知卡的数量。 |
final boolean |
isInAmbientMode() 返回表盘是否处于环境模式。 |
void |
onAmbientModeChanged(boolean inAmbientMode) 当设备进入或退出环境模式时调用。 |
Bundle |
onCommand(String action, int x, int y, int z, Bundle extras, boolean resultRequested) |
void |
onCreate(SurfaceHolder holder) |
void |
onDestroy() |
void |
onInterruptionFilterChanged(int interruptionFilter) 当用户更改中断过滤器时调用。 |
void |
onNotificationCountChanged(int count) 当流中通知卡的总数已更改时调用。 |
void |
onPeekCardPositionUpdate(Rect rect) 当第一张偷看卡位于屏幕上时调用。 |
void |
onPropertiesChanged(Bundle properties) 当确定设备的属性时调用。 |
void |
onTapCommand(int tapType, int x, int y, long eventTime) 当轻触或触摸相关事件发生时调用。 |
void |
onTimeTick() 定期调用以更新表盘显示的时间。 |
void |
onUnreadCountChanged(int count) 当流中未读通知卡的数量发生变化时调用。 |
void |
onVisibilityChanged(boolean visible) 打电话通知您表盘变得可见或隐藏。 |
void |
setWatchFaceStyle(WatchFaceStyle watchFaceStyle) 设置手表脸型。 |
Inherited methods |
|
---|---|
From class android.service.wallpaper.WallpaperService.Engine
|
|
From class java.lang.Object
|
WatchFaceService.Engine ()
int getInterruptionFilter ()
返回用户选择的中断过滤器。
Returns | |
---|---|
int |
INTERRUPTION_FILTER_NONE , INTERRUPTION_FILTER_PRIORITY , INTERRUPTION_FILTER_ALL , INTERRUPTION_FILTER_ALARMS , or INTERRUPTION_FILTER_UNKNOWN . |
int getNotificationCount ()
返回流中通知卡的总数。
Returns | |
---|---|
int |
Rect getPeekCardPosition ()
返回第一张偷看卡的位置。 这并不提供有关卡的所有移动的信息,只有当它在底部窥视并允许表面暴露时的位置。
Returns | |
---|---|
Rect |
int getUnreadCount ()
返回流中未读通知卡的数量。
Returns | |
---|---|
int |
boolean isInAmbientMode ()
返回表盘是否处于环境模式。 如果属实,则表盘应以白色显示黑色。
Returns | |
---|---|
boolean |
void onAmbientModeChanged (boolean inAmbientMode)
当设备进入或退出环境模式时调用。 在环境模式下,表盘应该切换到黑白显示。 如果表盘显示秒数,则应将其隐藏在环境模式下。
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)
当用户更改中断过滤器时调用。 表盘应调整显示的信息量。 例如,如果它显示未决电子邮件的数量,则它应该隐藏它,如果interruptionFilter等于INTERRUPTION_FILTER_NONE
。 interruptionFilter
可以是INTERRUPTION_FILTER_NONE
, INTERRUPTION_FILTER_PRIORITY
, INTERRUPTION_FILTER_ALL
, INTERRUPTION_FILTER_ALARMS
,或INTERRUPTION_FILTER_UNKNOWN
。
Parameters | |
---|---|
interruptionFilter |
int
|
void onNotificationCountChanged (int count)
当流中通知卡的总数已更改时调用。
Parameters | |
---|---|
count |
int : total number of the notification cards in the stream |
void onPeekCardPositionUpdate (Rect rect)
当第一张偷看卡位于屏幕上时调用。 这是手表表面可以改变其外观的地方,取决于卡在屏幕上的位置。 这并不提供有关卡的所有移动的信息,只有当它在底部窥视并允许表面暴露时的位置。
Parameters | |
---|---|
rect |
Rect
|
void onPropertiesChanged (Bundle properties)
当确定设备的属性时调用。 这些包括PROPERTY_BURN_IN_PROTECTION
和PROPERTY_LOW_BIT_AMBIENT
。
Parameters | |
---|---|
properties |
Bundle : a bundle containing the hardware properties |
void onTapCommand (int tapType, int x, int y, long eventTime)
当轻触或触摸相关事件发生时调用。
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 ()
定期调用以更新表盘显示的时间。 这种方法被称为:
void onUnreadCountChanged (int count)
当流中未读通知卡的数量发生变化时调用。
Parameters | |
---|---|
count |
int : number of the notification cards in the stream that haven't yet been seen by the user |
void onVisibilityChanged (boolean visible)
打电话通知您表盘变得可见或隐藏。 如果您决定重写此方法,则必须调用super.onVisibilityChanged(visible)
作为重写中的第一条语句。
Parameters | |
---|---|
visible |
boolean
|
void setWatchFaceStyle (WatchFaceStyle watchFaceStyle)
设置手表脸型。 这会影响电池指示器等UI元素如何绘制在表盘顶部。 通常在onCreate(SurfaceHolder)
调用,但可以随时调用,例如响应用户更改表面配置。 必须从壁纸线程调用。
Parameters | |
---|---|
watchFaceStyle |
WatchFaceStyle
|