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
How can I make a swipe transition? #3
Comments
Which part exactly looks bad? If you are trying to set the touch listener on the element you are resizing ("screen") you will get a weird twitch on the view. If this is your problem, try setting the touch listener on another view, one which is static (I usually set it on the root one). |
screen is the static/root one (the constraintlayout). The result is the disaster you can see down below. : \ |
Before you create your Transitioner object you have to wait for the screen and the views to be drawn. I recommend placing it in a layout listener or, like the example shows, to add a small delay before creating the object. |
Ok I create a layout listener and it works, but the animation in REALLY fast, I hope to adjust it by my own. Thanks a lot! |
Hello!
I really like your library and I'm trying to develop a transition like the weather app on your Readme: how could I make an up/down swipe?
I've tried with this but the result is VERY BAD. Do you know where I can find some examples? Thanks.
var screenSize = size.y screen.setOnTouchListener { v, event -> when (event.action) { MotionEvent.ACTION_DOWN -> { oldY = event.y true } MotionEvent.ACTION_MOVE -> { transition.setProgress((event.y - oldY)/screenSize) true } else -> { true } } }
The text was updated successfully, but these errors were encountered: