mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-18 18:42:46 +00:00
Stop vibration on stream end
This commit is contained in:
parent
92b71588d0
commit
2f7087d6d3
@ -1268,6 +1268,8 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
if (connecting || connected) {
|
if (connecting || connected) {
|
||||||
connecting = connected = false;
|
connecting = connected = false;
|
||||||
|
|
||||||
|
controllerHandler.stop();
|
||||||
|
|
||||||
// Stop may take a few hundred ms to do some network I/O to tell
|
// Stop may take a few hundred ms to do some network I/O to tell
|
||||||
// the server we're going away and clean up. Let it run in a separate
|
// the server we're going away and clean up. Let it run in a separate
|
||||||
// thread to keep things smooth for the UI. Inside moonlight-common,
|
// thread to keep things smooth for the UI. Inside moonlight-common,
|
||||||
|
@ -155,6 +155,16 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
onInputDeviceAdded(deviceId);
|
onInputDeviceAdded(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
for (int i = 0; i < inputDeviceContexts.size(); i++) {
|
||||||
|
InputDeviceContext deviceContext = inputDeviceContexts.valueAt(i);
|
||||||
|
|
||||||
|
if (deviceContext.vibrator != null) {
|
||||||
|
deviceContext.vibrator.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean hasJoystickAxes(InputDevice device) {
|
private static boolean hasJoystickAxes(InputDevice device) {
|
||||||
return (device.getSources() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK &&
|
return (device.getSources() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK &&
|
||||||
getMotionRangeForJoystickAxis(device, MotionEvent.AXIS_X) != null &&
|
getMotionRangeForJoystickAxis(device, MotionEvent.AXIS_X) != null &&
|
||||||
|
@ -131,6 +131,9 @@ public abstract class AbstractXboxController extends AbstractController {
|
|||||||
|
|
||||||
stopped = true;
|
stopped = true;
|
||||||
|
|
||||||
|
// Cancel any rumble effects
|
||||||
|
rumble((short)0, (short)0);
|
||||||
|
|
||||||
// Stop the input thread
|
// Stop the input thread
|
||||||
if (inputThread != null) {
|
if (inputThread != null) {
|
||||||
inputThread.interrupt();
|
inputThread.interrupt();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user