Loading toruslib/torus-core/src/main/java/com/google/android/torus/core/engine/TorusEngine.kt +16 −9 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.google.android.torus.core.engine import android.app.WallpaperManager import android.app.wallpaper.WallpaperDescription import android.service.wallpaper.WallpaperService.Engine import com.google.android.torus.core.wallpaper.LiveWallpaper /** Loading @@ -25,8 +27,8 @@ import com.google.android.torus.core.wallpaper.LiveWallpaper */ interface TorusEngine { /** * Called when the engine is created. You should load the assets and initialize the * resources here. * Called when the engine is created. You should load the assets and initialize the resources * here. * * IMPORTANT: When this function is called, the surface used to render the engine has to be * ready. Loading @@ -37,13 +39,18 @@ interface TorusEngine { fun create(isFirstActiveInstance: Boolean = true) /** * Called when the [TorusEngine] resumes. * Called when the event [Engine.onApplyWallpaper] is called. * * @see Engine.onApplyWallpaper */ fun applyWallpaper(which: Int): WallpaperDescription? { return null } /** Called when the [TorusEngine] resumes. */ fun resume() /** * Called when the [TorusEngine] is paused. */ /** Called when the [TorusEngine] is paused. */ fun pause() /** Loading @@ -62,8 +69,8 @@ interface TorusEngine { fun destroy(isLastActiveInstance: Boolean = true) /** * Called when the engine changes its destination flag. The destination indicates whether * the wallpaper is drawn on home screen, lock screen, or both. It is a combination of * Called when the engine changes its destination flag. The destination indicates whether the * wallpaper is drawn on home screen, lock screen, or both. It is a combination of * [WallpaperManager.FLAG_LOCK] and/or [WallpaperManager.FLAG_SYSTEM] */ fun onWallpaperFlagsChanged(which: Int) {} Loading toruslib/torus-core/src/main/java/com/google/android/torus/core/wallpaper/LiveWallpaper.kt +5 −0 Original line number Diff line number Diff line Loading @@ -284,6 +284,11 @@ abstract class LiveWallpaper : WallpaperService() { if (wallpaperEngine is TorusTouchListener) setTouchEventsEnabled(true) } override fun onApplyWallpaper(which: Int): WallpaperDescription? { super.onApplyWallpaper(which) return wallpaperEngine.applyWallpaper(which) } override fun onSurfaceCreated(holder: SurfaceHolder) { super.onSurfaceCreated(holder) Loading Loading
toruslib/torus-core/src/main/java/com/google/android/torus/core/engine/TorusEngine.kt +16 −9 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.google.android.torus.core.engine import android.app.WallpaperManager import android.app.wallpaper.WallpaperDescription import android.service.wallpaper.WallpaperService.Engine import com.google.android.torus.core.wallpaper.LiveWallpaper /** Loading @@ -25,8 +27,8 @@ import com.google.android.torus.core.wallpaper.LiveWallpaper */ interface TorusEngine { /** * Called when the engine is created. You should load the assets and initialize the * resources here. * Called when the engine is created. You should load the assets and initialize the resources * here. * * IMPORTANT: When this function is called, the surface used to render the engine has to be * ready. Loading @@ -37,13 +39,18 @@ interface TorusEngine { fun create(isFirstActiveInstance: Boolean = true) /** * Called when the [TorusEngine] resumes. * Called when the event [Engine.onApplyWallpaper] is called. * * @see Engine.onApplyWallpaper */ fun applyWallpaper(which: Int): WallpaperDescription? { return null } /** Called when the [TorusEngine] resumes. */ fun resume() /** * Called when the [TorusEngine] is paused. */ /** Called when the [TorusEngine] is paused. */ fun pause() /** Loading @@ -62,8 +69,8 @@ interface TorusEngine { fun destroy(isLastActiveInstance: Boolean = true) /** * Called when the engine changes its destination flag. The destination indicates whether * the wallpaper is drawn on home screen, lock screen, or both. It is a combination of * Called when the engine changes its destination flag. The destination indicates whether the * wallpaper is drawn on home screen, lock screen, or both. It is a combination of * [WallpaperManager.FLAG_LOCK] and/or [WallpaperManager.FLAG_SYSTEM] */ fun onWallpaperFlagsChanged(which: Int) {} Loading
toruslib/torus-core/src/main/java/com/google/android/torus/core/wallpaper/LiveWallpaper.kt +5 −0 Original line number Diff line number Diff line Loading @@ -284,6 +284,11 @@ abstract class LiveWallpaper : WallpaperService() { if (wallpaperEngine is TorusTouchListener) setTouchEventsEnabled(true) } override fun onApplyWallpaper(which: Int): WallpaperDescription? { super.onApplyWallpaper(which) return wallpaperEngine.applyWallpaper(which) } override fun onSurfaceCreated(holder: SurfaceHolder) { super.onSurfaceCreated(holder) Loading