Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions RangeSeekBar/src/main/java/com/jaygoo/widget/SeekBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public class SeekBar {
private int thumbHeight;
private int textFontFamily;

private final RectF thumbDstRect = new RectF();

//when you touch or move, the thumb will scale, default not scale
float thumbScaleRatio;

Expand Down Expand Up @@ -238,10 +240,15 @@ protected void draw(Canvas canvas) {
* @param canvas canvas
*/
protected void onDrawThumb(Canvas canvas) {
float thumbTop = rangeSeekBar.getProgressTop() + (rangeSeekBar.getProgressHeight() - scaleThumbHeight) / 2f;
if (thumbInactivatedBitmap != null && !isActivate) {
canvas.drawBitmap(thumbInactivatedBitmap, 0, rangeSeekBar.getProgressTop() + (rangeSeekBar.getProgressHeight() - scaleThumbHeight) / 2f, null);
thumbDstRect.set(0, thumbTop, thumbInactivatedBitmap.getWidth(),
thumbTop + thumbInactivatedBitmap.getHeight());
canvas.drawBitmap(thumbInactivatedBitmap, null, thumbDstRect, null);
} else if (thumbBitmap != null) {
canvas.drawBitmap(thumbBitmap, 0, rangeSeekBar.getProgressTop() + (rangeSeekBar.getProgressHeight() - scaleThumbHeight) / 2f, null);
thumbDstRect.set(0, thumbTop, thumbBitmap.getWidth(),
thumbTop + thumbBitmap.getHeight());
canvas.drawBitmap(thumbBitmap, null, thumbDstRect, null);
}
}

Expand Down