mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-30 01:25:51 +00:00
Android: Update touch buttons on down as well as move
This commit is contained in:
parent
977f5b69c2
commit
b80d4d5675
|
@ -440,35 +440,7 @@ public class TouchscreenControllerView extends FrameLayout {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleTouchEvent(MotionEvent event) {
|
private boolean updateTouchButtonsFromEvent(MotionEvent event) {
|
||||||
switch (event.getActionMasked()) {
|
|
||||||
case MotionEvent.ACTION_UP: {
|
|
||||||
if (!AndroidHostInterface.hasInstanceAndEmulationThreadIsRunning())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
mGlidePairs.clear();
|
|
||||||
|
|
||||||
for (TouchscreenControllerButtonView buttonView : mButtonViews) {
|
|
||||||
buttonView.setPressed(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (TouchscreenControllerAxisView axisView : mAxisViews) {
|
|
||||||
axisView.setUnpressed();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
|
||||||
case MotionEvent.ACTION_POINTER_UP: {
|
|
||||||
int pointerID = event.getPointerId(event.getActionIndex());
|
|
||||||
if (mGlidePairs.containsKey(pointerID))
|
|
||||||
mGlidePairs.remove(pointerID);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case MotionEvent.ACTION_MOVE: {
|
|
||||||
if (!AndroidHostInterface.hasInstanceAndEmulationThreadIsRunning())
|
if (!AndroidHostInterface.hasInstanceAndEmulationThreadIsRunning())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -530,6 +502,38 @@ public class TouchscreenControllerView extends FrameLayout {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean handleTouchEvent(MotionEvent event) {
|
||||||
|
switch (event.getActionMasked()) {
|
||||||
|
case MotionEvent.ACTION_UP: {
|
||||||
|
if (!AndroidHostInterface.hasInstanceAndEmulationThreadIsRunning())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
mGlidePairs.clear();
|
||||||
|
|
||||||
|
for (TouchscreenControllerButtonView buttonView : mButtonViews) {
|
||||||
|
buttonView.setPressed(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TouchscreenControllerAxisView axisView : mAxisViews) {
|
||||||
|
axisView.setUnpressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
case MotionEvent.ACTION_POINTER_DOWN:
|
||||||
|
case MotionEvent.ACTION_POINTER_UP: {
|
||||||
|
int pointerID = event.getPointerId(event.getActionIndex());
|
||||||
|
if (mGlidePairs.containsKey(pointerID))
|
||||||
|
mGlidePairs.remove(pointerID);
|
||||||
|
|
||||||
|
return updateTouchButtonsFromEvent(event);
|
||||||
|
}
|
||||||
|
case MotionEvent.ACTION_MOVE: {
|
||||||
|
return updateTouchButtonsFromEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue