diff --git a/res/values/strings.xml b/res/values/strings.xml index e38817a5..23d10dcd 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -28,7 +28,7 @@ Send ping Open remote control Open touchpad control - Move a finger on the screen to move the mouse cursor + 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. Set two finger tap action Set three finger tap action mousepad_double_tap_key @@ -36,12 +36,14 @@ Right click Middle click + Nothing right middle right middle + none Connected devices Available devices diff --git a/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java b/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java index 7b916434..9e6aab7f 100644 --- a/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java +++ b/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java @@ -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; }