mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-29 05:07:40 +00:00
Merge remote-tracking branch 'kubawis/master' into mouse_pad_prefs_fix
# Conflicts: # res/values/strings.xml # res/xml/mousepadplugin_preferences.xml # src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java
This commit is contained in:
commit
118a35c304
@ -75,6 +75,9 @@
|
||||
<string name="mousepad_scroll_direction" translatable="false">mousepad_scroll_direction</string>
|
||||
<string name="gyro_mouse_enabled" translatable="false">gyro_mouse_enabled</string>
|
||||
<string name="mousepad_mouse_buttons_enabled_pref" translatable="false">mouse_buttons_enabled</string>
|
||||
<string name="gyro_mouse_enabled_title">Enable gyroscope mouse</string>
|
||||
<string name="gyro_mouse_sensitivity_title">Gyroscope sensitivity</string>
|
||||
<string name="gyro_mouse_sensitivity" translatable="false">gyro_mouse_sensitivity</string>
|
||||
<string-array name="mousepad_tap_entries">
|
||||
<item>Left click</item>
|
||||
<item>Right click</item>
|
||||
|
@ -55,6 +55,7 @@ public class MousePadActivity
|
||||
private int scrollDirection = 1;
|
||||
private boolean allowGyro = false;
|
||||
private boolean gyroEnabled = false;
|
||||
private int gyroscopeSensitivity = 100;
|
||||
private boolean isScrolling = false;
|
||||
private float accumulatedDistanceY = 0;
|
||||
|
||||
@ -98,27 +99,25 @@ public class MousePadActivity
|
||||
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);
|
||||
});
|
||||
BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, plugin -> plugin.sendMouseDelta(nX, nY));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -479,6 +478,7 @@ public class MousePadActivity
|
||||
}
|
||||
|
||||
allowGyro = isGyroSensorAvailable() && prefs.getBoolean(getString(R.string.gyro_mouse_enabled), false);
|
||||
if (allowGyro) 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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user