use of android.view.InputDevice in project android_frameworks_base by ResurrectionRemix.
the class MLand method getGameControllers.
public ArrayList getGameControllers() {
mGameControllers.clear();
int[] deviceIds = InputDevice.getDeviceIds();
for (int deviceId : deviceIds) {
InputDevice dev = InputDevice.getDevice(deviceId);
if (isGamePad(dev)) {
if (!mGameControllers.contains(deviceId)) {
mGameControllers.add(deviceId);
}
}
}
return mGameControllers;
}
use of android.view.InputDevice in project android_frameworks_base by ResurrectionRemix.
the class TaskTapPointerEventListener method onPointerEvent.
@Override
public void onPointerEvent(MotionEvent motionEvent) {
doGestureDetection(motionEvent);
final int action = motionEvent.getAction();
switch(action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
{
final int x = (int) motionEvent.getX();
final int y = (int) motionEvent.getY();
synchronized (this) {
if (!mTouchExcludeRegion.contains(x, y)) {
mService.mH.obtainMessage(H.TAP_OUTSIDE_TASK, x, y, mDisplayContent).sendToTarget();
}
}
break;
}
case MotionEvent.ACTION_MOVE:
{
if (motionEvent.getPointerCount() != 2) {
stopTwoFingerScroll();
}
break;
}
case MotionEvent.ACTION_HOVER_MOVE:
{
final int x = (int) motionEvent.getX();
final int y = (int) motionEvent.getY();
final Task task;
synchronized (mService.mWindowMap) {
task = mDisplayContent.findTaskForControlPoint(x, y);
}
InputDevice inputDevice = motionEvent.getDevice();
if (task == null || inputDevice == null) {
mPointerIconType = TYPE_NOT_SPECIFIED;
break;
}
task.getDimBounds(mTmpRect);
if (!mTmpRect.isEmpty() && !mTmpRect.contains(x, y)) {
int iconType = TYPE_DEFAULT;
if (x < mTmpRect.left) {
iconType = (y < mTmpRect.top) ? TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW : (y > mTmpRect.bottom) ? TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW : TYPE_HORIZONTAL_DOUBLE_ARROW;
} else if (x > mTmpRect.right) {
iconType = (y < mTmpRect.top) ? TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW : (y > mTmpRect.bottom) ? TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW : TYPE_HORIZONTAL_DOUBLE_ARROW;
} else if (y < mTmpRect.top || y > mTmpRect.bottom) {
iconType = TYPE_VERTICAL_DOUBLE_ARROW;
}
if (mPointerIconType != iconType) {
mPointerIconType = iconType;
inputDevice.setPointerType(iconType);
}
} else {
mPointerIconType = TYPE_NOT_SPECIFIED;
}
}
break;
case MotionEvent.ACTION_HOVER_EXIT:
mPointerIconType = TYPE_NOT_SPECIFIED;
InputDevice inputDevice = motionEvent.getDevice();
if (inputDevice != null) {
inputDevice.setPointerType(TYPE_DEFAULT);
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
{
stopTwoFingerScroll();
break;
}
}
}
use of android.view.InputDevice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class KeyboardLayoutPickerFragment method onResume.
@Override
public void onResume() {
super.onResume();
mIm.registerInputDeviceListener(this, null);
InputDevice inputDevice = mIm.getInputDeviceByDescriptor(mInputDeviceIdentifier.getDescriptor());
if (inputDevice == null) {
getActivity().finish();
return;
}
mInputDeviceId = inputDevice.getId();
updateCheckedState();
}
use of android.view.InputDevice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class KeyboardLayoutPickerFragment2 method onResume.
@Override
public void onResume() {
super.onResume();
mIm.registerInputDeviceListener(this, null);
InputDevice inputDevice = mIm.getInputDeviceByDescriptor(mInputDeviceIdentifier.getDescriptor());
if (inputDevice == null) {
getActivity().finish();
return;
}
mInputDeviceId = inputDevice.getId();
}
use of android.view.InputDevice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class KeyboardLayoutDialogFragment method onResume.
@Override
public void onResume() {
super.onResume();
mIm.registerInputDeviceListener(this, null);
InputDevice inputDevice = mIm.getInputDeviceByDescriptor(mInputDeviceIdentifier.getDescriptor());
if (inputDevice == null) {
dismiss();
return;
}
mInputDeviceId = inputDevice.getId();
}
Aggregations