Example usage for android.app WallpaperManager COMMAND_TAP

List of usage examples for android.app WallpaperManager COMMAND_TAP

Introduction

In this page you can find the example usage for android.app WallpaperManager COMMAND_TAP.

Prototype

String COMMAND_TAP

To view the source code for android.app WallpaperManager COMMAND_TAP.

Click Source Link

Document

Command for #sendWallpaperCommand : reported by the wallpaper host when the user taps on an empty area (not performing an action in the host).

Usage

From source file:cc.flydev.launcher.Workspace.java

protected void onWallpaperTap(MotionEvent ev) {
    final int[] position = mTempCell;
    getLocationOnScreen(position);/*from www .  j ava2s.  c  o  m*/

    int pointerIndex = ev.getActionIndex();
    position[0] += (int) ev.getX(pointerIndex);
    position[1] += (int) ev.getY(pointerIndex);

    mWallpaperManager.sendWallpaperCommand(getWindowToken(),
            ev.getAction() == MotionEvent.ACTION_UP ? WallpaperManager.COMMAND_TAP
                    : WallpaperManager.COMMAND_SECONDARY_TAP,
            position[0], position[1], 0, null);
}