mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
Fix broken special buttons introduced in the previous commit
This commit is contained in:
parent
17f78bed03
commit
0d45a4e170
@ -260,7 +260,7 @@ public class ControlLayout extends FrameLayout
|
||||
|
||||
//Check if the action is cancelling, reset the lastControl button associated to the view
|
||||
if(ev.getActionMasked() == MotionEvent.ACTION_UP || ev.getActionMasked() == MotionEvent.ACTION_CANCEL){
|
||||
if(lastControlButton != null) lastControlButton.sendKeyPresses(false);
|
||||
if(lastControlButton != null) lastControlButton.sendKeyPresses(ev,false);
|
||||
mapTable.put(v, null);
|
||||
return true;
|
||||
}
|
||||
@ -276,7 +276,7 @@ public class ControlLayout extends FrameLayout
|
||||
}
|
||||
|
||||
//Release last keys
|
||||
if (lastControlButton != null) lastControlButton.sendKeyPresses(false);
|
||||
if (lastControlButton != null) lastControlButton.sendKeyPresses(ev,false);
|
||||
mapTable.put(v, null);
|
||||
|
||||
//Look for another SWIPEABLE button
|
||||
@ -288,7 +288,7 @@ public class ControlLayout extends FrameLayout
|
||||
|
||||
//Press the new key
|
||||
if(!button.equals(lastControlButton)){
|
||||
button.sendKeyPresses(true);
|
||||
button.sendKeyPresses(ev,true);
|
||||
|
||||
mapTable.put(v, button);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public class ControlButton extends androidx.appcompat.widget.AppCompatButton imp
|
||||
if(mProperties.isSwipeable && !isPointerOutOfBounds){
|
||||
//Remove keys
|
||||
if(!triggerToggle(event)) {
|
||||
sendKeyPresses(false);
|
||||
sendKeyPresses(event,false);
|
||||
}
|
||||
}
|
||||
isPointerOutOfBounds = true;
|
||||
@ -282,7 +282,7 @@ public class ControlButton extends androidx.appcompat.widget.AppCompatButton imp
|
||||
((ControlLayout) getParent()).onTouch(this, event);
|
||||
//RE-press the button
|
||||
if(mProperties.isSwipeable && !mProperties.isToggle){
|
||||
sendKeyPresses(true);
|
||||
sendKeyPresses(event,true);
|
||||
}
|
||||
}
|
||||
isPointerOutOfBounds = false;
|
||||
@ -291,7 +291,7 @@ public class ControlButton extends androidx.appcompat.widget.AppCompatButton imp
|
||||
case MotionEvent.ACTION_DOWN: // 0
|
||||
case MotionEvent.ACTION_POINTER_DOWN: // 5
|
||||
if(!mProperties.isToggle){
|
||||
sendKeyPresses(true);
|
||||
sendKeyPresses(event,true);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -306,7 +306,7 @@ public class ControlButton extends androidx.appcompat.widget.AppCompatButton imp
|
||||
isPointerOutOfBounds = false;
|
||||
|
||||
if(!triggerToggle(event)) {
|
||||
sendKeyPresses(false);
|
||||
sendKeyPresses(event,false);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -465,17 +465,19 @@ public class ControlButton extends androidx.appcompat.widget.AppCompatButton imp
|
||||
if(mProperties.isToggle){
|
||||
isToggled = !isToggled;
|
||||
invalidate();
|
||||
sendKeyPresses(isToggled);
|
||||
sendKeyPresses(event, isToggled);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendKeyPresses(boolean isDown){
|
||||
public void sendKeyPresses(MotionEvent event, boolean isDown){
|
||||
for(int keycode : mProperties.keycodes){
|
||||
if(keycode >= GLFW_KEY_UNKNOWN){
|
||||
MainActivity.sendKeyPress(keycode, CallbackBridge.getCurrentMods(), isDown);
|
||||
CallbackBridge.setModifiers(keycode, isDown);
|
||||
}else{
|
||||
super.onTouchEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user