コード例 #1
0
ファイル: RouteFragment.java プロジェクト: haovn577/open
 public boolean onBackAction() {
   if (slideLayoutIsExpanded()) {
     collapseSlideLayout();
     return false;
   } else if (resume.getVisibility() == View.VISIBLE) {
     resume.callOnClick();
     return false;
   } else {
     return true;
   }
 }
コード例 #2
0
  public ToolbarDisplayLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    setOrientation(HORIZONTAL);

    mActivity = (BrowserApp) context;

    LayoutInflater.from(context).inflate(R.layout.toolbar_display_layout, this);

    mTitle = (ThemedTextView) findViewById(R.id.url_bar_title);
    mTitlePadding = mTitle.getPaddingRight();

    final Resources res = getResources();

    mUrlColor = new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_urltext));
    mBlockedColor =
        new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_blockedtext));
    mDomainColor =
        new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_domaintext));
    mPrivateDomainColor =
        new ForegroundColorSpan(ColorUtils.getColor(context, R.color.url_bar_domaintext_private));

    mFavicon = (ImageButton) findViewById(R.id.favicon);
    mSiteSecurity = (ImageButton) findViewById(R.id.site_security);

    if (HardwareUtils.isTablet()) {
      mSiteSecurity.setVisibility(View.VISIBLE);

      // We don't show favicons in the toolbar on new tablet. Note that while we could
      // null the favicon reference, we don't do so to avoid excessive null-checking.
      removeView(mFavicon);
    } else {
      if (Versions.feature16Plus) {
        mFavicon.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
      }
      mFaviconSize = Math.round(Favicons.browserToolbarFaviconSize);
    }

    mSiteSecurityVisible = (mSiteSecurity.getVisibility() == View.VISIBLE);

    mSiteIdentityPopup = new SiteIdentityPopup(mActivity);
    mSiteIdentityPopup.setAnchor(this);
    mSiteIdentityPopup.setOnVisibilityChangeListener(mActivity);

    mStop = (ImageButton) findViewById(R.id.stop);
    mPageActionLayout = (PageActionLayout) findViewById(R.id.page_action_layout);
  }
コード例 #3
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);
    }
  }
コード例 #4
0
  public ToolbarDisplayLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    setOrientation(HORIZONTAL);

    mActivity = (BrowserApp) context;

    LayoutInflater.from(context).inflate(R.layout.toolbar_display_layout, this);

    mTitle = (ThemedTextView) findViewById(R.id.url_bar_title);
    mTitlePadding = mTitle.getPaddingRight();

    final Resources res = getResources();

    mUrlColor = new ForegroundColorSpan(res.getColor(R.color.url_bar_urltext));
    mBlockedColor = new ForegroundColorSpan(res.getColor(R.color.url_bar_blockedtext));
    mDomainColor = new ForegroundColorSpan(res.getColor(R.color.url_bar_domaintext));
    mPrivateDomainColor = new ForegroundColorSpan(res.getColor(R.color.url_bar_domaintext_private));

    mFavicon = (ImageButton) findViewById(R.id.favicon);
    mSiteSecurity = (ImageButton) findViewById(R.id.site_security);

    if (NewTabletUI.isEnabled(context)) {
      mSiteSecurity.setVisibility(View.VISIBLE);
      // TODO: Rename this resource and remove this call when new tablet is default.
      mSiteSecurity.setImageResource(R.drawable.new_tablet_site_security_level);

      // TODO: This can likely be set statically in resources when new tablet is default.
      // Dynamically update parameters for new tablet.
      final LinearLayout.LayoutParams lp =
          (LinearLayout.LayoutParams) mSiteSecurity.getLayoutParams();
      lp.height = res.getDimensionPixelSize(R.dimen.new_tablet_site_security_height);
      lp.width = res.getDimensionPixelSize(R.dimen.new_tablet_site_security_width);
      // TODO: Override a common static value when new tablet is standard.
      lp.rightMargin = res.getDimensionPixelSize(R.dimen.new_tablet_site_security_right_margin);
      mSiteSecurity.setLayoutParams(lp);
      final int siteSecurityVerticalPadding =
          res.getDimensionPixelSize(R.dimen.new_tablet_site_security_padding_vertical);
      final int siteSecurityHorizontalPadding =
          res.getDimensionPixelSize(R.dimen.new_tablet_site_security_padding_horizontal);
      mSiteSecurity.setPadding(
          siteSecurityHorizontalPadding,
          siteSecurityVerticalPadding,
          siteSecurityHorizontalPadding,
          siteSecurityVerticalPadding);

      // We don't show favicons in the toolbar on new tablet. Note that while we could
      // null the favicon reference, we don't do so to avoid excessive null-checking.
      removeView(mFavicon);
    } else {
      if (Versions.feature16Plus) {
        mFavicon.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
      }
      mFaviconSize = Math.round(Favicons.browserToolbarFaviconSize);
    }

    mSiteSecurityVisible = (mSiteSecurity.getVisibility() == View.VISIBLE);

    mSiteIdentityPopup = new SiteIdentityPopup(mActivity);
    mSiteIdentityPopup.setAnchor(mSiteSecurity);

    mStop = (ImageButton) findViewById(R.id.stop);
    mPageActionLayout = (PageActionLayout) findViewById(R.id.page_action_layout);
  }
コード例 #5
0
 @Override
 public void onBackPressed() {
   if (View.VISIBLE == btn_cancel.getVisibility() && null != cancelRunnable) {
     mainHandler.post(cancelRunnable);
   }
 }