Java Code Examples for org.chromium.base.ApiCompatibilityUtils#getColorStateList()

The following examples show how to use org.chromium.base.ApiCompatibilityUtils#getColorStateList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocationBarLayout.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Call to force the UI to update the state of various buttons based on whether or not the
 * current tab is incognito.
 */
@Override
public void updateVisualsForState() {
    if (updateUseDarkColors() || mIsEmphasizingHttpsScheme != shouldEmphasizeHttpsScheme()) {
        updateSecurityIcon(getSecurityLevel());
    }
    ColorStateList colorStateList = ApiCompatibilityUtils.getColorStateList(getResources(),
            mUseDarkColors ? R.color.dark_mode_tint : R.color.light_mode_tint);
    mMicButton.setTint(colorStateList);
    mDeleteButton.setTint(colorStateList);

    setNavigationButtonType(mNavigationButtonType);
    mUrlBar.setUseDarkTextColors(mUseDarkColors);

    if (mSuggestionList != null) {
        mSuggestionList.setBackground(getSuggestionPopupBackground());
    }
    mSuggestionListAdapter.setUseDarkColors(mUseDarkColors);
}
 
Example 2
Source File: LocationBarPhone.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void updateVisualsForState() {
    super.updateVisualsForState();

    Tab tab = getCurrentTab();
    boolean isIncognito = tab != null && tab.isIncognito();
    mIncognitoBadge.setVisibility(isIncognito ? VISIBLE : GONE);
    updateIncognitoBadgePadding();

    if (showMenuButtonInOmnibox()) {
        boolean useLightDrawables = shouldUseLightDrawables();
        ColorStateList dark = ApiCompatibilityUtils.getColorStateList(getResources(),
                R.color.dark_mode_tint);
        ColorStateList white = ApiCompatibilityUtils.getColorStateList(getResources(),
                R.color.light_mode_tint);
        mMenuButton.setTint(useLightDrawables ? white : dark);

        if (mShowMenuBadge) {
            mMenuBadge.setImageResource(useLightDrawables ? R.drawable.badge_update_light
                    : R.drawable.badge_update_dark);
        }
    }
}
 
Example 3
Source File: FindToolbarPhone.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
protected void updateVisualsForTabModel(boolean isIncognito) {
    int queryTextColorId;
    if (isIncognito) {
        setBackgroundResource(R.color.incognito_primary_color);
        ColorStateList white = ApiCompatibilityUtils.getColorStateList(getResources(),
                R.color.light_mode_tint);
        mFindNextButton.setTint(white);
        mFindPrevButton.setTint(white);
        mCloseFindButton.setTint(white);
        queryTextColorId = R.color.find_in_page_query_white_color;
    } else {
        setBackgroundColor(Color.WHITE);
        ColorStateList dark = ApiCompatibilityUtils.getColorStateList(getResources(),
                R.color.dark_mode_tint);
        mFindNextButton.setTint(dark);
        mFindPrevButton.setTint(dark);
        mCloseFindButton.setTint(dark);
        queryTextColorId = R.color.find_in_page_query_color;
    }
    mFindQuery.setTextColor(
            ApiCompatibilityUtils.getColor(getContext().getResources(), queryTextColorId));
}
 
Example 4
Source File: LocationBarLayout.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Call to force the UI to update the state of various buttons based on whether or not the
 * current tab is incognito.
 */
@Override
public void updateVisualsForState() {
    if (updateUseDarkColors() || mIsEmphasizingHttpsScheme != shouldEmphasizeHttpsScheme()) {
        updateSecurityIcon(getSecurityLevel());
    }
    ColorStateList colorStateList = ApiCompatibilityUtils.getColorStateList(getResources(),
            mUseDarkColors ? R.color.dark_mode_tint : R.color.light_mode_tint);
    mMicButton.setTint(colorStateList);
    mDeleteButton.setTint(colorStateList);

    setNavigationButtonType(mNavigationButtonType);
    mUrlBar.setUseDarkTextColors(mUseDarkColors);

    if (mSuggestionList != null) {
        mSuggestionList.setBackground(getSuggestionPopupBackground());
    }
    mSuggestionListAdapter.setUseDarkColors(mUseDarkColors);
}
 
Example 5
Source File: FindToolbarPhone.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
protected void updateVisualsForTabModel(boolean isIncognito) {
    int queryTextColorId;
    if (isIncognito) {
        setBackgroundResource(R.color.incognito_primary_color);
        ColorStateList white = ApiCompatibilityUtils.getColorStateList(getResources(),
                R.color.light_mode_tint);
        mFindNextButton.setTint(white);
        mFindPrevButton.setTint(white);
        mCloseFindButton.setTint(white);
        queryTextColorId = R.color.find_in_page_query_white_color;
    } else {
        setBackgroundColor(Color.WHITE);
        ColorStateList dark = ApiCompatibilityUtils.getColorStateList(getResources(),
                R.color.dark_mode_tint);
        mFindNextButton.setTint(dark);
        mFindPrevButton.setTint(dark);
        mCloseFindButton.setTint(dark);
        queryTextColorId = R.color.find_in_page_query_color;
    }
    mFindQuery.setTextColor(
            ApiCompatibilityUtils.getColor(getContext().getResources(), queryTextColorId));
}
 
Example 6
Source File: LocationBarLayout.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Call to force the UI to update the state of various buttons based on whether or not the
 * current tab is incognito.
 */
@Override
public void updateVisualsForState() {
    if (updateUseDarkColors() || mIsEmphasizingHttpsScheme != shouldEmphasizeHttpsScheme()) {
        updateSecurityIcon(getSecurityLevel());
    }
    ColorStateList colorStateList = ApiCompatibilityUtils.getColorStateList(getResources(),
            mUseDarkColors ? R.color.dark_mode_tint : R.color.light_mode_tint);
    mMicButton.setTint(colorStateList);
    mDeleteButton.setTint(colorStateList);

    setNavigationButtonType(mNavigationButtonType);
    mUrlBar.setUseDarkTextColors(mUseDarkColors);

    if (mSuggestionList != null) {
        mSuggestionList.setBackground(getSuggestionPopupBackground());
    }
    mSuggestionListAdapter.setUseDarkColors(mUseDarkColors);
}
 
Example 7
Source File: ToolbarLayout.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Basic constructor for {@link ToolbarLayout}.
 */
public ToolbarLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    mDarkModeTint =
            ApiCompatibilityUtils.getColorStateList(getResources(), R.color.dark_mode_tint);
    mLightModeTint =
            ApiCompatibilityUtils.getColorStateList(getResources(), R.color.light_mode_tint);
    mProgressBar = createProgressBar();

    addOnLayoutChangeListener(new OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View view, int left, int top, int right, int bottom,
                int oldLeft, int oldTop, int oldRight, int oldBottom) {
            if (isNativeLibraryReady() && mProgressBar.getParent() != null) {
                mProgressBar.initializeAnimation();
            }
            mProgressBar.setTopMargin(getProgressBarTopMargin());

            // Since this only needs to happen once, remove this listener from the view.
            removeOnLayoutChangeListener(this);
        }
    });
}
 
Example 8
Source File: FindToolbarPhone.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
protected void updateVisualsForTabModel(boolean isIncognito) {
    int queryTextColorId;
    if (isIncognito) {
        setBackgroundResource(R.color.incognito_primary_color);
        ColorStateList white = ApiCompatibilityUtils.getColorStateList(getResources(),
                R.color.light_mode_tint);
        mFindNextButton.setTint(white);
        mFindPrevButton.setTint(white);
        mCloseFindButton.setTint(white);
        queryTextColorId = R.color.find_in_page_query_white_color;
    } else {
        setBackgroundColor(Color.WHITE);
        ColorStateList dark = ApiCompatibilityUtils.getColorStateList(getResources(),
                R.color.dark_mode_tint);
        mFindNextButton.setTint(dark);
        mFindPrevButton.setTint(dark);
        mCloseFindButton.setTint(dark);
        queryTextColorId = R.color.find_in_page_query_color;
    }
    mFindQuery.setTextColor(
            ApiCompatibilityUtils.getColor(getContext().getResources(), queryTextColorId));
}
 
Example 9
Source File: ToolbarLayout.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Basic constructor for {@link ToolbarLayout}.
 */
public ToolbarLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    mToolbarHeightWithoutShadow = getResources().getDimensionPixelOffset(
            getToolbarHeightWithoutShadowResId());
    mDarkModeTint =
            ApiCompatibilityUtils.getColorStateList(getResources(), R.color.dark_mode_tint);
    mLightModeTint =
            ApiCompatibilityUtils.getColorStateList(getResources(), R.color.light_mode_tint);
}
 
Example 10
Source File: DownloadItemView.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor for inflating from XML.
 */
public DownloadItemView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mIconBackgroundColor =
            ApiCompatibilityUtils.getColor(context.getResources(), R.color.light_active_color);
    mIconBackgroundColorSelected =
            ApiCompatibilityUtils.getColor(context.getResources(), R.color.google_grey_600);
    mWhiteTint =
            ApiCompatibilityUtils.getColorStateList(getResources(), R.color.white_mode_tint);
}
 
Example 11
Source File: ToolbarLayout.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Basic constructor for {@link ToolbarLayout}.
 */
public ToolbarLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    mToolbarHeightWithoutShadow = getResources().getDimensionPixelOffset(
            getToolbarHeightWithoutShadowResId());
    mDarkModeTint =
            ApiCompatibilityUtils.getColorStateList(getResources(), R.color.dark_mode_tint);
    mLightModeTint =
            ApiCompatibilityUtils.getColorStateList(getResources(), R.color.light_mode_tint);
}
 
Example 12
Source File: BottomSheetContentController.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void updateVisuals(boolean isIncognitoTabModelSelected) {
    setBackgroundResource(isIncognitoTabModelSelected ? R.color.incognito_primary_color
                                                      : R.color.default_primary_color);

    ColorStateList tint = ApiCompatibilityUtils.getColorStateList(getResources(),
            isIncognitoTabModelSelected ? R.color.bottom_nav_tint_incognito
                                        : R.color.bottom_nav_tint);
    setItemIconTintList(tint);
    setItemTextColor(tint);
}
 
Example 13
Source File: TintedDrawable.java    From delion with Apache License 2.0 4 votes vote down vote up
public TintedDrawable(Resources res, Bitmap bitmap) {
    super(res, bitmap);
    mTint = ApiCompatibilityUtils.getColorStateList(res, R.color.dark_mode_tint);
}
 
Example 14
Source File: TintedDrawable.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
public TintedDrawable(Resources res, Bitmap bitmap) {
    super(res, bitmap);
    mTint = ApiCompatibilityUtils.getColorStateList(res, R.color.dark_mode_tint);
}
 
Example 15
Source File: TintedDrawable.java    From 365browser with Apache License 2.0 4 votes vote down vote up
public TintedDrawable(Resources res, Bitmap bitmap) {
    super(res, bitmap);
    mTint = ApiCompatibilityUtils.getColorStateList(res, R.color.dark_mode_tint);
}
 
Example 16
Source File: DownloadUtils.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Return a foreground color list for the file type icon.
 * @param context Context from which to extract the resources.
 * @return a foreground color list.
 */
public static ColorStateList getIconForegroundColorList(Context context) {
    return ApiCompatibilityUtils.getColorStateList(
            context.getResources(), R.color.white_mode_tint);
}