项目:BilibiliClient
文件:BangumiScheduleSection.java
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);
}
项目:MusicX-music-player
文件:Playing4Fragment.java
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));
}
}
项目:atlas
文件:DelegateResources.java
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));
}
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();
}
}
项目:Depth
文件:RippleHelper.java
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,normalColor
}
);
}
项目:BilibiliClient
文件:VideoDetailsActivity.java
@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()));
}
项目:letv
文件:LoadingLayout.java
private void setTextColor(ColorStateList color) {
if (this.mHeaderText != null) {
this.mHeaderText.setTextColor(color);
}
if (this.mSubHeaderText != null) {
this.mSubHeaderText.setTextColor(color);
}
}
项目:android_ui
文件:TintManager.java
/**
* 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;
}
项目:MusicX-music-player
文件:TintHelper.java
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);
}
}
项目:AndelaTrackChallenge
文件:Easel.java
/**
* 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,mode);
}
}
项目:Edu
文件:TimerView.java
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();
}
}
@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;
}
/**
* 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());
}
});
}
}
项目:MusicX-music-player
文件:TintHelper.java
@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;
}
项目:android_ui
文件:ProgressBarWidget.java
/**
* 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());
}
}
}
项目:android_ui
文件:GridViewWidget.java
/**
*/
@Nullable
@Override
public ColorStateList getBackgroundTintList() {
this.ensureDecorator();
return mDecorator.getBackgroundTintList();
}
项目:qmui
文件:QMUILinkify.java
/**
* 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,l)) {
addLinkMovementMethod(text);
text.setText(s);
return true;
}
return false;
}
}
项目:AvatarView
文件:RoundedImageView.java
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();
}
项目:ReadMark
文件:SkinResource.java
/**
* 获取颜色
* @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;
}
}
项目:android_ui
文件:TextViewDecorator.java
/**
* 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();
}
项目:BilibiliClient
文件:VideoDetailsActivity.java
@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)));
});
}
项目:NeoTerm
文件:PhoneRecyclerAdapter.java
@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());
}
}
}
项目:Recognize-it
文件:Widget.java
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());
}
项目:sao
文件:CoolView.java
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;
}
项目:SingleSelectBar
文件:ResHelper.java
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);
}
@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));
}
项目:Android-skin-support
文件:SkinCompatDrawableManager.java
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);
}
/**
* 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;
}
项目:revolution-irc
文件:ThemedSeekBar.java
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
});
}
项目:Aequorea
文件:SettingsActivity.java
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);
}
}
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;
}
项目:MakiLite
文件:SnackBar.java
/**
* Sets the text color of the action specified in
* {@link #setAction(CharSequence,View.OnClickListener)}.
*/
@NonNull
public SnackBar setActionTextColor(ColorStateList colors) {
this.snackbar.setActionTextColor(colors);
return this;
}
项目:SetupWizardLibCompat
文件:GlifLayout.java
private void setProgressBarColor(ColorStateList color) {
if (Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
final ProgressBar bar = peekProgressBar();
if (bar != null) {
bar.setIndeterminateTintList(color);
}
}
}
项目:Android-skin-support
文件:SkinMaterialTextInputLayout.java
private void setDefaultTextColor(ColorStateList colors) {
try {
Field defaultTextColor = TextInputLayout.class.getDeclaredField("mDefaultTextColor");
defaultTextColor.setAccessible(true);
defaultTextColor.set(this,colors);
updateLabelState();
} catch (Exception e) {
e.printstacktrace();
}
}
项目: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);
}
项目:LaunchEnr
文件:NotificationMainView.java
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mTextAndBackground = (ViewGroup) findViewById(R.id.text_and_background);
ColorDrawable colorBackground = (ColorDrawable) mTextAndBackground.getBackground();
mBackgroundColor = colorBackground.getColor();
rippledrawable rippleBackground = new rippledrawable(ColorStateList.valueOf(
ThemeUtils.getAttrColor(getContext(),android.R.attr.colorControlHighlight)),colorBackground,null);
mTextAndBackground.setBackground(rippleBackground);
mTitleView = (TextView) mTextAndBackground.findViewById(R.id.title);
mTextView = (TextView) mTextAndBackground.findViewById(R.id.text);
}
项目:FastLib
文件:FastLoadMoreView.java
private void initView(BaseViewHolder holder) {
if (holder == null) {
return;
}
holder.setText(R.id.tv_loadingFastLoadMore,mloadingText)
.setTextColor(R.id.tv_loadingFastLoadMore,mloadingTextColor)
.setText(R.id.tv_loadFailFastLoadMore,mloadFailText)
.setTextColor(R.id.tv_loadFailFastLoadMore,mloadFailTextColor)
.setText(R.id.tv_loadEndFastLoadMore,mloadEndText)
.setTextColor(R.id.tv_loadEndFastLoadMore,mloadEndTextColor);
TextView tvLoading = holder.getView(R.id.tv_loadingFastLoadMore);
TextView tvLoadFail = holder.getView(R.id.tv_loadFailFastLoadMore);
TextView tvLoadEnd = holder.getView(R.id.tv_loadEndFastLoadMore);
ProgressBar pbLoading = holder.getView(R.id.pb_loadingFastLoadMore);
tvLoading.setTextSize(TypedValue.COMPLEX_UNIT_PX,mloadingTextSize);
tvLoading.getPaint().setFakeBoldText(mloadingTextFakeBold);
tvLoadFail.setTextSize(TypedValue.COMPLEX_UNIT_PX,mloadFailTextSize);
tvLoadFail.getPaint().setFakeBoldText(mloadFailTextFakeBold);
tvLoadEnd.setTextSize(TypedValue.COMPLEX_UNIT_PX,mloadEndTextSize);
tvLoadEnd.getPaint().setFakeBoldText(mloadEndTextFakeBold);
if (mloadingSize >= 0) {
pbLoading.getIndeterminateDrawable().setBounds(0,mloadingSize,mloadingSize);
ViewGroup.LayoutParams params = pbLoading.getLayoutParams();
params.width = mloadingSize;
params.height = mloadingSize;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
pbLoading.setIndeterminateTintList(ColorStateList.valueOf(mloadingProgressColor));
}
if (mloadingProgressDrawable != null) {
mloadingProgressDrawable.setBounds(pbLoading.getIndeterminateDrawable().getBounds());
pbLoading.setIndeterminateDrawable(mloadingProgressDrawable);
}
}
项目:android_ui
文件:SeekBarWidget.java
/**
* 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 SeekBarTintInfo tintInfo = mDecorator.getTintInfo();
final TintDrawable tintDrawable = (TintDrawable) mProgressDrawable;
boolean hasTintList,hasTintMode;
hasTintList = hasTintMode = false;
ColorStateList tintList = null;
PorterDuff.Mode tintMode = null;
if (tintInfo.hasPrimaryProgresstintList || tintInfo.hasPrimaryProgresstintMode) {
hasTintList = tintInfo.hasPrimaryProgresstintList;
tintList = tintInfo.primaryProgresstintList;
hasTintMode = tintInfo.hasPrimaryProgresstintMode;
tintMode = tintInfo.primaryProgresstintMode;
} 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());
}
}
}
public void setBorderColor(ColorStateList colors)
{
if (borderColor.equals(colors))
{
return;
}
borderColor = (colors != null) ? colors : ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);
updateDrawableAttrs();
updateBackgroundDrawableAttrs(false);
if (borderWidth > 0)
{
invalidate();
}
}
项目:android_ui
文件:ImageDecorator.java
项目:UIWidget
文件:TitleBarView.java