public class WallpaperService.Engine extends Object
WallpaperService.onCreateEngine()
to return your concrete Engine implementation.Constructor and Description |
---|
Engine() |
Modifier and Type | Method and Description |
---|---|
protected void |
dump(String prefix,
FileDescriptor fd,
PrintWriter out,
String[] args) |
int |
getDesiredMinimumHeight()
Convenience for
WallpaperManager.getDesiredMinimumHeight() , returning the height
that the system would like this wallpaper to run in. |
int |
getDesiredMinimumWidth()
Convenience for
WallpaperManager.getDesiredMinimumWidth() , returning the width
that the system would like this wallpaper to run in. |
SurfaceHolder |
getSurfaceHolder()
Provides access to the surface in which this wallpaper is drawn.
|
boolean |
isPreview()
Returns true if this engine is running in preview mode -- that is,
it is being shown to the user before they select it as the actual
wallpaper.
|
boolean |
isVisible()
Return whether the wallpaper is currently visible to the user,
this is the last value supplied to
onVisibilityChanged(boolean) . |
void |
onApplyWindowInsets(WindowInsets insets)
Called with the current insets that are in effect for the wallpaper.
|
Bundle |
onCommand(String action,
int x,
int y,
int z,
Bundle extras,
boolean resultRequested)
Process a command that was sent to the wallpaper with
WallpaperManager.sendWallpaperCommand(android.os.IBinder, java.lang.String, int, int, int, android.os.Bundle) . |
void |
onCreate(SurfaceHolder surfaceHolder)
Called once to initialize the engine.
|
void |
onDesiredSizeChanged(int desiredWidth,
int desiredHeight)
Called when an application has changed the desired virtual size of
the wallpaper.
|
void |
onDestroy()
Called right before the engine is going away.
|
void |
onOffsetsChanged(float xOffset,
float yOffset,
float xOffsetStep,
float yOffsetStep,
int xPixelOffset,
int yPixelOffset)
Called to inform you of the wallpaper's offsets changing
within its contain, corresponding to the container's
call to
WallpaperManager.setWallpaperOffsets() . |
void |
onSurfaceChanged(SurfaceHolder holder,
int format,
int width,
int height)
Convenience for
SurfaceHolder.Callback.surfaceChanged() . |
void |
onSurfaceCreated(SurfaceHolder holder)
Convenience for
SurfaceHolder.Callback.surfaceCreated() . |
void |
onSurfaceDestroyed(SurfaceHolder holder)
Convenience for
SurfaceHolder.Callback.surfaceDestroyed() . |
void |
onSurfaceRedrawNeeded(SurfaceHolder holder)
Convenience for
SurfaceHolder.Callback.surfaceRedrawNeeded() . |
void |
onTouchEvent(MotionEvent event)
Called as the user performs touch-screen interaction with the
window that is currently showing this wallpaper.
|
void |
onVisibilityChanged(boolean visible)
Called to inform you of the wallpaper becoming visible or
hidden.
|
void |
setFixedSizeAllowed(boolean allowed) |
void |
setOffsetNotificationsEnabled(boolean enabled)
Control whether this wallpaper will receive notifications when the wallpaper
has been scrolled.
|
void |
setTouchEventsEnabled(boolean enabled)
Control whether this wallpaper will receive raw touch events
from the window manager as the user interacts with the window
that is currently displaying the wallpaper.
|
public SurfaceHolder getSurfaceHolder()
public int getDesiredMinimumWidth()
WallpaperManager.getDesiredMinimumWidth()
, returning the width
that the system would like this wallpaper to run in.public int getDesiredMinimumHeight()
WallpaperManager.getDesiredMinimumHeight()
, returning the height
that the system would like this wallpaper to run in.public boolean isVisible()
onVisibilityChanged(boolean)
.public boolean isPreview()
public void setTouchEventsEnabled(boolean enabled)
onTouchEvent(MotionEvent)
.public void setOffsetNotificationsEnabled(boolean enabled)
enabled
- whether the wallpaper wants to receive offset notificationspublic void setFixedSizeAllowed(boolean allowed)
public void onCreate(SurfaceHolder surfaceHolder)
public void onDestroy()
public void onVisibilityChanged(boolean visible)
public void onApplyWindowInsets(WindowInsets insets)
insets
- Insets to apply.public void onTouchEvent(MotionEvent event)
public void onOffsetsChanged(float xOffset, float yOffset, float xOffsetStep, float yOffsetStep, int xPixelOffset, int yPixelOffset)
WallpaperManager.setWallpaperOffsets()
.public Bundle onCommand(String action, int x, int y, int z, Bundle extras, boolean resultRequested)
WallpaperManager.sendWallpaperCommand(android.os.IBinder, java.lang.String, int, int, int, android.os.Bundle)
.
The default implementation does nothing, and always returns null
as the result.action
- The name of the command to perform. This tells you
what to do and how to interpret the rest of the arguments.x
- Generic integer parameter.y
- Generic integer parameter.z
- Generic integer parameter.extras
- Any additional parameters.resultRequested
- If true, the caller is requesting that
a result, appropriate for the command, be returned back.public void onDesiredSizeChanged(int desiredWidth, int desiredHeight)
public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height)
SurfaceHolder.Callback.surfaceChanged()
.public void onSurfaceRedrawNeeded(SurfaceHolder holder)
SurfaceHolder.Callback.surfaceRedrawNeeded()
.public void onSurfaceCreated(SurfaceHolder holder)
SurfaceHolder.Callback.surfaceCreated()
.public void onSurfaceDestroyed(SurfaceHolder holder)
SurfaceHolder.Callback.surfaceDestroyed()
.protected void dump(String prefix, FileDescriptor fd, PrintWriter out, String[] args)