mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 05:37:43 +00:00
Added Right and Middle Clicks as Menu Items.
I've made them as "never" to be shown on the ActionBar, until hopefully we could get icons for them. REVIEW: 119016
This commit is contained in:
parent
45fd3f88e8
commit
23463afc33
@ -3,6 +3,9 @@ package org.kde.kdeconnect.Plugins.MousePadPlugin;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.GestureDetector;
|
import android.view.GestureDetector;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
|
||||||
import org.kde.kdeconnect.BackgroundService;
|
import org.kde.kdeconnect.BackgroundService;
|
||||||
@ -35,6 +38,42 @@ public class MousePadActivity extends Activity implements GestureDetector.OnGest
|
|||||||
mDetector.setOnDoubleTapListener(this);
|
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
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
if ( mDetector.onTouchEvent(event) ) {
|
if ( mDetector.onTouchEvent(event) ) {
|
||||||
|
@ -55,6 +55,8 @@
|
|||||||
<string name="received_file_text">Tap to open \'%1s\'</string>
|
<string name="received_file_text">Tap to open \'%1s\'</string>
|
||||||
<string name="tap_to_answer">Tap to answer</string>
|
<string name="tap_to_answer">Tap to answer</string>
|
||||||
<string name="reconnect">Reconnect</string>
|
<string name="reconnect">Reconnect</string>
|
||||||
|
<string name="right_click">Send Right Click</string>
|
||||||
|
<string name="middle_click">Send Middle Click</string>
|
||||||
<string name="device_not_paired">Device not paired</string>
|
<string name="device_not_paired">Device not paired</string>
|
||||||
<string name="request_pairing">Request pairing</string>
|
<string name="request_pairing">Request pairing</string>
|
||||||
<string name="pairing_accept">Accept</string>
|
<string name="pairing_accept">Accept</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user