@Override
 protected void onFinishInflate() {
   super.onFinishInflate();
   setBackground(new ColorDrawable(getResources().getColor(R.color.default_primary_color)));
   mUrlBar = (UrlBar) findViewById(R.id.url_bar);
   mUrlBar.setHint("");
   mUrlBar.setDelegate(this);
   mUrlBar.setEnabled(false);
   mUrlBar.setAllowFocus(false);
   mTitleBar = (TextView) findViewById(R.id.title_bar);
   mLocationBarFrameLayout = findViewById(R.id.location_bar_frame_layout);
   mTitleUrlContainer = findViewById(R.id.title_url_container);
   mSecurityButton = (ImageButton) findViewById(R.id.security_button);
   mSecurityIconType = ConnectionSecurityLevel.NONE;
   mCustomActionButton = (ImageButton) findViewById(R.id.action_button);
   mCloseButton = (ImageButton) findViewById(R.id.close_button);
   mCloseButton.setOnLongClickListener(this);
   mCustomActionButton.setOnLongClickListener(this);
   populateToolbarAnimations();
 }
예제 #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);
    }
  }