Skip to content

Commit

Permalink
Merge pull request #17 from takahirom/master
Browse files Browse the repository at this point in the history
Add onStart and onStop to OnProgressChangeListener
  • Loading branch information
AnderWeb committed Feb 20, 2015
2 parents 450e579 + 9d029fe commit 7386ab5
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public interface OnProgressChangeListener {
* @param fromUser if the change was made from the user or not (i.e. the developer calling {@link #setProgress(int)}
*/
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser);

public void onStartTrackingTouch(DiscreteSeekBar seekBar);
public void onStopTrackingTouch(DiscreteSeekBar seekBar);
}

/**
Expand Down Expand Up @@ -652,6 +655,10 @@ private boolean startDragging(MotionEvent ev, boolean ignoreTrackIfInScrollConta
bounds.inset(-mAddedTouchBounds, -mAddedTouchBounds);
mIsDragging = (bounds.contains((int) ev.getX(), (int) ev.getY()));
if (!mIsDragging && mAllowTrackClick && !ignoreTrackIfInScrollContainer) {
if (mPublicChangeListener != null) {
mPublicChangeListener.onStartTrackingTouch(this);
}

//If the user clicked outside the thumb, we compute the current position
//and force an immediate drag to it.
mIsDragging = true;
Expand All @@ -675,6 +682,9 @@ private boolean isDragging() {
}

private void stopDragging() {
if (mPublicChangeListener != null) {
mPublicChangeListener.onStopTrackingTouch(this);
}
mIsDragging = false;
setPressed(false);
}
Expand Down

0 comments on commit 7386ab5

Please sign in to comment.