Java 类android.support.annotation.ColorRes 实例源码

项目:leoapp-sources    文件:VerificationFragment.java   
public static VerificationFragment newInstance(@StringRes int title,
                                               @StringRes int content,
                                               @ColorRes int color,
                                               int position) {

    VerificationFragment fragmentInfo = new VerificationFragment();

    Bundle bundle = new Bundle(4);
    bundle.putInt("title", title);
    bundle.putInt("content", content);
    bundle.putInt("color", color);
    bundle.putInt("order", position);

    fragmentInfo.setArguments(bundle);

    return fragmentInfo;
}
项目:ImmerseMode    文件:NormalImmerseMode.java   
@Override
public void setStatusColorRes(@ColorRes int colorRes) {
    Activity activity = mActivityRef.get();
    if (activity != null) {
        int color = ContextCompat.getColor(activity, colorRes);
        setStatusColor(color);
    }
}
项目:KUtils    文件:BuildBean.java   
@Override
public BuildBean setMsgColor(@ColorRes int colorRes) {
    if (colorRes > 0) {
        this.msgTxtColor = colorRes;
    }
    return this;
}
项目:ImmerseMode    文件:TlSbNNbImmerseMode.java   
@Override
public void setNavigationColorRes(@ColorRes int colorRes) {
    Activity activity = mActivityRef.get();
    if (activity != null) {
        int color = ContextCompat.getColor(activity, colorRes);
        setNavigationColor(color);
    }
}
项目:AppAuth-OAuth2-Books-Demo    文件:BooksApp.java   
public int getColorValue(@ColorRes int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        return getColor(color);
    } else {
        return getResources().getColor(color);
    }
}
项目:goRefresh    文件:MulRingProgressBar.java   
public void setColors(@ColorRes int... colorResIds) {
    int colorsCount = Math.min(colorResIds.length, mCount);
    int[] colorRes = new int[colorsCount];
    for (int i = 0; i < colorRes.length; i++) {
        colorRes[i] = ContextCompat.getColor(context, colorResIds[i]);
    }
    setColorSchemeColors(colorRes);
}
项目:boohee_v5.6    文件:SwipeRefreshLayout.java   
public void setColorSchemeResources(@ColorRes int... colorResIds) {
    Resources res = getResources();
    int[] colorRes = new int[colorResIds.length];
    for (int i = 0; i < colorResIds.length; i++) {
        colorRes[i] = res.getColor(colorResIds[i]);
    }
    setColorSchemeColors(colorRes);
}
项目:ImmerseMode    文件:TpSbTlNbImmerseMode.java   
@Override
public void setNavigationColorRes(@ColorRes int colorRes) {
    Activity activity = mActivityRef.get();
    if (activity != null) {
        int color = ContextCompat.getColor(activity, colorRes);
        setNavigationColor(color);
    }
}
项目:AndroidOpen    文件:RevealActivity.java   
private Animator animateRevealColorFromCoordinates(ViewGroup viewRoot, @ColorRes int color, int x, int y) {
    float finalRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, x, y, 0, finalRadius);
    viewRoot.setBackgroundColor(ContextCompat.getColor(this, color));
    anim.setDuration(getResources().getInteger(R.integer.anim_duration_long));
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.start();
    return anim;
}
项目:tenor-android-demo-search    文件:ColorPalette.java   
/**
 * Get a {@link ColorRes} from the given color resource ids
 *
 * @param index the index of the randomized {@link ColorRes}
 * @return a {@link ColorRes}
 */
@ColorRes
public int get(@IntRange(from = 0, to = Integer.MAX_VALUE) int index) {
    if (index < 0) {
        index = Math.abs(index);
    }
    return mColorPalette[index % mCount];
}
项目:Android-FilterView    文件:SingleOption.java   
public SingleOption(String title, @ColorRes int titleColor, @DrawableRes int icon, @ColorRes int selectedIconColor,
                    @ColorRes int deselectedIconColor, int borderWidth, @ColorRes int borderColor) {
    super(title, titleColor);
    this.icon = icon;
    this.borderWidth = borderWidth;
    this.borderColor = borderColor;
    this.selectedIconColor = selectedIconColor;
    this.deselectedIconColor = deselectedIconColor;
}
项目:KUtils    文件:BuildBean.java   
@Override
public BuildBean setBtnColor(@ColorRes int btn1Color, @ColorRes int btn2Color, @ColorRes int btn3Color) {
    if (btn1Color > 0)
        this.btn1Color = btn1Color;
    if (btn2Color > 0)
        this.btn2Color = btn2Color;
    if (btn3Color > 0)
        this.btn3Color = btn3Color;
    return this;
}
项目:PicKing    文件:GoogleCircleProgressView.java   
/**
 * Update the background color of the mBgCircle image view.
 */
public void setBackgroundColor(@ColorRes int colorRes) {
    if (getBackground() instanceof ShapeDrawable) {
        final Resources res = getResources();
        ((ShapeDrawable) getBackground()).getPaint().setColor(res.getColor(colorRes));
    }
}
项目:boohee_v5.6    文件:ResourcesCompat.java   
@ColorInt
public static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 23) {
        return ResourcesCompatApi23.getColor(res, id, theme);
    }
    return res.getColor(id);
}
项目:Alerter    文件:Alerter.java   
/**
 * Set the Progress bar color from a color resource
 *
 * @param color The color resource
 * @return This Alerter
 */
public Alerter setProgressColorRes(@ColorRes final int color) {
    if (getAlert() != null) {
        getAlert().setProgressColorRes(color);
    }

    return this;
}
项目:LoadDataLayout    文件:LoadDataLayout.java   
public LoadDataLayout setAllPageBackgroundColor(@ColorRes int colorId) {
    loadingView.setBackgroundColor(getColor(colorId));
    emptyView.setBackgroundColor(getColor(colorId));
    errorView.setBackgroundColor(getColor(colorId));
    noNetworkView.setBackgroundColor(getColor(colorId));
    return this;
}
项目:TextEmoji    文件:CombinedTabView.java   
public CombinedTabView(Context context, AttributeSet attrs, @StringRes int name, @DrawableRes int normal, @DrawableRes int selected, @ColorRes int colorNormal, @ColorRes int colorSelected) {
    super(context, attrs);
    inflate(context, R.layout.tab_item, this);
    mNormal = normal;
    mSelected = selected;
    mColorNormal = colorNormal;
    mColorSelected = colorSelected;
    mName = name;

    mItemIcon = (ImageView) findViewById(R.id.icon);
    mItemName = (TextView) findViewById(R.id.name);

    init();
}
项目:HeadlineNews    文件:UIBottomBarItem.java   
private ColorStateList getColorStateListWithNomalColorAndSelctedColor(@ColorRes int colorNomal
        , @ColorRes int colorSelected) {
    int nomalColor = ResouceUtil.getColor(colorNomal);
    int selectedColor = ResouceUtil.getColor(colorSelected);
    ColorStateList colorStateList = new ColorStateList(new int[][]{{android.R.attr.state_selected}, {}},
            new int[]{selectedColor, nomalColor});
    return colorStateList;
}
项目:Mix    文件:AppCompatTextHelper.java   
private void setTextColor(@ColorRes int resId) {
    if (mTextColorId != resId) {
        resetTextColorTintResource(resId);

        if (resId != 0) {
            setSupportTextColorTint(resId);
        }
    }
}
项目:GitHub    文件:ConfigBean.java   
@Override
public ConfigBean seInputColor(@ColorRes int colorRes) {
    if (colorRes >0){
        this.inputTxtColor = colorRes;
    }
    return this;
}
项目:Graywater    文件:Palette.java   
public Palette(String name, @ColorRes int... colors) {
    this.name = name;

    for (int color : colors) {
        this.colors.add(color);
    }
}
项目:MainActivityUIUtil    文件:StatusbarUtil.java   
/**
 * 状态栏背景色为淡色时,为防止状态栏上白色字体看不清而采取的一系列适配措施.
 *
 * 适用于状态栏情况单一的activity,此方法中,不仅设置了背景色,还更改了状态栏文字颜色
 *
 * @param activity
 * @param colorLight UI图上给的状态栏背景色
 * @param colorDeep 在无法变更状态栏文字颜色的手机上,状态栏背景采用什么颜色.传入的是R.color.xxx
 */
public static void setBgColorLight(Activity activity, @ColorRes int colorLight, @ColorRes int colorDeep) {
    int color = colorLight;

    if(isXiaomi()){
        setMiuiStatusBarDarkMode(activity,true);
    }else if(isMeizu()){
        setMeizuStatusBarDarkIcon(activity,true);
    }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        setBlackFontUpM(activity,true);
    }else {
        color = colorDeep;
    }
    setBgColor(activity, color);
}
项目:ImmerseMode    文件:TlSbNNbwFCwARImmerseMode.java   
@Override
public void setStatusColorRes(@ColorRes int colorRes) {
    Activity activity = mActivityRef.get();
    if (activity != null) {
        int color = ContextCompat.getColor(activity, colorRes);
        setStatusColor(color);
    }
}
项目:GitHub    文件:BuildBean.java   
@Override
public BuildBean setMsgColor(@ColorRes int colorRes) {
    if (colorRes > 0) {
        this.msgTxtColor = colorRes;
    }
    return this;
}
项目:ImmerseMode    文件:TpSbNNbwFCImmerseMode.java   
@Override
public void setStatusColorRes(@ColorRes int colorRes) {
    Activity activity = mActivityRef.get();
    if (activity != null) {
        setStatusColor(ContextCompat.getColor(activity, colorRes));
    }
}
项目:SkinFramework    文件:ComposedResources.java   
@RequiresApi(api = Build.VERSION_CODES.M)
@Nullable
@Override
public ColorStateList getColorStateList(@ColorRes int id, @Nullable Theme theme) throws NotFoundException {
    int realId = getCorrespondResId(id);
    if (realId > 0) {
        return mSkinResources.getColorStateList(realId, theme);
    }
    return super.getColorStateList(id, theme);
}
项目:Mix    文件:BaseApplication.java   
@Override
public int replaceColorById(Context context, @ColorRes int colorId) {
    if (ThemeHelper.isDefaultTheme(context)) {
        return context.getResources().getColor(colorId);
    }
    String theme = getTheme(context);
    if (theme != null) {
        colorId = getThemeColorId(context, colorId, theme);
    }
    return context.getResources().getColor(colorId);
}
项目:TextBuilder    文件:TextBuilder.java   
@CheckResult public TextBuilder addColoredTextRes(@StringRes final int textRes, @ColorRes final int colorRes) {
  return addColoredText(context.getString(textRes), ContextCompat.getColor(context, colorRes));
}
项目:Protein    文件:ListFragment.java   
@Override
@ColorRes
public int toolbarBackground() {
    return R.color.protein_white;
}
项目:MusicX-music-player    文件:Config.java   
@Override
public Config toolbarColorRes(@ColorRes int colorRes) {
    return toolbarColor(ContextCompat.getColor(mContext, colorRes));
}
项目:HeroVideo-master    文件:CircleImageView.java   
public void setBorderColorResource(@ColorRes int borderColorRes)
{

    setBorderColor(getContext().getResources().getColor(borderColorRes));
}
项目:Discover    文件:CircleImageView.java   
/**
 * @deprecated Use {@link #setBorderColor(int)} instead
 */
@Deprecated
public void setBorderColorResource(@ColorRes int borderColorRes) {
    setBorderColor(getContext().getResources().getColor(borderColorRes));
}
项目:markor    文件:AppSettingsBase.java   
public int rcolor(@ColorRes int resColorId) {
    return ContextCompat.getColor(_context, resColorId);
}
项目:Protein    文件:ListContract.java   
@ColorRes
int toolbarBackground();
项目:StatusView    文件:StatusView.java   
public void setDialogLoadingViewBackgroundColor(@ColorRes int resId) {
    if (mDialogParentLayout != null) {
        mDialogLayout.setBackgroundColor(ContextCompat.getColor(getContext(), resId));
    }
}
项目:Mix    文件:ThemeUtils.java   
static
@ColorInt
int replaceColorById(Context context, @ColorRes int colorId) {
    return mSwitchColor == null ? Color.TRANSPARENT : mSwitchColor.replaceColorById(context, colorId);
}
项目:LoadDataLayout    文件:LoadDataLayout.java   
public Builder setAllPageBackgroundColor(@ColorRes int allPageBackgroundColor) {
    this.allPageBackgroundColor = allPageBackgroundColor;
    return builder;
}
项目:disclosure-android-app    文件:AppListItem.java   
private @ColorRes int getPermissionCountTextColor(AppReport appReport) {
  return appReport.wasAnalyzed() && appReport.permissionCount() > 0
      ? R.color.color_accent
      : R.color.color_text_secondary;
}
项目:GitHub    文件:TextBadgeItem.java   
/**
 * @param colorResource resource for text color
 * @return this, to allow builder pattern
 */
public TextBadgeItem setTextColorResource(@ColorRes int colorResource) {
    this.mTextColorResource = colorResource;
    setTextColor();
    return this;
}
项目:GitHub    文件:TextBadgeItem.java   
/**
 * @param colorResource resource for border color
 * @return this, to allow builder pattern
 */
public TextBadgeItem setBorderColorResource(@ColorRes int colorResource) {
    this.mBorderColorResource = colorResource;
    refreshDrawable();
    return this;
}