VideoRangeSlider icon indicating copy to clipboard operation
VideoRangeSlider copied to clipboard

.setRangeIndex( s, e); not updating UI

Open ChristoferAlexander opened this issue 6 years ago • 1 comments

Hi,

I am trying to set programmatically the position of start and end index. Calling this method seems to set the values internal but the UI is not updated as the state remains the same. I use the view in XML.

Thanks in advance,

Alex

ChristoferAlexander avatar Nov 06 '18 14:11 ChristoferAlexander

You need to import VideoRangeSlider as module. And then modify setRangeIndex function like below

    public void setRangeIndex(long leftIndex, long rightIndex) {
        if (indexOutOfRange(leftIndex, rightIndex)) {
            throw new IllegalArgumentException(
                    "Thumb index left " + leftIndex + ", or right " + rightIndex
                            + " is out of bounds. Check that it is greater than the minimum ("
                            + mTickStart + ") and less than the maximum value ("
                            + mTickEnd + ")");
        } else {
            if(mLeftThumb.getRangeIndex() != leftIndex) {
                mLeftThumb.setTickIndex(leftIndex);
                moveThumbByIndex(mLeftThumb, leftIndex);
            }
            if(mRightThumb.getRangeIndex() != rightIndex) {
                mRightThumb.setTickIndex(rightIndex);
                moveThumbByIndex(mRightThumb, rightIndex);
            }
//            invalidate();
        }
    }

hungnb94 avatar Jul 10 '19 03:07 hungnb94