예제 #1
0
 @Override
 protected void updateTabCountVisuals(int numberOfTabs) {
   mAccessibilitySwitcherButton.setContentDescription(
       getResources()
           .getString(R.string.accessibility_toolbar_btn_tabswitcher_toggle, numberOfTabs));
   mTabSwitcherButtonDrawable.updateForTabCount(numberOfTabs, isIncognito());
   mTabSwitcherButtonDrawableLight.updateForTabCount(numberOfTabs, isIncognito());
 }
예제 #2
0
  @Override
  public void onFinishInflate() {
    super.onFinishInflate();
    mLocationBar = (LocationBar) findViewById(R.id.location_bar);

    mHomeButton = (TintedImageButton) findViewById(R.id.home_button);
    mBackButton = (TintedImageButton) findViewById(R.id.back_button);
    mForwardButton = (TintedImageButton) findViewById(R.id.forward_button);
    mReloadButton = (TintedImageButton) findViewById(R.id.refresh_button);
    mShowTabStack =
        DeviceClassManager.isAccessibilityModeEnabled(getContext())
            || CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_TABLET_TAB_STACK);

    mTabSwitcherButtonDrawable =
        TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), false);
    mTabSwitcherButtonDrawableLight =
        TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), true);

    mAccessibilitySwitcherButton = (ImageButton) findViewById(R.id.tab_switcher_button);
    mAccessibilitySwitcherButton.setImageDrawable(mTabSwitcherButtonDrawable);
    updateSwitcherButtonVisibility(mShowTabStack);

    mBookmarkButton = (TintedImageButton) findViewById(R.id.bookmark_button);

    mMenuButton = (TintedImageButton) findViewById(R.id.menu_button);
    mMenuButtonWrapper.setVisibility(shouldShowMenuButton() ? View.VISIBLE : View.GONE);

    if (mAccessibilitySwitcherButton.getVisibility() == View.GONE
        && mMenuButtonWrapper.getVisibility() == View.GONE) {
      ApiCompatibilityUtils.setPaddingRelative(
          (View) mMenuButtonWrapper.getParent(),
          0,
          0,
          getResources().getDimensionPixelSize(R.dimen.tablet_toolbar_end_padding),
          0);
    }
  }