List of usage examples for android.content Context INPUT_SERVICE
String INPUT_SERVICE
To view the source code for android.content Context INPUT_SERVICE.
Click Source Link
From source file:Main.java
public static boolean setCursorVisibility(Context context, boolean visible) { if (!nvExtensionSupported) { return false; }//from w ww.j av a 2 s . com try { methodSetCursorVisibility.invoke(context.getSystemService(Context.INPUT_SERVICE), visible); return true; } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return false; }
From source file:org.gearvrf.weartouchpad.WearInputService.java
@Override public void onCreate() { super.onCreate(); apiClient = new GoogleApiClient.Builder(this).addApi(Wearable.API).build(); apiClient.connect();/*from w ww . j a va 2 s .com*/ nodes = new HashSet<Node>(); receiveMessenger = new Messenger(new IncomingMsgHandler()); broadcastManager = LocalBroadcastManager.getInstance(this); localBinder = new LocalBinder(); connectedToWatch = false; int touchScreenDeviceId = 0; InputManager im = (InputManager) getSystemService(Context.INPUT_SERVICE); for (int inputDevId : im.getInputDeviceIds()) { InputDevice inputDevice = im.getInputDevice(inputDevId); if ((inputDevice.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN) { touchScreenDeviceId = inputDevId; break; } } motionEventGenerator = new MotionEventGenerator(touchScreenDeviceId); }
From source file:com.example.android.visualgamecontroller.FullscreenActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_fullscreen); final View controlsView = findViewById(R.id.fullscreen_content_controls); final View contentView = findViewById(R.id.fullscreen_content); mControllerView = (ControllerView) findViewById(R.id.controller); for (int i = 0; i < mButtons.length; i++) { mButtons[i] = 0;//from w w w. ja v a 2 s .c o m } for (int i = 0; i < mAxes.length; i++) { mAxes[i] = 0.0f; } mControllerView.setButtonsAxes(mButtons, mAxes); // Set up an instance of SystemUiHider to control the system UI for // this activity. mSystemUiHider = SystemUiHider.getInstance(this, contentView, HIDER_FLAGS); mSystemUiHider.setup(); mSystemUiHider.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() { // Cached values. int mControlsHeight; int mShortAnimTime; @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public void onVisibilityChange(boolean visible) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { // If the ViewPropertyAnimator API is available // (Honeycomb MR2 and later), use it to animate the // in-layout UI controls at the bottom of the // screen. if (mControlsHeight == 0) { mControlsHeight = controlsView.getHeight(); } if (mShortAnimTime == 0) { mShortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); } controlsView.animate().translationY(visible ? 0 : mControlsHeight).setDuration(mShortAnimTime); } else { // If the ViewPropertyAnimator APIs aren't // available, simply show or hide the in-layout UI // controls. controlsView.setVisibility(visible ? View.VISIBLE : View.GONE); } if (visible && AUTO_HIDE) { // Schedule a hide(). delayedHide(AUTO_HIDE_DELAY_MILLIS); } } }); // Set up the user interaction to manually show or hide the system UI. contentView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TOGGLE_ON_CLICK) { mSystemUiHider.toggle(); } else { mSystemUiHider.show(); } } }); mInputManager = (InputManager) getSystemService(Context.INPUT_SERVICE); checkGameControllers(); }
From source file:com.goodhustle.ouyaunitybridge.OuyaUnityActivity.java
@Override protected void onStart() { super.onStart(); // Immediately request an up-to-date copy of receipts. requestReceipts();/*w w w. j a v a 2 s .c o m*/ // Register to receive notifications about account changes. This will re-query the receipt // list in order to ensure it is always up to date for whomever is logged in. accountsChangedFilter = new IntentFilter(); accountsChangedFilter.addAction(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION); registerReceiver(mAuthChangeReceiver, accountsChangedFilter); // listen for controller changes - http://developer.android.com/reference/android/hardware/input/InputManager.html#registerInputDeviceListener%28android.hardware.input.InputManager.InputDeviceListener,%20android.os.Handler%29 Context context = getBaseContext(); mInputManager = (InputManager) context.getSystemService(Context.INPUT_SERVICE); mInputManager.registerInputDeviceListener(this, null); sendDevices(); }