SeekBarWidget.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:android_ui 作者:
/**
 * Sets a flag indicating whether this seek bar is <b>discrete</b> or not.
 * <p>
 * SeekBarWidget in the discrete mode draws, above the progress track and the thumb, a discrete
 * indicator to show to a user current progress value. Discrete indicator's drawable can be set
 * via {@link #setDiscreteIndicator(android.graphics.drawable.Drawable)}.
 *
 * @param discrete {@code True} to enable discrete mode, {@code false} otherwise.
 * @see R.attr#uiDiscrete ui:uiDiscrete
 * @see #isDiscrete()
 */
public void setDiscrete(boolean discrete) {
    if (discrete && UiConfig.MATERIALIZED) {
        final Drawable background = getBackground();
        if (background instanceof RippleDrawable) {
            // This is a little bit harsh, but the RippleDrawable background is showing a ripple
            // in discrete mode in top left corner of this view's bounds which is kind of weird
            // behaviour.
            this.mRippleBackgroundDrawable = background;
            setBackgroundDrawable(null);
        }
    } else if (!discrete && mRippleBackgroundDrawable != null) {
        setBackgroundDrawable(mRippleBackgroundDrawable);
        this.mRippleBackgroundDrawable = null;
    }
    this.ensureDecorator();
    if (mDecorator.hasPrivateFlag(PFLAG_DISCRETE) != discrete) {
        mDecorator.updatePrivateFlags(PFLAG_DISCRETE, discrete);
        this.updateThumb(mThumb);
        this.updateDiscreteIndicator(mDiscreteIndicator);
        requestLayout();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号