Loading toruslib/torus-core/src/main/java/com/google/android/torus/core/wallpaper/LiveWallpaper.kt +13 −3 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ abstract class LiveWallpaper : WallpaperService() { const val COMMAND_GOING_TO_SLEEP = "android.wallpaper.goingtosleep" const val COMMAND_PREVIEW_INFO = "android.wallpaper.previewinfo" const val COMMAND_LOCKSCREEN_LAYOUT_CHANGED = "android.wallpaper.lockscreen_layout_changed" const val COMMAND_LOCKSCREEN_TAP_POSITION = "android.wallpaper.lockscreen_tap_position" const val WALLPAPER_FLAG_NOT_FOUND = -1 } Loading Loading @@ -208,9 +209,7 @@ abstract class LiveWallpaper : WallpaperService() { return false } /** * Returns the information if the wallpaper is visible. */ /** Returns the information if the wallpaper is visible. */ fun isVisible(): Boolean { this.wallpaperServiceEngine?.let { return it.isVisible Loading Loading @@ -414,6 +413,11 @@ abstract class LiveWallpaper : WallpaperService() { onLockscreenLayoutChanged(extras) } } COMMAND_LOCKSCREEN_TAP_POSITION -> { if (extras != null) { onLockscreenFocalAreaTap(extras) } } } if (resultRequested) return extras Loading Loading @@ -477,5 +481,11 @@ abstract class LiveWallpaper : WallpaperService() { (wallpaperEngine as LiveWallpaperEventListener).onLockscreenLayoutChanged(extras) } } fun onLockscreenFocalAreaTap(extras: Bundle) { if (wallpaperEngine is LiveWallpaperEventListener) { (wallpaperEngine as LiveWallpaperEventListener).onLockscreenFocalAreaTap(extras) } } } } toruslib/torus-core/src/main/java/com/google/android/torus/core/wallpaper/listener/LiveWallpaperEventListener.kt +7 −0 Original line number Diff line number Diff line Loading @@ -150,4 +150,11 @@ interface LiveWallpaperEventListener { // TODO: when smartspace is moved from below small clock to the right of the clock, we need to // change all smartspace bottom mentioned above to small clock bottom fun onLockscreenLayoutChanged(extras: Bundle) {} /** * Make wallpaper be able to react to short tap event on lockscreen. Tap should be within the * wallpaper focal area, extras contains position applied on wallpaper, including * "tapInWallpaperFocalAreaX" and "tapInWallpaperFocalAreaY". */ fun onLockscreenFocalAreaTap(extras: Bundle) {} } Loading
toruslib/torus-core/src/main/java/com/google/android/torus/core/wallpaper/LiveWallpaper.kt +13 −3 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ abstract class LiveWallpaper : WallpaperService() { const val COMMAND_GOING_TO_SLEEP = "android.wallpaper.goingtosleep" const val COMMAND_PREVIEW_INFO = "android.wallpaper.previewinfo" const val COMMAND_LOCKSCREEN_LAYOUT_CHANGED = "android.wallpaper.lockscreen_layout_changed" const val COMMAND_LOCKSCREEN_TAP_POSITION = "android.wallpaper.lockscreen_tap_position" const val WALLPAPER_FLAG_NOT_FOUND = -1 } Loading Loading @@ -208,9 +209,7 @@ abstract class LiveWallpaper : WallpaperService() { return false } /** * Returns the information if the wallpaper is visible. */ /** Returns the information if the wallpaper is visible. */ fun isVisible(): Boolean { this.wallpaperServiceEngine?.let { return it.isVisible Loading Loading @@ -414,6 +413,11 @@ abstract class LiveWallpaper : WallpaperService() { onLockscreenLayoutChanged(extras) } } COMMAND_LOCKSCREEN_TAP_POSITION -> { if (extras != null) { onLockscreenFocalAreaTap(extras) } } } if (resultRequested) return extras Loading Loading @@ -477,5 +481,11 @@ abstract class LiveWallpaper : WallpaperService() { (wallpaperEngine as LiveWallpaperEventListener).onLockscreenLayoutChanged(extras) } } fun onLockscreenFocalAreaTap(extras: Bundle) { if (wallpaperEngine is LiveWallpaperEventListener) { (wallpaperEngine as LiveWallpaperEventListener).onLockscreenFocalAreaTap(extras) } } } }
toruslib/torus-core/src/main/java/com/google/android/torus/core/wallpaper/listener/LiveWallpaperEventListener.kt +7 −0 Original line number Diff line number Diff line Loading @@ -150,4 +150,11 @@ interface LiveWallpaperEventListener { // TODO: when smartspace is moved from below small clock to the right of the clock, we need to // change all smartspace bottom mentioned above to small clock bottom fun onLockscreenLayoutChanged(extras: Bundle) {} /** * Make wallpaper be able to react to short tap event on lockscreen. Tap should be within the * wallpaper focal area, extras contains position applied on wallpaper, including * "tapInWallpaperFocalAreaX" and "tapInWallpaperFocalAreaY". */ fun onLockscreenFocalAreaTap(extras: Bundle) {} }