mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-29 05:07:40 +00:00
Added a new setting to do nothing when using two/three finger taps.
This commit is contained in:
parent
e2b2e91f73
commit
c4a87ecb50
@ -28,7 +28,7 @@
|
||||
<string name="send_ping">Send ping</string>
|
||||
<string name="open_mpris_controls">Open remote control</string>
|
||||
<string name="open_mousepad">Open touchpad control</string>
|
||||
<string name="mousepad_info">Move a finger on the screen to move the mouse cursor</string>
|
||||
<string name="mousepad_info">Move a finger on the screen to move the mouse cursor. Tap for a click, and use two/three fingers for right and middle buttons. Use a long press to drag\'n drop.</string>
|
||||
<string name="mousepad_double_tap_settings_title">Set two finger tap action</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Set three finger tap action</string>
|
||||
<string name="mousepad_double_tap_key" translatable="false">mousepad_double_tap_key</string>
|
||||
@ -36,12 +36,14 @@
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Right click</item>
|
||||
<item>Middle click</item>
|
||||
<item>Nothing</item>
|
||||
</string-array>
|
||||
<string name="mousepad_double_default">right</string>
|
||||
<string name="mousepad_triple_default">middle</string>
|
||||
<string-array name="mousepad_tap_values" translatable="false">
|
||||
<item>right</item>
|
||||
<item>middle</item>
|
||||
<item>none</item>
|
||||
</string-array>
|
||||
<string name="category_connected_devices">Connected devices</string>
|
||||
<string name="category_not_paired_devices">Available devices</string>
|
||||
|
@ -58,7 +58,16 @@ public class MousePadActivity extends ActionBarActivity implements GestureDetect
|
||||
|
||||
KeyListenerView keyListenerView;
|
||||
|
||||
enum ClickType {RIGHT,MIDDLE}
|
||||
static enum ClickType {
|
||||
RIGHT, MIDDLE, NONE;
|
||||
static ClickType fromString(String s) {
|
||||
switch(s) {
|
||||
case "right": return RIGHT;
|
||||
case "middle": return MIDDLE;
|
||||
default: return NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ClickType doubleTapAction, tripleTapAction;
|
||||
|
||||
@ -85,11 +94,8 @@ public class MousePadActivity extends ActionBarActivity implements GestureDetect
|
||||
String tripleTapSetting = prefs.getString(getString(R.string.mousepad_triple_tap_key),
|
||||
getString(R.string.mousepad_triple_default));
|
||||
|
||||
doubleTapAction = getString(R.string.mousepad_right_value).equals(doubleTapSetting)?
|
||||
ClickType.RIGHT : ClickType.MIDDLE;
|
||||
tripleTapAction = getString(R.string.mousepad_right_value).equals(tripleTapSetting)?
|
||||
ClickType.RIGHT : ClickType.MIDDLE;
|
||||
|
||||
doubleTapAction = ClickType.fromString(doubleTapSetting);
|
||||
tripleTapAction = ClickType.fromString(tripleTapSetting);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
final View decorView = getWindow().getDecorView();
|
||||
@ -293,10 +299,10 @@ public class MousePadActivity extends ActionBarActivity implements GestureDetect
|
||||
case RIGHT:
|
||||
sendRightClick();
|
||||
break;
|
||||
default:
|
||||
case MIDDLE:
|
||||
sendMiddleClick();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -304,13 +310,13 @@ public class MousePadActivity extends ActionBarActivity implements GestureDetect
|
||||
@Override
|
||||
public boolean onDoubleFingerTap(MotionEvent ev) {
|
||||
switch(doubleTapAction){
|
||||
default:
|
||||
case RIGHT:
|
||||
sendRightClick();
|
||||
break;
|
||||
case MIDDLE:
|
||||
sendMiddleClick();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user