/**
* Applies current thumb tint from {@link Decorator#mTintInfo} to the current thumb drawable.
* <p>
* <b>Note</b>, that for post {@link android.os.Build.VERSION_CODES#LOLLIPOP LOLLIPOP} this
* method does nothing.
*/
@SuppressWarnings("ConstantConditions")
private void applyThumbTint() {
this.ensureDecorator();
if (UiConfig.MATERIALIZED || mThumb == null || !mDecorator.hasTintInfo()) {
return;
}
final Drawable thumb = mThumb instanceof ScaleDrawable ? ((ScaleDrawable) mThumb).getDrawable() : mThumb;
final SeekBarTintInfo tintInfo = mDecorator.getTintInfo();
if ((!tintInfo.hasTintList && !tintInfo.hasTintMode)) {
return;
}
final boolean isTintDrawable = thumb instanceof TintDrawable;
final TintDrawable tintDrawable = isTintDrawable ? (TintDrawable) thumb : new TintDrawable(thumb);
if (tintInfo.hasTintList) {
tintDrawable.setTintList(tintInfo.tintList);
}
if (tintInfo.hasTintMode) {
tintDrawable.setTintMode(tintInfo.tintMode);
}
if (tintDrawable.isStateful()) {
tintDrawable.setState(getDrawableState());
}
if (isTintDrawable) {
return;
}
final int thumbOffset = getThumbOffset();
this.mThumb = mDecorator.hasPrivateFlag(PFLAG_DISCRETE) ?
mAnimations.makeThumbScaleable(tintDrawable, Gravity.CENTER) :
tintDrawable;
super.setThumb(mThumb);
tintDrawable.attachCallback();
setThumbOffset(thumbOffset);
}
SeekBarWidget.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:android_ui
作者:
评论列表
文章目录