微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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,int x,int y) {
    float finalRadius = (float) Math.hypot(viewRoot.getWidth(),viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot,x,y,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;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。