mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +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;
|
||||
}
|
||||
|
||||
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 true;
|
||||
}
|
||||
case MotionEvent.ACTION_MOVE: {
|
||||
private boolean updateTouchButtonsFromEvent(MotionEvent event) {
|
||||
if (!AndroidHostInterface.hasInstanceAndEmulationThreadIsRunning())
|
||||
return false;
|
||||
|
||||
|
@ -530,6 +502,38 @@ public class TouchscreenControllerView extends FrameLayout {
|
|||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue