public void handleMessage(Message m) { final InputManager inputManager = InputManager.getInstance(); switch (m.what) { case MSG_PIE_GAIN_FOCUS: if (mPieContainer != null) { if (!mPieActivationListener.gainTouchFocus(mPieContainer.getWindowToken())) { mPieContainer.exit(); } } else { mPieActivationListener.restoreListenerState(); } break; } }
@Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (Intent.ACTION_BATTERY_CHANGED.equals(action)) { mBatteryLevel = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); mBatteryStatus = intent.getIntExtra( BatteryManager.EXTRA_STATUS, BatteryManager.BATTERY_STATUS_UNKNOWN); } else if (Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(action) || Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(action)) { setupNavigationItems(); } else if (Intent.ACTION_SCREEN_OFF.equals(action)) { // Give up on screen off. what's the point in pie controls if you don't see them? if (isShowing()) { mPieContainer.exit(); } } }