2022-10-26 18:39:04 +02:00
|
|
|
package android.view;
|
|
|
|
|
|
2023-09-19 17:37:14 +05:00
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
2022-10-26 18:39:04 +02:00
|
|
|
public class InputDevice {
|
2023-08-12 13:09:33 +02:00
|
|
|
|
|
|
|
|
public static final int SOURCE_CLASS_BUTTON = 0x00000001;
|
2023-09-19 17:37:14 +05:00
|
|
|
public static final int SOURCE_CLASS_JOYSTICK = 0x00000010;
|
|
|
|
|
public static final int SOURCE_CLASS_GAMEPAD = 0x00000400 | SOURCE_CLASS_BUTTON;
|
2023-08-12 13:09:33 +02:00
|
|
|
public static final int SOURCE_KEYBOARD = 0x00000100 | SOURCE_CLASS_BUTTON;
|
|
|
|
|
|
2023-09-19 17:37:14 +05:00
|
|
|
|
2022-10-26 18:39:04 +02:00
|
|
|
public static int[] getDeviceIds() {
|
2023-06-22 11:45:46 +02:00
|
|
|
return new int[] {0}; // might work?
|
2022-10-26 18:39:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static InputDevice getDevice(int id) {
|
2023-09-19 17:37:14 +05:00
|
|
|
return new InputDevice();
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-08 22:33:47 +02:00
|
|
|
public int getSources() {
|
|
|
|
|
return 0; // FIXME
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-19 17:37:14 +05:00
|
|
|
/*
|
|
|
|
|
* FIXME: We pretend we can do literally everything here...
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public boolean[] hasKeys(int... keys) {
|
|
|
|
|
boolean[] ret = new boolean[keys.length];
|
|
|
|
|
for (int i = 0; i < keys.length; i++) {
|
|
|
|
|
ret[i] = true;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<InputDevice.MotionRange>getMotionRanges() {
|
|
|
|
|
MotionRange[] ranges = new MotionRange[32];
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ranges.length; i++) {
|
|
|
|
|
ranges[i] = new MotionRange(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new ArrayList<InputDevice.MotionRange>();
|
2022-10-26 18:39:04 +02:00
|
|
|
}
|
2023-09-19 17:37:14 +05:00
|
|
|
|
2023-09-12 23:18:47 +02:00
|
|
|
public boolean supportsSource(int source) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-19 17:37:14 +05:00
|
|
|
public class MotionRange {
|
|
|
|
|
int axis;
|
|
|
|
|
|
|
|
|
|
public MotionRange(int axis) {
|
|
|
|
|
this.axis = axis;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getAxis() {
|
|
|
|
|
return this.axis;
|
|
|
|
|
}
|
|
|
|
|
};
|
2022-10-26 18:39:04 +02:00
|
|
|
}
|