Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set the current angle or progress instead of just start #3

Open
AddictArts opened this issue Aug 4, 2017 · 2 comments
Open
Assignees

Comments

@AddictArts
Copy link

I was able to work around the limitation by using a synthesized MoutionEvent.

@ukevgen ukevgen self-assigned this Aug 9, 2017
@ukevgen
Copy link
Contributor

ukevgen commented Aug 14, 2017

@AddictArts Sorry, what do you mean?

@AddictArts
Copy link
Author

For example a seek bar has setProgress. Currently you can indicate a start, but not externally set it programatically. I worked around this by using a synthetic onTouch event like so:

private fun setVolumeControlViewProgress(v: VolumeControlView, progress: Int) {
    val w: Int = v.width
    val h: Int = v.height
    val controllerCenter = PointF().apply {
        x = w / 2f
        y = h / 2f
    }
    val controllerRadius = if (w > h) h / CONTROLLER_SPACE else w / CONTROLLER_SPACE
    val restoreTouchPoint = getPointOnBorderLineOfCircle(controllerCenter, controllerRadius, (progress *  360) / 100)
    val motionEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_DOWN, restoreTouchPoint.x, restoreTouchPoint.y, 0)

    v.onTouch(contentView!!, motionEvent)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants