mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-02 19:12:47 +02:00
Android: Make ControllerMappingHelper methods static
This class has no state.
This commit is contained in:
parent
78cb1c2914
commit
7f6be99ad9
@ -23,7 +23,6 @@ public final class MotionAlertDialog extends AlertDialog
|
||||
{
|
||||
// The selected input preference
|
||||
private final InputBindingSetting setting;
|
||||
private final ControllerMappingHelper mControllerMappingHelper;
|
||||
private final ArrayList<Float> mPreviousValues = new ArrayList<>();
|
||||
private int mPrevDeviceId = 0;
|
||||
private boolean mWaitingForEvent = true;
|
||||
@ -39,7 +38,6 @@ public final class MotionAlertDialog extends AlertDialog
|
||||
super(context);
|
||||
|
||||
this.setting = setting;
|
||||
this.mControllerMappingHelper = new ControllerMappingHelper();
|
||||
}
|
||||
|
||||
public boolean onKeyEvent(int keyCode, KeyEvent event)
|
||||
@ -48,7 +46,7 @@ public final class MotionAlertDialog extends AlertDialog
|
||||
switch (event.getAction())
|
||||
{
|
||||
case KeyEvent.ACTION_DOWN:
|
||||
if (!mControllerMappingHelper.shouldKeyBeIgnored(event.getDevice(), keyCode))
|
||||
if (!ControllerMappingHelper.shouldKeyBeIgnored(event.getDevice(), keyCode))
|
||||
{
|
||||
saveKeyInput(event);
|
||||
}
|
||||
@ -103,7 +101,7 @@ public final class MotionAlertDialog extends AlertDialog
|
||||
InputDevice.MotionRange range = motionRanges.get(i);
|
||||
int axis = range.getAxis();
|
||||
float origValue = event.getAxisValue(axis);
|
||||
float value = mControllerMappingHelper.scaleAxis(input, axis, origValue);
|
||||
float value = ControllerMappingHelper.scaleAxis(input, axis, origValue);
|
||||
if (firstEvent)
|
||||
{
|
||||
mPreviousValues.add(value);
|
||||
|
@ -8,7 +8,7 @@ import android.view.MotionEvent;
|
||||
public class ControllerMappingHelper
|
||||
{
|
||||
/** Some controllers report extra button presses that can be ignored. */
|
||||
public boolean shouldKeyBeIgnored(InputDevice inputDevice, int keyCode)
|
||||
public static boolean shouldKeyBeIgnored(InputDevice inputDevice, int keyCode)
|
||||
{
|
||||
if (isDualShock4(inputDevice)) {
|
||||
// The two analog triggers generate analog motion events as well as a keycode.
|
||||
@ -20,7 +20,7 @@ public class ControllerMappingHelper
|
||||
}
|
||||
|
||||
/** Scale an axis to be zero-centered with a proper range. */
|
||||
public float scaleAxis(InputDevice inputDevice, int axis, float value)
|
||||
public static float scaleAxis(InputDevice inputDevice, int axis, float value)
|
||||
{
|
||||
if (isDualShock4(inputDevice))
|
||||
{
|
||||
@ -43,13 +43,13 @@ public class ControllerMappingHelper
|
||||
return value;
|
||||
}
|
||||
|
||||
private boolean isDualShock4(InputDevice inputDevice)
|
||||
private static boolean isDualShock4(InputDevice inputDevice)
|
||||
{
|
||||
// Sony DualShock 4 controller
|
||||
return inputDevice.getVendorId() == 0x54c && inputDevice.getProductId() == 0x9cc;
|
||||
}
|
||||
|
||||
private boolean isXboxOneWireless(InputDevice inputDevice)
|
||||
private static boolean isXboxOneWireless(InputDevice inputDevice)
|
||||
{
|
||||
// Microsoft Xbox One controller
|
||||
return inputDevice.getVendorId() == 0x45e && inputDevice.getProductId() == 0x2e0;
|
||||
|
Loading…
Reference in New Issue
Block a user