Ejemplo n.º 1
0
  public void setDisabledFlags(int disabledFlags, boolean force) {
    if (!force && mDisabledFlags == disabledFlags) return;

    mDisabledFlags = disabledFlags;

    final boolean disableHome = ((disabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0);
    final boolean disableRecent = ((disabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0);
    final boolean disableBack =
        ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0)
            && ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) == 0);
    final boolean disableSearch = ((disabledFlags & View.STATUS_BAR_DISABLE_SEARCH) != 0);

    ViewGroup navButtons = (ViewGroup) findViewById(SystemR.id.nav_buttons);
    if (navButtons != null) {
      LayoutTransition lt = navButtons.getLayoutTransition();
      if (lt != null) {
        if (!lt.getTransitionListeners().contains(mTransitionListener)) {
          lt.addTransitionListener(mTransitionListener);
        }
        if (!mScreenOn) {
          lt.disableTransitionType(
              LayoutTransition.CHANGE_APPEARING
                  | LayoutTransition.CHANGE_DISAPPEARING
                  | LayoutTransition.APPEARING
                  | LayoutTransition.DISAPPEARING);
        }
      }
    }
    getBackButton().setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
    getHomeButton().setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
    getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);

    final boolean showSearch = disableHome && !disableSearch;
    //        final boolean showCamera = showSearch && !mCameraDisabledByDpm;
    setVisibleOrGone(getSearchLight(), showSearch);
    //        setVisibleOrGone(getCameraButton(), showCamera);

    mBarTransitions.applyBackButtonQuiescentAlpha(mBarTransitions.getMode(), true /*animate*/);
  }
Ejemplo n.º 2
0
 @Override
 protected void onAttachedToWindow() {
   super.onAttachedToWindow();
   mBarTransitions.reloadBackground();
 }