IndicatorSeekBar icon indicating copy to clipboard operation
IndicatorSeekBar copied to clipboard

setProgress() jumps to nearest tick with seek_smoothly on

Open ErikTerwan opened this issue 6 years ago • 2 comments

Dear Chuang Guangquan,

I really like your IndicatorSeekBar, but I found one problem.

I have this layout:

<com.warkiz.widget.IndicatorSeekBar
	...
	app:isb_ticks_count="3"
	app:isb_seek_smoothly="true"
	app:isb_thumb_adjust_auto="false"
	...
/>

So I want the extra tick in the middle to be just a marker, not a real tick. This works fine when using the seekbar, but when calling IndicatorSeekBar.setProgress() initially, the thumb and indicator jump right to the nearest tick.

I think I tracked the error down to the IndicatorSeekBar.refreshSeekBarLocation() function where it says:

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

I think it should be something like:

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

Maybe mAdjustAuto also needs to be taken into account (I'm not sure how mAdjustAuto and mSeekSmoothly play together).

Could you look into it?

Thanks!

ErikTerwan avatar Jul 01 '19 12:07 ErikTerwan

This is actually also the cause for #174. By setting this, the seekbar gets considerably less choppy.

MartB avatar Jul 02 '19 15:07 MartB

Dear Chuan Guangquan,

I really like your IndicatorSeekBar, but this problem really prevents me from using it in my project. Can I count on fixing it? Thanks!

Solod avatar Mar 25 '20 18:03 Solod