Exemple #1
0
 /**
  * Fetch the Drawable icon corresponding to the given panel.
  *
  * @param panel to fetch icon for.
  * @return Drawable instance, or null if no icon is being displayed, or the icon does not exist.
  */
 public Drawable getIconDrawable(Panel panel) {
   return mTabWidget.getIconDrawable(panel.ordinal());
 }
Exemple #2
0
 public void setIconDrawable(Panel panel, int resource) {
   mTabWidget.setIconDrawable(panel.ordinal(), resource);
 }
Exemple #3
0
  public void show(Panel panelToShow) {
    if (!isShown()) setVisibility(View.VISIBLE);

    if (mPanel != null) {
      // Hide the old panel.
      mPanel.hide();
    }

    final boolean showAnimation = !mVisible;
    mVisible = true;
    mCurrentPanel = panelToShow;

    int index = panelToShow.ordinal();
    mTabWidget.setCurrentTab(index);

    switch (panelToShow) {
      case NORMAL_TABS:
        mPanel = mPanelNormal;
        break;
      case PRIVATE_TABS:
        mPanel = mPanelPrivate;
        break;
      case REMOTE_TABS:
        mPanel = mPanelRemote;
        break;

      default:
        throw new IllegalArgumentException("Unknown panel type " + panelToShow);
    }
    mPanel.show();

    if (mCurrentPanel == Panel.REMOTE_TABS) {
      if (mFooter != null) mFooter.setVisibility(View.GONE);

      mAddTab.setVisibility(View.INVISIBLE);

      mMenuButton.setVisibility(View.GONE);
    } else {
      if (mFooter != null) mFooter.setVisibility(View.VISIBLE);

      mAddTab.setVisibility(View.VISIBLE);
      mAddTab.setImageLevel(index);

      if (!HardwareUtils.hasMenuButton()) {
        mMenuButton.setVisibility(View.VISIBLE);
        mMenuButton.setEnabled(true);
        mPopupMenu.setAnchor(mMenuButton);
      } else {
        mPopupMenu.setAnchor(mAddTab);
      }
    }

    if (isSideBar()) {
      if (showAnimation) dispatchLayoutChange(getWidth(), getHeight());
    } else {
      int actionBarHeight =
          mContext.getResources().getDimensionPixelSize(R.dimen.browser_toolbar_height);
      int height = actionBarHeight + getTabContainerHeight(mTabsContainer);
      dispatchLayoutChange(getWidth(), height);
    }
    mHeaderVisible = true;
  }