Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RotartyKnob initialization
init {
this.maxValue = maxValue + 1
LayoutInflater.from(context)
.inflate(R.layout.rotary_knob_view, this, true)
context.theme.obtainStyledAttributes(
attrs,
R.styleable.RotaryKnobView,
0,
0
).apply {
try {
minValue = getInt(R.styleable.RotaryKnobView_minValue, 0)
maxValue = getInt(R.styleable.RotaryKnobView_maxValue, 100) + 1
divider = 300f / (maxValue - minValue)
value = getInt(R.styleable.RotaryKnobView_initialValue, 50)
knobDrawable = getDrawable(R.styleable.RotaryKnobView_knobDrawable)
knobImageView.setImageDrawable(knobDrawable)
} finally {
recycle()
}
}
gestureDetector = GestureDetectorCompat(context, this)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.