com.badlogic.gdx.backends.android
Class AndroidLiveWallpaperService.AndroidWallpaperEngine

java.lang.Object
  extended by android.service.wallpaper.WallpaperService.Engine
      extended by com.badlogic.gdx.backends.android.AndroidLiveWallpaperService.AndroidWallpaperEngine
Enclosing class:
AndroidLiveWallpaperService

public class AndroidLiveWallpaperService.AndroidWallpaperEngine
extends android.service.wallpaper.WallpaperService.Engine

Bridge between surface on which wallpaper is rendered and the wallpaper service. The problem is that there can be a group of Engines at one time and we must share libGDX application between them.

Author:
libGDX team and Jaroslaw Wisniewski

Constructor Summary
AndroidLiveWallpaperService.AndroidWallpaperEngine()
           
 
Method Summary
 android.os.Bundle onCommand(String pAction, int pX, int pY, int pZ, android.os.Bundle pExtras, boolean pResultRequested)
           
 void onCreate(android.view.SurfaceHolder surfaceHolder)
           
 void onDestroy()
           
 void onOffsetsChanged(float xOffset, float yOffset, float xOffsetStep, float yOffsetStep, int xPixelOffset, int yPixelOffset)
           
 void onPause()
           
 void onResume()
           
 void onSurfaceChanged(android.view.SurfaceHolder holder, int format, int width, int height)
          This is called immediately after any structural changes (format or size) have been made to the surface.
 void onSurfaceCreated(android.view.SurfaceHolder holder)
          Called before surface holder callbacks (ex for GLSurfaceView)! This is called immediately after the surface is first created.
 void onSurfaceDestroyed(android.view.SurfaceHolder holder)
          Called after surface holder callbacks (ex for GLSurfaceView)! This is called immediately before a surface is being destroyed.
 void onTouchEvent(android.view.MotionEvent event)
           
 void onVisibilityChanged(boolean visible)
          Called to inform you of the wallpaper becoming visible or hidden.
 
Methods inherited from class android.service.wallpaper.WallpaperService.Engine
getDesiredMinimumHeight, getDesiredMinimumWidth, getSurfaceHolder, isPreview, isVisible, onDesiredSizeChanged, onSurfaceRedrawNeeded, setOffsetNotificationsEnabled, setTouchEventsEnabled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndroidLiveWallpaperService.AndroidWallpaperEngine

public AndroidLiveWallpaperService.AndroidWallpaperEngine()
Method Detail

onCreate

public void onCreate(android.view.SurfaceHolder surfaceHolder)
Overrides:
onCreate in class android.service.wallpaper.WallpaperService.Engine

onSurfaceCreated

public void onSurfaceCreated(android.view.SurfaceHolder holder)
Called before surface holder callbacks (ex for GLSurfaceView)! This is called immediately after the surface is first created. Implementations of this should start up whatever rendering code they desire. Note that only one thread can ever draw into a Surface, so you should not draw into the Surface here if your normal rendering will be in another thread.

Overrides:
onSurfaceCreated in class android.service.wallpaper.WallpaperService.Engine

onSurfaceChanged

public void onSurfaceChanged(android.view.SurfaceHolder holder,
                             int format,
                             int width,
                             int height)
This is called immediately after any structural changes (format or size) have been made to the surface. You should at this point update the imagery in the surface. This method is always called at least once, after surfaceCreated(SurfaceHolder).

Overrides:
onSurfaceChanged in class android.service.wallpaper.WallpaperService.Engine

onVisibilityChanged

public void onVisibilityChanged(boolean visible)
Called to inform you of the wallpaper becoming visible or hidden. It is very important that a wallpaper only use CPU while it is visible..

Overrides:
onVisibilityChanged in class android.service.wallpaper.WallpaperService.Engine

onResume

public void onResume()

onPause

public void onPause()

onSurfaceDestroyed

public void onSurfaceDestroyed(android.view.SurfaceHolder holder)
Called after surface holder callbacks (ex for GLSurfaceView)! This is called immediately before a surface is being destroyed. After returning from this call, you should no longer try to access this surface. If you have a rendering thread that directly accesses the surface, you must ensure that thread is no longer touching the Surface before returning from this function. Attention! In some cases GL context may be shutdown right now! and SurfaceHolder.Surface.isVaild = false

Overrides:
onSurfaceDestroyed in class android.service.wallpaper.WallpaperService.Engine

onDestroy

public void onDestroy()
Overrides:
onDestroy in class android.service.wallpaper.WallpaperService.Engine

onCommand

public android.os.Bundle onCommand(String pAction,
                                   int pX,
                                   int pY,
                                   int pZ,
                                   android.os.Bundle pExtras,
                                   boolean pResultRequested)
Overrides:
onCommand in class android.service.wallpaper.WallpaperService.Engine

onTouchEvent

public void onTouchEvent(android.view.MotionEvent event)
Overrides:
onTouchEvent in class android.service.wallpaper.WallpaperService.Engine

onOffsetsChanged

public void onOffsetsChanged(float xOffset,
                             float yOffset,
                             float xOffsetStep,
                             float yOffsetStep,
                             int xPixelOffset,
                             int yPixelOffset)
Overrides:
onOffsetsChanged in class android.service.wallpaper.WallpaperService.Engine


Copyright © 2014. All Rights Reserved.