Skip to content

Instantly share code, notes, and snippets.

@o4oren
Last active May 2, 2020 17:12
Show Gist options
  • Save o4oren/50628e00d04f57029ad3377794e4e154 to your computer and use it in GitHub Desktop.
Save o4oren/50628e00d04f57029ad3377794e4e154 to your computer and use it in GitHub Desktop.
Rotary knob constructor
class RotaryKnobView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : RelativeLayout(context, attrs, defStyleAttr), GestureDetector.OnGestureListener {
private val gestureDetector: GestureDetectorCompat
private var maxValue = 99
private var minValue = 0
var listener: RotaryKnobListener? = null
var value = 50
private var knobDrawable: Drawable? = null
private var divider = 300f / (maxValue - minValue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment