Commit d7e7de40 authored by Michael Hathaway's avatar Michael Hathaway Committed by Albert Vaca Cintora
Browse files

Implemented drag'n drop in the mousepad plugin.

REVIEW: 121415
CCMAIL: michael@hathaways.me.uk
parent 59c0a061
......@@ -110,8 +110,6 @@ public class MousePadActivity extends ActionBarActivity implements GestureDetect
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (mMousePadGestureDetector.onTouchEvent(event)) {
......@@ -203,7 +201,15 @@ public class MousePadActivity extends ActionBarActivity implements GestureDetect
@Override
public void onLongPress(MotionEvent e) {
//From GestureDetector, left empty
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {
@Override
public void onServiceStart(BackgroundService service) {
Device device = service.getDevice(deviceId);
MousePadPlugin mousePadPlugin = (MousePadPlugin)device.getPlugin("plugin_mousepad");
if (mousePadPlugin == null) return;
mousePadPlugin.sendSingleHold();
}
});
}
@Override
......@@ -290,12 +296,23 @@ public class MousePadActivity extends ActionBarActivity implements GestureDetect
@Override
public void onServiceStart(BackgroundService service) {
Device device = service.getDevice(deviceId);
MousePadPlugin mousePadPlugin = (MousePadPlugin)device.getPlugin("plugin_mousepad");
MousePadPlugin mousePadPlugin = (MousePadPlugin) device.getPlugin("plugin_mousepad");
if (mousePadPlugin == null) return;
mousePadPlugin.sendRightClick();
}
});
}
private void sendSingleHold() {
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {
@Override
public void onServiceStart(BackgroundService service) {
Device device = service.getDevice(deviceId);
MousePadPlugin mousePadPlugin = (MousePadPlugin) device.getPlugin("plugin_mousepad");
if (mousePadPlugin == null) return;
mousePadPlugin.sendSingleHold();
}
});
}
private void showKeyboard() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
......
......@@ -128,6 +128,12 @@ public class MousePadPlugin extends Plugin {
device.sendPackage(np);
}
public void sendSingleHold(){
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_MOUSEPAD);
np.set("singlehold", true);
device.sendPackage(np);
}
public void sendScroll(float dx, float dy) {
NetworkPackage np = new NetworkPackage(NetworkPackage.PACKAGE_TYPE_MOUSEPAD);
np.set("scroll", true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment