diff --git a/src/main/java/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java b/src/main/java/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java index dea959ed..6cab94bd 100644 --- a/src/main/java/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java +++ b/src/main/java/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java @@ -3,6 +3,9 @@ package org.kde.kdeconnect.Plugins.MousePadPlugin; import android.app.Activity; import android.os.Bundle; import android.view.GestureDetector; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.MotionEvent; import org.kde.kdeconnect.BackgroundService; @@ -35,6 +38,42 @@ public class MousePadActivity extends Activity implements GestureDetector.OnGest mDetector.setOnDoubleTapListener(this); } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu_mousepad, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.menu_right_click: + 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.sendRightClick(); + } + }); + break; + case R.id.menu_middle_click: + 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.sendMiddleClick(); + } + }); + break; + } + return true; + } + @Override public boolean onTouchEvent(MotionEvent event) { if ( mDetector.onTouchEvent(event) ) { diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 81e2e36a..4ca395b8 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -55,6 +55,8 @@ Tap to open \'%1s\' Tap to answer Reconnect + Send Right Click + Send Middle Click Device not paired Request pairing Accept