@Override public void resume () { inputManager.registerInputDeviceListener(this, ((AndroidApplication)Gdx.app).handler); Gdx.app.log(TAG, "controller life cycle listener resumed"); }
@Override public void pause () { inputManager.unregisterInputDeviceListener(this); Gdx.app.log(TAG, "controller life cycle listener paused"); }
boolean sPen = false; if(Build.VERSION.SDK_INT > 15) { InputManager inptmgr = (InputManager)getSystemService(INPUT_SERVICE); int[] inputs = inptmgr.getInputDeviceIds(); for(int i = 0;i<inputs.length;i++) { if(inptmgr.getInputDevice(inputs[i]).getName().toLowerCase().contains("pen")) sPen = true; } }
@Override protected void onResume() { super.onResume(); // Register an input device listener to watch when input devices are // added, removed or reconfigured. mInputManager.registerInputDeviceListener(this, null); // Query all input devices. // We do this so that we can see them in the log as they are enumerated. int[] ids = mInputManager.getInputDeviceIds(); for (int i = 0; i < ids.length; i++) { getInputDeviceState(ids[i]); } }
@Override public InputDevice getInputDevice(int id) { return mInputManager.getInputDevice(id); }
@Override public int[] getInputDeviceIds() { return mInputManager.getInputDeviceIds(); }
public Core(){ setPreferredSize(screenSize); addKeyListener(new InputManager()); initEntities(); }
InputManager im = (InputManager) getSystemService(Context.INPUT_SERVICE); im.injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
iInputManager.injectInputEvent( new KeyEvent(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(), KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MENU, 0),1); iInputManager.injectInputEvent( new KeyEvent(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(), KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_V, 0),1); iInputManager.injectInputEvent( new KeyEvent(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(), KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MENU, 0),1); iInputManager.injectInputEvent( new KeyEvent(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(), iInputManager.injectInputEvent( new KeyEvent(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(), KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MENU, 0),1); iInputManager.injectInputEvent( new KeyEvent(android.os.SystemClock.uptimeMillis(), android.os.SystemClock.uptimeMillis(),
boolean sPen = false; if(Build.VERSION.SDK_INT > 15) { InputManager inptmgr = (InputManager)getSystemService(INPUT_SERVICE); int[] inputs = inptmgr.getInputDeviceIds(); for(int i = 0;i<inputs.length;i++) { if(inptmgr.getInputDevice(inputs[i]).getName().toLowerCase().contains("pen")) sPen = true; } }
@Override protected void onResume() { super.onResume(); // Register an input device listener to watch when input devices are // added, removed or reconfigured. mInputManager.registerInputDeviceListener(this, null); // Query all input devices. // We do this so that we can see them in the log as they are enumerated. int[] ids = mInputManager.getInputDeviceIds(); for (int i = 0; i < ids.length; i++) { getInputDeviceState(ids[i]); } }
@Override protected void onPause() { super.onPause(); // Remove the input device listener when the activity is paused. mInputManager.unregisterInputDeviceListener(this); }
public ControllerLifeCycleListener(AndroidControllers controllers) { this.controllers = controllers; this.inputManager = (InputManager)((Context)Gdx.app).getSystemService(Context.INPUT_SERVICE); Gdx.app.addLifecycleListener(this); inputManager.registerInputDeviceListener(this, ((AndroidApplication)Gdx.app).handler); }
private InputDeviceState getInputDeviceState(int deviceId) { InputDeviceState state = mInputDeviceStates.get(deviceId); if (state == null) { final InputDevice device = mInputManager.getInputDevice(deviceId); if (device == null) { return null; } state = new InputDeviceState(device); mInputDeviceStates.put(deviceId, state); Log.i(TAG, "Device enumerated: " + state.mDevice); } return state; }
public Core(){ setPreferredSize(screenSize); addKeyListener(new InputManager()); }
if(Build.VERSION.SDK_INT > 15) { InputManager inptmgr = (InputManager)getSystemService(INPUT_SERVICE); int[] inputs = inptmgr.getInputDeviceIds(); for(int i = 0;i<inputs.length;i++) { String devicename = inptmgr.getInputDevice(inputs[i]).getName(); if(devicename.toLowerCase().contains("mouse")) { } else if(devicename.toLowerCase().contains("keyboard")) { } } }
@Override protected void onPause() { super.onPause(); // Remove the input device listener when the activity is paused. mInputManager.unregisterInputDeviceListener(this); }
@Override public void registerInputDeviceListener(InputDeviceListener listener, Handler handler) { V16InputDeviceListener v16Listener = new V16InputDeviceListener(listener); mInputManager.registerInputDeviceListener(v16Listener, handler); mListeners.put(listener, v16Listener); }
private InputDeviceState getInputDeviceState(int deviceId) { InputDeviceState state = mInputDeviceStates.get(deviceId); if (state == null) { final InputDevice device = mInputManager.getInputDevice(deviceId); if (device == null) { return null; } state = new InputDeviceState(device); mInputDeviceStates.put(deviceId, state); Log.i(TAG, "Device enumerated: " + state.mDevice); } return state; }
@Override public void unregisterInputDeviceListener(InputDeviceListener listener) { V16InputDeviceListener curListener = mListeners.remove(listener); if (null != curListener) { mInputManager.unregisterInputDeviceListener(curListener); } }