diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3fd701ea..01a3eb88 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -73,6 +73,9 @@
Reverse Scrolling Direction
mousepad_scroll_direction
gyro_mouse_enabled
+ Enable gyroscope mouse
+ Gyroscope sensitivity
+ gyro_mouse_sensitivity
- Left click
- Right click
diff --git a/res/xml/mousepadplugin_preferences.xml b/res/xml/mousepadplugin_preferences.xml
index 53312215..5d07d924 100644
--- a/res/xml/mousepadplugin_preferences.xml
+++ b/res/xml/mousepadplugin_preferences.xml
@@ -1,89 +1,96 @@
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:keep="@xml/mousepadplugin_preferences">
+ android:id="@+id/mousepad_single_tap_preference"
+ android:defaultValue="@string/mousepad_default_single"
+ android:entries="@array/mousepad_tap_entries"
+ android:entryValues="@array/mousepad_tap_values"
+ android:key="@string/mousepad_single_tap_key"
+ android:summary="%s"
+ android:title="@string/mousepad_single_tap_settings_title" />
+ android:id="@+id/mousepad_double_tap_preference"
+ android:defaultValue="@string/mousepad_default_double"
+ android:entries="@array/mousepad_tap_entries"
+ android:entryValues="@array/mousepad_tap_values"
+ android:key="@string/mousepad_double_tap_key"
+ android:summary="%s"
+ android:title="@string/mousepad_double_tap_settings_title" />
+ android:id="@+id/mousepad_triple_tap_preference"
+ android:defaultValue="@string/mousepad_default_triple"
+ android:entries="@array/mousepad_tap_entries"
+ android:entryValues="@array/mousepad_tap_values"
+ android:key="@string/mousepad_triple_tap_key"
+ android:summary="%s"
+ android:title="@string/mousepad_triple_tap_settings_title" />
+ android:id="@+id/mousepad_sensitivity_preference"
+ android:defaultValue="@string/mousepad_default_sensitivity"
+ android:entries="@array/mousepad_sensitivity_entries"
+ android:entryValues="@array/mousepad_sensitivity_values"
+ android:key="@string/mousepad_sensitivity_key"
+ android:summary="%s"
+ android:title="@string/mousepad_sensitivity_settings_title" />
+ android:id="@+id/mousepad_acceleration_profile_preference"
+ android:defaultValue="@string/mousepad_default_acceleration_profile"
+ android:entries="@array/mousepad_acceleration_profile_entries"
+ android:entryValues="@array/mousepad_acceleration_profile_values"
+ android:key="@string/mousepad_acceleration_profile_key"
+ android:summary="%s"
+ android:title="@string/mousepad_acceleration_profile_settings_title" />
+ android:id="@+id/mousepad_scroll_preference"
+ android:defaultValue="false"
+ android:key="@string/mousepad_scroll_direction"
+ android:title="@string/mousepad_scroll_direction_title" />
+ android:id="@+id/gyro_mouse_enabled"
+ android:defaultValue="false"
+ android:key="@string/gyro_mouse_enabled"
+ android:title="@string/gyro_mouse_enabled_title"/>
+
+
+ android:key="@string/sendkeystrokes_pref_category"
+ android:summary="@string/sendkeystrokes_pref_category_summary"
+ android:title="@string/sendkeystrokes_pref_category_title">
+ android:id="@+id/pref_keystrokes_enable"
+ android:defaultValue="true"
+ android:key="@string/pref_sendkeystrokes_enabled"
+ android:title="@string/sendkeystrokes_pref_enabled"
+ android:summary="@string/sendkeystrokes_pref_enabled_summary"
+ />
+ android:id="@+id/pref_send_safe_text_immediately"
+ android:defaultValue="true"
+ android:key="@string/pref_send_safe_text_immediately"
+ android:title="@string/sendkeystrokes_safe_text_enabled"
+ android:summary="@string/sendkeystrokes_safe_text_enabled_summary"
+ />
diff --git a/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java b/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java
index 7867b005..0afeccff 100644
--- a/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java
+++ b/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java
@@ -50,6 +50,7 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
private int scrollDirection = 1;
private boolean allowGyro = false;
private boolean gyroEnabled = false;
+ private int gyroscopeSensitivity = 100;
private boolean isScrolling = false;
private float accumulatedDistanceY = 0;
@@ -89,26 +90,26 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
public void onSensorChanged(SensorEvent event) {
float[] values = event.values;
- float X = -values[2] * 70 * mCurrentSensitivity * displayDpiMultiplier;
- float Y = -values[0] * 70 * mCurrentSensitivity * displayDpiMultiplier;
+ float X = -values[2] * 70 * (gyroscopeSensitivity/100.0f);
+ float Y = -values[0] * 70 * (gyroscopeSensitivity/100.0f);
if (X < 0.25 && X > -0.25) {
X = 0;
} else {
- X = X * mCurrentSensitivity * displayDpiMultiplier;
+ X = X * (gyroscopeSensitivity/100.0f);
}
if (Y < 0.25 && Y > -0.25) {
Y = 0;
} else {
- Y = Y * mCurrentSensitivity * displayDpiMultiplier;
+ Y = Y * (gyroscopeSensitivity/100.0f);
}
final float nX = X;
final float nY = Y;
BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, plugin -> {
- plugin.sendMouseDelta(nX, nY);
+ plugin.sendMouseDelta(nX, nY);
});
}
@@ -143,7 +144,9 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
}
if ((prefs.getBoolean(getString(R.string.gyro_mouse_enabled), false)) && (mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) != null)) {
allowGyro = true;
+ gyroscopeSensitivity = prefs.getInt(getString(R.string.gyro_mouse_sensitivity),100);
}
+
String singleTapSetting = prefs.getString(getString(R.string.mousepad_single_tap_key),
getString(R.string.mousepad_default_single));
String doubleTapSetting = prefs.getString(getString(R.string.mousepad_double_tap_key),
@@ -476,4 +479,3 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
return true;
}
}
-