summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-10-13 06:10:09 -0700
committerJeff Brown <jeffbrown@google.com>2010-12-02 18:30:44 -0800
commit61b18eb2569e3d2cec85a414f83d036c17e9029f (patch)
treeec3f2f1ecffbfdc0b855301a10aa663f3e0baf1c /src
parent2a0932d0c10f620f70617702386aa3b3af03a63c (diff)
downloadandroid_packages_wallpapers_LivePicker-61b18eb2569e3d2cec85a414f83d036c17e9029f.zip
android_packages_wallpapers_LivePicker-61b18eb2569e3d2cec85a414f83d036c17e9029f.tar.gz
android_packages_wallpapers_LivePicker-61b18eb2569e3d2cec85a414f83d036c17e9029f.tar.bz2
Send tap commands when previewing live wallpapers.
This enables live wallpapers that rely on tap commands for user interaction to work during live preview. Change-Id: I3dad37702c71ae491bb2fd06edc7544515f6e3fb
Diffstat (limited to 'src')
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
index a8c91be..54b6382 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
@@ -196,10 +196,28 @@ public class LiveWallpaperPreview extends Activity {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
onUserInteraction();
}
- if (getWindow().superDispatchTouchEvent(ev)) {
- return true;
+ boolean handled = getWindow().superDispatchTouchEvent(ev);
+ if (!handled) {
+ handled = onTouchEvent(ev);
}
- return onTouchEvent(ev);
+
+ if (!handled && mWallpaperConnection != null && mWallpaperConnection.mEngine != null) {
+ int action = ev.getActionMasked();
+ try {
+ if (action == MotionEvent.ACTION_UP) {
+ mWallpaperConnection.mEngine.dispatchWallpaperCommand(
+ WallpaperManager.COMMAND_TAP,
+ (int) ev.getX(), (int) ev.getY(), 0, null);
+ } else if (action == MotionEvent.ACTION_POINTER_UP) {
+ int pointerIndex = ev.getActionIndex();
+ mWallpaperConnection.mEngine.dispatchWallpaperCommand(
+ WallpaperManager.COMMAND_SECONDARY_TAP,
+ (int) ev.getX(pointerIndex), (int) ev.getY(pointerIndex), 0, null);
+ }
+ } catch (RemoteException e) {
+ }
+ }
+ return handled;
}
class WallpaperConnection extends IWallpaperConnection.Stub implements ServiceConnection {