mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-02-16 18:40:46 +00:00
Use Handlers instead of Timers for one-shot events
This commit is contained in:
@@ -95,7 +95,6 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
private int lastButtonState = 0;
|
||||
|
||||
// Only 2 touches are supported
|
||||
private Timer touchTimer;
|
||||
private final TouchContext[] touchContextMap = new TouchContext[2];
|
||||
private long threeFingerDownTime = 0;
|
||||
|
||||
@@ -479,15 +478,14 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
inputManager.registerInputDeviceListener(keyboardTranslator, null);
|
||||
|
||||
// Initialize touch contexts
|
||||
touchTimer = new Timer("TouchTimer", true);
|
||||
for (int i = 0; i < touchContextMap.length; i++) {
|
||||
if (!prefConfig.touchscreenTrackpad) {
|
||||
touchContextMap[i] = new AbsoluteTouchContext(conn, i, streamView, touchTimer);
|
||||
touchContextMap[i] = new AbsoluteTouchContext(conn, i, streamView);
|
||||
}
|
||||
else {
|
||||
touchContextMap[i] = new RelativeTouchContext(conn, i,
|
||||
REFERENCE_HORIZ_RES, REFERENCE_VERT_RES,
|
||||
streamView, prefConfig, touchTimer);
|
||||
streamView, prefConfig);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1031,10 +1029,6 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (touchTimer != null) {
|
||||
touchTimer.cancel();
|
||||
}
|
||||
|
||||
InputManager inputManager = (InputManager) getSystemService(Context.INPUT_SERVICE);
|
||||
if (controllerHandler != null) {
|
||||
inputManager.unregisterInputDeviceListener(controllerHandler);
|
||||
|
||||
Reference in New Issue
Block a user