Ejemplo n.º 1
0
 /** {@inheritDoc} */
 public void onTouchModeChanged(boolean isInTouchMode) {
   if (!isInTouchMode) {
     // leaving touch mode.. if nothing has focus, let's give it to
     // the indicator of the current tab
     if (!mCurrentView.hasFocus() || mCurrentView.isFocused()) {
       mTabWidget.getChildTabViewAt(mCurrentTab).requestFocus();
     }
   }
 }
Ejemplo n.º 2
0
  @Override
  public boolean dispatchKeyEvent(KeyEvent event) {
    final boolean handled = super.dispatchKeyEvent(event);

    // unhandled key ups change focus to tab indicator for embedded activities
    // when there is nothing that will take focus from default focus searching
    if (!handled
        && (event.getAction() == KeyEvent.ACTION_DOWN)
        && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP)
        && (mCurrentView.isRootNamespace())
        && (mCurrentView.hasFocus())
        && (mCurrentView.findFocus().focusSearch(View.FOCUS_UP) == null)) {
      mTabWidget.getChildTabViewAt(mCurrentTab).requestFocus();
      playSoundEffect(SoundEffectConstants.NAVIGATION_UP);
      return true;
    }
    return handled;
  }
Ejemplo n.º 3
0
 public View getCurrentTabView() {
   if (mCurrentTab >= 0 && mCurrentTab < mTabSpecs.size()) {
     return mTabWidget.getChildTabViewAt(mCurrentTab);
   }
   return null;
 }