java类android.content.res.ColorStateList的实例源码

BangumiScheduleSection.java 文件源码 项目:BilibiliClient 阅读 33 收藏 0 点赞 0 评论 0
private void setWeekDayIconAndTitle(HeaderViewHolder viewHolder, int iconRes, String title) {
    if (mDate.equals(WeekDayUtil.formatDate(DateUtil.getCurrentTime("yyyy-MM-dd")))){
        viewHolder.mUpdateTime.setText("今天");
        viewHolder.mUpdateTime.setTextColor(mContext.getResources().getColor(R.color.colorPrimary));
        viewHolder.mWeekDayText.setTextColor(mContext.getResources().getColor(R.color.colorPrimary));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            viewHolder.mWeekDayIcon.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.colorPrimary)));
        }
    } else {
        viewHolder.mUpdateTime.setText(mDate);
        viewHolder.mUpdateTime.setTextColor(mContext.getResources().getColor(R.color.black_alpha_30));
        viewHolder.mWeekDayText.setTextColor(mContext.getResources().getColor(R.color.gray_80));
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            viewHolder.mWeekDayIcon.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.gray_80)));
        }
    }
    viewHolder.mWeekDayIcon.setImageResource(iconRes);
    viewHolder.mWeekDayText.setText(title);
}
Playing4Fragment.java 文件源码 项目:MusicX-music-player 阅读 29 收藏 0 点赞 0 评论 0
private void colorMode(int color) {
    if (getActivity() == null || getActivity().getWindow() == null) {
        return;
    }
    if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) {
        getActivity().getWindow().setNavigationBarColor(color);
        getActivity().getWindow().setStatusBarColor(color);
        seekbar.setBackgroundTintList(ColorStateList.valueOf(color));
        if (vizualview != null) {
            vizualview.setmCakeColor(color);
        }
        playpausebutton.setBackgroundTintList(ColorStateList.valueOf(color));
        queueClick.setBackgroundTintList(ColorStateList.valueOf(color));
    } else {
        getActivity().getWindow().setNavigationBarColor(color);
        seekbar.setBackgroundTintList(ColorStateList.valueOf(color));
        getActivity().getWindow().setStatusBarColor(color);
        if (vizualview != null) {
            vizualview.setmCakeColor(color);
        }
        playpausebutton.setBackgroundTintList(ColorStateList.valueOf(color));
        queueClick.setBackgroundTintList(ColorStateList.valueOf(color));
    }

}
DelegateResources.java 文件源码 项目:atlas 阅读 38 收藏 0 点赞 0 评论 0
public static void walkroundActionMenuTextColor(Resources res){
    try {
        if (Build.VERSION.SDK_INT>=16 && Build.VERSION.SDK_INT <= 19) {
            final long key = (((long) -1) << 32) | 0x7f010082;
            if(walkroundStateList==null) {
                walkroundStateList = ColorStateList.valueOf(Color.rgb(0, 0, 0));
            }
            Field mColorStateListCacheField = AndroidHack.findField(res, "mColorStateListCache");
            mColorStateListCacheField.setAccessible(true);
            LongSparseArray mColorStateListCache = (LongSparseArray) mColorStateListCacheField.get(res);
            mColorStateListCache.put(key,new WeakReference<>(walkroundStateList));
        }
    }catch(Throwable e){
        e.printStackTrace();
    }
}
RippleHelper.java 文件源码 项目:Depth 阅读 31 收藏 0 点赞 0 评论 0
public static ColorStateList getPressedColorSelector(int normalColor, int pressedColor)
{
    return new ColorStateList(
            new int[][]
                    {
                            new int[]{android.R.attr.state_pressed},
                            new int[]{android.R.attr.state_focused},
                            new int[]{android.R.attr.state_activated},
                            new int[]{}
                    },
            new int[]
                    {
                            pressedColor,
                            pressedColor,
                            pressedColor,
                            normalColor
                    }
    );
}
VideoDetailsActivity.java 文件源码 项目:BilibiliClient 阅读 47 收藏 0 点赞 0 评论 0
@Override
public void finishTask() {
    mFAB.setClickable(true);
    mFAB.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.colorPrimary)));
    mCollapsingToolbarLayout.setTitle("");
    if (TextUtils.isEmpty(mImgUrl)){
        Glide.with(this)
                .load(mVideoDetailsInfo)
                .centerCrop()
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .placeholder(R.drawable.bili_default_image_tv)
                .dontAnimate()
                .into(mVideoPreview);
    }
    VideoIntroductionFragment introductionFragment = VideoIntroductionFragment.newInstance(mAv);
    VideoCommentFragment commentFragment = VideoCommentFragment.newInstance(mAv);
    fragments.add(introductionFragment);
    fragments.add(commentFragment);
    setPagerTitle(String.valueOf(mVideoDetailsInfo.getStat().getReply()));
}
LoadingLayout.java 文件源码 项目:letv 阅读 41 收藏 0 点赞 0 评论 0
private void setTextColor(ColorStateList color) {
    if (this.mHeaderText != null) {
        this.mHeaderText.setTextColor(color);
    }
    if (this.mSubHeaderText != null) {
        this.mSubHeaderText.setTextColor(color);
    }
}
TintManager.java 文件源码 项目:android_ui 阅读 41 收藏 0 点赞 0 评论 0
/**
 * Creates a new instance of ColorStateList as tint list for background of Button widget.
 *
 * @param context   Context used to resolve theme attributes that can be used to create the
 *                  requested tint list.
 * @param tintColor Color to be used as primary tint (accent) color.
 * @return New instance of ColorStateList specific for background of Button widget.
 */
@Nullable
static ColorStateList createButtonBackgroundTintColors(@NonNull Context context, int tintColor) {
    final int colorPressed = Colors.darker(tintColor, 0.1f);
    return tintColor != Color.TRANSPARENT ? new ColorStateList(
            new int[][]{
                    // Enabled states ----------------------------------------------------------
                    WidgetStateSet.ENABLED_PRESSED,
                    WidgetStateSet.ENABLED_FOCUSED,
                    WidgetStateSet.ENABLED,
                    // Disabled states ---------------------------------------------------------
                    WidgetStateSet.DISABLED
            },
            new int[]{
                    // Enabled state colors ----------------------------------------------------
                    colorPressed,
                    colorPressed,
                    tintColor,
                    // Disabled state colors ---------------------------------------------------
                    COLOR_DISABLED_BUTTON
            }
    ) : null;
}
TintHelper.java 文件源码 项目:MusicX-music-player 阅读 46 收藏 0 点赞 0 评论 0
public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color, boolean useDarker) {
    final ColorStateList s1 = getDisabledColorStateList(color,
            ContextCompat.getColor(seekBar.getContext(), useDarker ? R.color.ate_control_disabled_dark : R.color.ate_control_disabled_light));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        seekBar.setThumbTintList(s1);
        seekBar.setProgressTintList(s1);
    } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
        Drawable progressDrawable = createTintedDrawable(seekBar.getProgressDrawable(), s1);
        seekBar.setProgressDrawable(progressDrawable);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            Drawable thumbDrawable = createTintedDrawable(seekBar.getThumb(), s1);
            seekBar.setThumb(thumbDrawable);
        }
    } else {
        PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
            mode = PorterDuff.Mode.MULTIPLY;
        }
        if (seekBar.getIndeterminateDrawable() != null)
            seekBar.getIndeterminateDrawable().setColorFilter(color, mode);
        if (seekBar.getProgressDrawable() != null)
            seekBar.getProgressDrawable().setColorFilter(color, mode);
    }
}
Easel.java 文件源码 项目:AndelaTrackChallenge 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Tint the {@link SeekBar}
 *
 * @param seekBar the seekbar
 * @param color   the color
 */
public static void tint(@NonNull SeekBar seekBar, @ColorInt int color) {
    ColorStateList s1 = ColorStateList.valueOf(color);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        seekBar.setThumbTintList(s1);
        seekBar.setProgressTintList(s1);
    } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
        Drawable progressDrawable = DrawableCompat.wrap(seekBar.getProgressDrawable());
        seekBar.setProgressDrawable(progressDrawable);
        DrawableCompat.setTintList(progressDrawable, s1);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            Drawable thumbDrawable = DrawableCompat.wrap(seekBar.getThumb());
            DrawableCompat.setTintList(thumbDrawable, s1);
            seekBar.setThumb(thumbDrawable);
        }
    } else {
        PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
            mode = PorterDuff.Mode.MULTIPLY;
        }
        if (seekBar.getIndeterminateDrawable() != null)
            seekBar.getIndeterminateDrawable().setColorFilter(color, mode);
        if (seekBar.getProgressDrawable() != null)
            seekBar.getProgressDrawable().setColorFilter(color, mode);
    }
}
TimerView.java 文件源码 项目:Edu 阅读 43 收藏 0 点赞 0 评论 0
public void startTimer(){
    if(!isBegin){
        isBegin = true;
        timerview.setBackground(getResources().getDrawable(R.drawable.shape_bo_grey_cccccc_r4dp));
        timerview.setTextColor(ColorStateList.valueOf(ContextCompat.getColor(getContext(),R.color.grey_cccccc)));
        new CountDownTimer(60000, 1000) {
            @Override
            public void onTick(long millisUntilFinished) {
                timerview.setText(millisUntilFinished/1000 + "s");
            }

            @Override
            public void onFinish() {
                timerview.setBackground(getResources().getDrawable(R.drawable.shape_bo_white_r4dp));
                timerview.setTextColor(ColorStateList.valueOf(ContextCompat.getColor(getContext(),R.color.white)));
                timerview.setText("获取验证码");
                isBegin = false;
            }
        }.start();
    }
}
NumberPadTimePickerBottomSheetComponent.java 文件源码 项目:NumberPadTimePicker 阅读 33 收藏 0 点赞 0 评论 0
@NonNull
private static int[] extractColors(ColorStateList colorStateList, int[][] states) {
    int[] colors = new int[states.length];
    int idx = 0;
    for (int[] stateSet : states) {
        // The empty state is peculiar in that getColorForState() will not return
        // the default color, but rather any color defined in the ColorStateList
        // for any state.
        // https://developer.android.com/reference/android/content/res/ColorStateList.html
        // "Each item defines a set of state spec and color pairs, where the state
        // spec is a series of attributes set to either true or false to represent
        // inclusion or exclusion. If an attribute is not specified for an item,
        // it may be any value."
        // "An item with no state spec is considered to match any set of states
        // and is generally useful as a final item to be used as a default."
        colors[idx++] = stateSet.length == 0 ? colorStateList.getDefaultColor()
                : colorStateList.getColorForState(stateSet, 0);
    }
    return colors;
}
GalleryAlbumActivity.java 文件源码 项目:Recognize-it 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Initialize widget.
 */
private void initializeWidget() {
    int navigationColor = mWidget.getNavigationBarColor();
    navigationColor = AlbumUtils.getAlphaColor(navigationColor, mNavigationAlpha);
    StatusUtils.setFullToNavigationBar(this);
    StatusUtils.setNavigationBarColor(this, navigationColor);

    setTitle(mWidget.getTitle());

    if (!mCheckable) {
        findViewById(R.id.bottom_root).setVisibility(View.GONE);
    } else {
        ColorStateList itemSelector = mWidget.getMediaItemCheckSelector();
        mCheckBox.setSupportButtonTintList(itemSelector);

        mCheckBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                boolean isChecked = mCheckBox.isChecked();
                mCheckedMap.put(mAlbumFiles.get(mCurrentItemPosition), isChecked);
                setCheckedCountUI(getCheckCount());
            }
        });
    }
}
TintHelper.java 文件源码 项目:MusicX-music-player 阅读 43 收藏 0 点赞 0 评论 0
@CheckResult
@Nullable
public static Drawable createTintedDrawable(@Nullable Drawable drawable, @NonNull ColorStateList sl) {
    if (drawable == null) return null;
    drawable = DrawableCompat.wrap(drawable.mutate());
    DrawableCompat.setTintList(drawable, sl);
    return drawable;
}
ProgressBarWidget.java 文件源码 项目:android_ui 阅读 35 收藏 0 点赞 0 评论 0
/**
 * Applies current first valid tint from {@link Decorator#mTintInfo} to the progress drawable as
 * whole.
 *
 * @see #applyProgressTints()
 */
private void applySimpleProgressTint() {
    if (mProgressDrawable instanceof TintDrawable) {
        final ProgressTintInfo tintInfo = mDecorator.getTintInfo();
        final TintDrawable tintDrawable = (TintDrawable) mProgressDrawable;
        boolean hasTintList, hasTintMode;
        hasTintList = hasTintMode = false;
        ColorStateList tintList = null;
        PorterDuff.Mode tintMode = null;
        if (tintInfo.hasTintList || tintInfo.hasTintMode) {
            hasTintList = tintInfo.hasTintList;
            tintList = tintInfo.tintList;
            hasTintMode = tintInfo.hasTintMode;
            tintMode = tintInfo.tintMode;
        } else if (tintInfo.hasSecondaryProgressTintList || tintInfo.hasSecondaryProgressTintMode) {
            hasTintList = tintInfo.hasSecondaryProgressTintList;
            tintList = tintInfo.secondaryProgressTintList;
            hasTintMode = tintInfo.hasSecondaryProgressTintMode;
            tintMode = tintInfo.secondaryProgressTintMode;
        } else if (tintInfo.hasProgressBackgroundTintList || tintInfo.hasProgressBackgroundTintMode) {
            hasTintList = tintInfo.hasProgressBackgroundTintList;
            tintList = tintInfo.progressBackgroundTintList;
            hasTintMode = tintInfo.hasProgressBackgroundTintMode;
            tintMode = tintInfo.progressBackgroundTintMode;
        }
        if (hasTintList) tintDrawable.setTintList(tintList);
        if (hasTintMode) tintDrawable.setTintMode(tintMode);
        if (mProgressDrawable.isStateful()) {
            mProgressDrawable.setState(getDrawableState());
        }
    }
}
GridViewWidget.java 文件源码 项目:android_ui 阅读 38 收藏 0 点赞 0 评论 0
/**
 */
@Nullable
@Override
public ColorStateList getBackgroundTintList() {
    this.ensureDecorator();
    return mDecorator.getBackgroundTintList();
}
QMUILinkify.java 文件源码 项目:qmui 阅读 42 收藏 0 点赞 0 评论 0
/**
 * Scans the text of the provided TextView and turns all occurrences of
 * the link types indicated in the mask into clickable links.  If matches
 * are found the movement method for the TextView is set to
 * LinkMovementMethod.
 */
public static final boolean addLinks(TextView text, int mask, ColorStateList linkColor, ColorStateList bgColor, QMUIOnSpanClickListener l) {
    if (mask == 0) {
        return false;
    }

    CharSequence t = text.getText();

    if (t instanceof Spannable) {
        if (addLinks((Spannable) t, mask, linkColor, bgColor, l)) {
            addLinkMovementMethod(text);
            return true;
        }

        return false;
    } else {
        SpannableString s = SpannableString.valueOf(t);

        if (addLinks(s, mask, linkColor, bgColor, l)) {
            addLinkMovementMethod(text);
            text.setText(s);

            return true;
        }

        return false;
    }
}
RoundedImageView.java 文件源码 项目:AvatarView 阅读 37 收藏 0 点赞 0 评论 0
public RoundedImageView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundedImageView, defStyle, 0);

    int index = a.getInt(R.styleable.RoundedImageView_android_scaleType, -1);
    if (index >= 0) {
        setScaleType(SCALE_TYPES[index]);
    } else {
        // default scaletype to FIT_CENTER
        setScaleType(ScaleType.FIT_CENTER);
    }

    cornerRadius = a.getDimensionPixelSize(R.styleable.RoundedImageView_rcorner_radius, -1);
    borderWidth = a.getDimensionPixelSize(R.styleable.RoundedImageView_rborder_width, -1);

    // don't allow negative values for radius and border
    if (cornerRadius < 0) {
        cornerRadius = DEFAULT_RADIUS;
    }
    if (borderWidth < 0) {
        borderWidth = DEFAULT_BORDER_WIDTH;
    }

    borderColor = a.getColorStateList(R.styleable.RoundedImageView_rborder_color);
    if (borderColor == null) {
        borderColor = ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);
    }

    mutateBackground = a.getBoolean(R.styleable.RoundedImageView_rmutate_background, false);
    isOval = a.getBoolean(R.styleable.RoundedImageView_roval, false);

    updateDrawableAttrs();
    updateBackgroundDrawableAttrs(true);

    a.recycle();
}
SkinResource.java 文件源码 项目:ReadMark 阅读 34 收藏 0 点赞 0 评论 0
/**
 * 获取颜色
 * @param resName
 * @return
 */
public ColorStateList getColorByName(String resName){
    try{
        int resId = mSkinResources.getIdentifier(resName, "color", mPackageName);
        ColorStateList color = mSkinResources.getColorStateList(resId);
        return color;

    }catch (Exception e){
        e.printStackTrace();
        return null;
    }
}
TextViewDecorator.java 文件源码 项目:android_ui 阅读 32 收藏 0 点赞 0 评论 0
/**
 * Applies a tint to the compound drawables. Does not modify the current tint mode, which is
 * {@link PorterDuff.Mode#SRC_IN} by default.
 *
 * @param tint The desired tint to be applied. May be {@code null} to clear the current tint.
 */
public void setCompoundDrawableTintList(ColorStateList tint) {
    if (UiConfig.MATERIALIZED_MARSHMALLOW) {
        superSetCompoundDrawableTintList(tint);
        return;
    }
    final CompoundTintInfo tintInfo = getTintInfo();
    if (!tintInfo.hasCompoundTintMode) {
        tintInfo.compoundTintMode = PorterDuff.Mode.SRC_IN;
    }
    tintInfo.compoundTintList = tint;
    tintInfo.hasCompoundTintList = true;
    this.applyCompoundDrawablesTint();
}
VideoDetailsActivity.java 文件源码 项目:BilibiliClient 阅读 37 收藏 0 点赞 0 评论 0
@Override
public void loadData() {
    RetrofitHelper.getBiliAppAPI()
            .getVideoDetails(mAv)
            .compose(bindToLifecycle())
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(videoDetailsInfo -> {
                mVideoDetailsInfo = videoDetailsInfo.getData();
                finishTask();
            }, throwable -> {
                mFAB.setClickable(false);
                mFAB.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.gray_20)));
            });
}
PhoneRecyclerAdapter.java 文件源码 项目:NeoTerm 阅读 32 收藏 0 点赞 0 评论 0
@Override
public final void onTabBackgroundColorChanged(@Nullable final ColorStateList colorStateList) {
    TabItemIterator iterator = new TabItemIterator.Builder(model, viewRecycler).create();
    TabItem tabItem;

    while ((tabItem = iterator.next()) != null) {
        if (tabItem.isInflated()) {
            adaptBackgroundColor(tabItem.getView(), tabItem.getViewHolder(), tabItem.getTab());
        }
    }
}
Widget.java 文件源码 项目:Recognize-it 阅读 49 收藏 0 点赞 0 评论 0
protected Widget(Parcel in) {
    //noinspection WrongConstant
    mStyle = in.readInt();
    mStatusBarColor = in.readInt();
    mToolBarColor = in.readInt();
    mNavigationBarColor = in.readInt();
    mTitle = in.readString();
    mMediaItemCheckSelector = in.readParcelable(ColorStateList.class.getClassLoader());
    mBucketItemCheckSelector = in.readParcelable(ColorStateList.class.getClassLoader());
    mButtonStyle = in.readParcelable(ButtonStyle.class.getClassLoader());
}
CoolView.java 文件源码 项目:sao 阅读 37 收藏 0 点赞 0 评论 0
private int[] getColorsFromColorStateList(ColorStateList colorStateList) {
    if (colorStateList == null) {
        return colors;
    }
    try {
        return (int[]) ColorStateList.class.getMethod("getColors").invoke(colorStateList);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return colors;
}
ResHelper.java 文件源码 项目:SingleSelectBar 阅读 41 收藏 0 点赞 0 评论 0
private void updateTextColor() {
    int[] colors = new int[] {colorUnselected, colorSelected};
    int[][] states = new int[2][];
    states[0] = new int[] {android.R.attr.state_selected};
    states[1] = new int[] {};
    textColor = new ColorStateList(states, colors);
}
DoubanMovieMoreReviewViewModel.java 文件源码 项目:LiteReader 阅读 31 收藏 0 点赞 0 评论 0
@Override
public void initTab(TabLayout tabLayout) {
    tabLayout.setTabMode(TabLayout.MODE_FIXED);
    tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
    tabLayout.setBackgroundColor(getContext().getResources().getColor(R.color.colorPrimary));
    tabLayout.setSelectedTabIndicatorColor(Color.WHITE);
    tabLayout.setTabTextColors(ColorStateList.valueOf(Color.WHITE));
}
SkinCompatDrawableManager.java 文件源码 项目:Android-skin-support 阅读 43 收藏 0 点赞 0 评论 0
private static PorterDuffColorFilter createTintFilter(ColorStateList tint,
                                                      PorterDuff.Mode tintMode, final int[] state) {
    if (tint == null || tintMode == null) {
        return null;
    }
    final int color = tint.getColorForState(state, Color.TRANSPARENT);
    return getPorterDuffColorFilter(color, tintMode);
}
TextAppearance.java 文件源码 项目:android_ui 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Sets a stateful set of colors for text.
 *
 * @param colors The desired colors. May be {@code null} to clear the current ones.
 * @return {@code True} if colors of this text appearance have changed, {@code false} otherwise.
 * @see #getTextColor()
 */
public boolean setTextColor(@Nullable ColorStateList colors) {
    if (mTextColors != colors) {
        this.mTextColors = colors;
        return true;
    }
    return false;
}
ThemedSeekBar.java 文件源码 项目:revolution-irc 阅读 36 收藏 0 点赞 0 评论 0
private static ColorStateList createSeekBarThumbColorList(Context ctx) {
    int accentColor = ThemeHelper.getAccentColor(ctx);
    int normalColor = StyledAttributesHelper.getColor(ctx, R.attr.colorControlNormal, 0);
    int disabledColor = ColorUtils.setAlphaComponent(normalColor, (int) (255.f *
            StyledAttributesHelper.getFloat(ctx, android.R.attr.disabledAlpha, 1.f)));
    return new ColorStateList(new int[][] {
            new int[] { -android.R.attr.state_enabled },
            new int[] { }
    }, new int[] {
            disabledColor,
            accentColor
    });
}
SettingsActivity.java 文件源码 项目:Aequorea 阅读 37 收藏 0 点赞 0 评论 0
private void colorCheckBox() {
    int titleColor = ThemeHelper.getResourceColor(this, R.attr.title_color);
    int accentColor = ThemeHelper.getResourceId(this, R.attr.colorAccent);
    int subTitleColor = ThemeHelper.getResourceColor(this, R.attr.subtitle_color);

    ColorStateList stateList = new ColorStateList(new int[][]{{ -android.R.attr.state_checked }, { android.R.attr.state_checked }},
        new int[]{0x8A000000, ContextCompat.getColor(this, accentColor)});

    for (ACheckBox cb : mList) {
        cb.setColorStateList(stateList);
        cb.setTextColor(titleColor, subTitleColor);
    }
}
AppCompatDrawableManager.java 文件源码 项目:boohee_v5.6 阅读 36 收藏 0 点赞 0 评论 0
private ColorStateList getTintListFromCache(@NonNull Context context, @DrawableRes int resId) {
    if (this.mTintLists == null) {
        return null;
    }
    SparseArray<ColorStateList> tints = (SparseArray) this.mTintLists.get(context);
    if (tints != null) {
        return (ColorStateList) tints.get(resId);
    }
    return null;
}


问题


面经


文章

微信
公众号

扫码关注公众号