waynell / VideoRangeSlider

Android video trim control
MIT License
108 stars 18 forks source link

An empty space at left highlighted background #2

Open kuoliangkwong opened 7 years ago

kuoliangkwong commented 7 years ago

hi I put a background image under the slider and notice highlighted background has an empty space. Could u help fix it? device-2017-07-05-182916

Parasghasadiya commented 6 years ago

@kuoliangkwong make a minor change like below inside RangeSlider.java class @Override protected void onDraw(Canvas canvas) { final int width = getMeasuredWidth(); final int height = getMeasuredHeight();

    final int lThumbWidth = mLeftThumb.getMeasuredWidth();
    final float lThumbOffset = mLeftThumb.getX();
    final float rThumbOffset = mRightThumb.getX();

    final float lineTop = mLineSize;
    final float lineBottom = height - mLineSize;

    // top line
    canvas.drawRect(lThumbWidth + lThumbOffset,
            0,
            rThumbOffset,
            lineTop, mLinePaint);

    // bottom line
    canvas.drawRect(lThumbWidth + lThumbOffset,
            lineBottom,
            rThumbOffset,
            height, mLinePaint);

    // if (lThumbOffset > mThumbWidth) {
    canvas.drawRect(0, 0, lThumbOffset + mThumbWidth, height, mBgPaint);
    // }
    if (rThumbOffset < width - mThumbWidth) {
        canvas.drawRect(rThumbOffset, 0, width, height, mBgPaint);
    }
}