@Override public boolean onTouch(final View v,final MotionEvent event){
  if (!lollipopAndAbove()) switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    gradientDrawable=new GradientDrawable();
  gradientDrawable.setShape(GradientDrawable.OVAL);
gradientDrawable.setSize(mOriginalThumbHeight / 2,mOriginalThumbHeight / 2);
gradientDrawable.setColor(mIsEnabled ? mThumbColor : Color.LTGRAY);
gradientDrawable.setDither(true);
gradientDrawable.setAlpha(mThumbAlpha);
setThumb(gradientDrawable);
break;
case MotionEvent.ACTION_UP:
gradientDrawable=new GradientDrawable();
gradientDrawable.setShape(GradientDrawable.OVAL);
gradientDrawable.setSize(mOriginalThumbHeight / 3,mOriginalThumbHeight / 3);
gradientDrawable.setColor(mIsEnabled ? mThumbColor : Color.LTGRAY);
gradientDrawable.setDither(true);
gradientDrawable.setAlpha(mThumbAlpha);
setThumb(gradientDrawable);
break;
}
return false;
}

@ Override public boolean onTouch ( final View v , final MotionEvent event ) { if ( ! lollipopAndAbove ( ) ) switch ( event . getAction ( ) ) { case MotionEvent . ACTION_DOWN : gradientDrawable = new GradientDrawable ( ) ; gradientDrawable . setShape ( GradientDrawable . OVAL ) ; gradientDrawable . setSize ( mOriginalThumbHeight / 2 , mOriginalThumbHeight / 2 ) ; gradientDrawable . setColor ( mIsEnabled ? mThumbColor : Color . LTGRAY ) ; gradientDrawable . setDither ( true ) ; gradientDrawable . setAlpha ( mThumbAlpha ) ; setThumb ( gradientDrawable ) ; break ; case MotionEvent . ACTION_UP : gradientDrawable = new GradientDrawable ( ) ; gradientDrawable . setShape ( GradientDrawable . OVAL ) ; gradientDrawable . setSize ( mOriginalThumbHeight / 3 , mOriginalThumbHeight / 3 ) ; gradientDrawable . setColor ( mIsEnabled ? mThumbColor : Color . LTGRAY ) ; gradientDrawable . setDither ( true ) ; gradientDrawable . setAlpha ( mThumbAlpha ) ; setThumb ( gradientDrawable ) ; break ; } return false ; }
touch listener for changing thumb drawable
