IndicatorSeekBar icon indicating copy to clipboard operation
IndicatorSeekBar copied to clipboard

初始Progress不对

Open angeldevil opened this issue 5 years ago • 0 comments

<item name="isb_max">10</item>
<item name="isb_min">0</item>
<item name="isb_ticks_count">6</item>
setProgress(1)

上述代码结果是初始进度在刻度2处,而不是1,因为被按刻度对齐了

private void refreshSeekBarLocation() {
    initTrackLocation();
    //init TickTexts Y Location
    if (needDrawText()) {
        mTextPaint.getTextBounds("j", 0, 1, mRect);
        mTickTextY = mPaddingTop + mCustomDrawableMaxHeight + Math.round(mRect.height() - mTextPaint.descent()) + SizeUtils.dp2px(mContext, 3);
        mThumbTextY = mTickTextY;
    }
    //init tick's X and text's X location;
    if (mTickMarksX == null) {
        return;
    }
    initTextsArray();
    //adjust thumb auto,so find out the closest progress in the mProgressArr array and replace it.
    //it is not necessary to adjust thumb while count is less than 2.
    if (mTicksCount > 2) {
        mProgress = mProgressArr[getClosestIndex()];
        lastProgress = mProgress;
    }
    refreshThumbCenterXByProgress(mProgress);
}

为什么要做这个操作,意义是什么?

if (mTicksCount > 2) {
    mProgress = mProgressArr[getClosestIndex()];
    lastProgress = mProgress;
}

应该mSeekSmoothly为false时才需要做这个吧

angeldevil avatar Jan 17 '20 08:01 angeldevil