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); }
@Override public void setPrivateMode(boolean isPrivate) { super.setPrivateMode(isPrivate); mHighlightColor = ColorUtils.getColor( getContext(), isPrivate ? R.color.url_bar_text_highlight_pb : R.color.fennec_ui_orange); // android:textColorHighlight cannot support a ColorStateList. setHighlightColor(mHighlightColor); }
public HomePagerTabStrip(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HomePagerTabStrip); int color = a.getColor(R.styleable.HomePagerTabStrip_tabIndicatorColor, 0x00); a.recycle(); setTabIndicatorColor(color); final Resources res = getResources(); shadowSize = res.getDimensionPixelSize(R.dimen.tabs_strip_shadow_size); shadowPaint = new Paint(); shadowPaint.setColor(ColorUtils.getColor(context, R.color.url_bar_shadow)); shadowPaint.setStrokeWidth(0.0f); getViewTreeObserver().addOnPreDrawListener(new PreDrawListener()); }
public ColorDrawable getColorDrawable(int id) { return new ColorDrawable(ColorUtils.getColor(getContext(), id)); }