2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 05:37:43 +00:00

add option for Left click to be triggered when pressing two or three fingers

This commit is contained in:
Piyush Aggarwal 2021-07-16 05:47:33 +05:30 committed by Albert Vaca Cintora
parent bf40545e11
commit 9b4c4ff9cb
2 changed files with 15 additions and 1 deletions

View File

@ -70,6 +70,7 @@
<string name="mousepad_scroll_direction_title">Reverse Scrolling Direction</string>
<string name="mousepad_scroll_direction" translatable="false">mousepad_scroll_direction</string>
<string-array name="mousepad_tap_entries">
<item>Left click</item>
<item>Right click</item>
<item>Middle click</item>
<item>Nothing</item>
@ -79,6 +80,7 @@
<string name="mousepad_default_sensitivity" translatable="false">default</string>
<string name="mousepad_default_acceleration_profile" translatable="false">medium</string>
<string-array name="mousepad_tap_values" translatable="false">
<item>left</item>
<item>right</item>
<item>middle</item>
<item>none</item>

View File

@ -55,10 +55,12 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
private KeyListenerView keyListenerView;
enum ClickType {
RIGHT, MIDDLE, NONE;
LEFT, RIGHT, MIDDLE, NONE;
static ClickType fromString(String s) {
switch (s) {
case "left":
return LEFT;
case "right":
return RIGHT;
case "middle":
@ -320,6 +322,9 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
@Override
public boolean onTripleFingerTap(MotionEvent ev) {
switch (tripleTapAction) {
case LEFT:
sendLeftClick();
break;
case RIGHT:
sendRightClick();
break;
@ -334,6 +339,9 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
@Override
public boolean onDoubleFingerTap(MotionEvent ev) {
switch (doubleTapAction) {
case LEFT:
sendLeftClick();
break;
case RIGHT:
sendRightClick();
break;
@ -346,6 +354,10 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
}
private void sendLeftClick() {
BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, MousePadPlugin::sendLeftClick);
}
private void sendMiddleClick() {
BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, MousePadPlugin::sendMiddleClick);
}