Commit c4a87ecb authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Added a new setting to do nothing when using two/three finger taps.

parent e2b2e91f
......@@ -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;
}
......
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