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; }
@Override public void setStatusColorRes(@ColorRes int colorRes) { Activity activity = mActivityRef.get(); if (activity != null) { int color = ContextCompat.getColor(activity, colorRes); setStatusColor(color); } }
@Override public BuildBean setMsgColor(@ColorRes int colorRes) { if (colorRes > 0) { this.msgTxtColor = colorRes; } return this; }
@Override public void setNavigationColorRes(@ColorRes int colorRes) { Activity activity = mActivityRef.get(); if (activity != null) { int color = ContextCompat.getColor(activity, colorRes); setNavigationColor(color); } }
public int getColorValue(@ColorRes int color) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return getColor(color); } else { return getResources().getColor(color); } }
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); }
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); }
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; }
/** * 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]; }
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; }
@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; }
/** * 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)); } }
@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); }
/** * 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; }
public LoadDataLayout setAllPageBackgroundColor(@ColorRes int colorId) { loadingView.setBackgroundColor(getColor(colorId)); emptyView.setBackgroundColor(getColor(colorId)); errorView.setBackgroundColor(getColor(colorId)); noNetworkView.setBackgroundColor(getColor(colorId)); return this; }
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(); }
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; }
private void setTextColor(@ColorRes int resId) { if (mTextColorId != resId) { resetTextColorTintResource(resId); if (resId != 0) { setSupportTextColorTint(resId); } } }
@Override public ConfigBean seInputColor(@ColorRes int colorRes) { if (colorRes >0){ this.inputTxtColor = colorRes; } return this; }
public Palette(String name, @ColorRes int... colors) { this.name = name; for (int color : colors) { this.colors.add(color); } }
/** * 状态栏背景色为淡色时,为防止状态栏上白色字体看不清而采取的一系列适配措施. * * 适用于状态栏情况单一的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); }
@Override public void setStatusColorRes(@ColorRes int colorRes) { Activity activity = mActivityRef.get(); if (activity != null) { setStatusColor(ContextCompat.getColor(activity, colorRes)); } }
@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); }
@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); }
@CheckResult public TextBuilder addColoredTextRes(@StringRes final int textRes, @ColorRes final int colorRes) { return addColoredText(context.getString(textRes), ContextCompat.getColor(context, colorRes)); }
@Override @ColorRes public int toolbarBackground() { return R.color.protein_white; }
@Override public Config toolbarColorRes(@ColorRes int colorRes) { return toolbarColor(ContextCompat.getColor(mContext, colorRes)); }
public void setBorderColorResource(@ColorRes int borderColorRes) { setBorderColor(getContext().getResources().getColor(borderColorRes)); }
/** * @deprecated Use {@link #setBorderColor(int)} instead */ @Deprecated public void setBorderColorResource(@ColorRes int borderColorRes) { setBorderColor(getContext().getResources().getColor(borderColorRes)); }
public int rcolor(@ColorRes int resColorId) { return ContextCompat.getColor(_context, resColorId); }
@ColorRes int toolbarBackground();
public void setDialogLoadingViewBackgroundColor(@ColorRes int resId) { if (mDialogParentLayout != null) { mDialogLayout.setBackgroundColor(ContextCompat.getColor(getContext(), resId)); } }
static @ColorInt int replaceColorById(Context context, @ColorRes int colorId) { return mSwitchColor == null ? Color.TRANSPARENT : mSwitchColor.replaceColorById(context, colorId); }
public Builder setAllPageBackgroundColor(@ColorRes int allPageBackgroundColor) { this.allPageBackgroundColor = allPageBackgroundColor; return builder; }
private @ColorRes int getPermissionCountTextColor(AppReport appReport) { return appReport.wasAnalyzed() && appReport.permissionCount() > 0 ? R.color.color_accent : R.color.color_text_secondary; }
/** * @param colorResource resource for text color * @return this, to allow builder pattern */ public TextBadgeItem setTextColorResource(@ColorRes int colorResource) { this.mTextColorResource = colorResource; setTextColor(); return this; }
/** * @param colorResource resource for border color * @return this, to allow builder pattern */ public TextBadgeItem setBorderColorResource(@ColorRes int colorResource) { this.mBorderColorResource = colorResource; refreshDrawable(); return this; }