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

make mPositionPerc public or add event to track position percentage #122

Open
fugogugo opened this issue Jun 15, 2020 · 10 comments
Open

make mPositionPerc public or add event to track position percentage #122

fugogugo opened this issue Jun 15, 2020 · 10 comments

Comments

@fugogugo
Copy link

fugogugo commented Jun 15, 2020

I see there's mPositionPerc that is used to rotate icon angle according to the position. But unfortunately it isn't accessible.

Actually this mPositionPerc is more useful than just to rotate the icon. I think it would be good if there's event to track this mPositionPerc . In my case I need this value to fade out my background alpha according to the slide position

I want to do it myself but I don't understand how to build the library

@fugogugo
Copy link
Author

Oh wait I'm sorry.

apparently onSlideCompleteAnimationStarted treshold is exactly what I needed.

thank you :)

@fugogugo
Copy link
Author

fugogugo commented Jun 15, 2020

.... Apparently onSlideCompleteAnimationStarted only called when I release the slider .. so there's no actual event to track mPositionPerc in real time

so I will reopen this issue. sorryy

@cortinico
Copy link
Owner

Hi @fugogugo, thanks for sending this feature request.

What you're asking is something like a:

interface OnSlideProgressListener {
    fun onSlideUpdated(view: SlideToActView, progress: Float)
}

as exposing just mPositionPerc will not fit your use case (you want to be notified when the progress change in order to updated your background).

I'm leaning towards not doing this change for mostly two reasons:

  • Seems like this issue will solve only your specific issue and is not a general problem (so far you're the first requesting it).
  • The listener will be invoked really frequently (during every gesture and animation multiple times). This could cause the widget to become laggy and is something that I would love to avoid.

I will leave the issue open to collect feedbacks from the community and hear what's the opinion of other users of the library.

@LassassinX
Copy link

I would love a listener like this. Helps in making animations in my activity more responsive and lively!

@cortinico
Copy link
Owner

Helps in making animations in my activity more responsive and lively!

Can you please describe what you're trying to achieve?

@LassassinX
Copy link

I wish to dynamically fade out a fab that i have on my screen as the user slides the slider. It adds quite a good touch of responsiveness to it.

@LassassinX
Copy link

However, this is not an aesthetic i would want at the cost of performance

@cortinico
Copy link
Owner

However, this is not an aesthetic i would want at the cost of performance

☝️ Exactly. My suggestion here would be to start a fade animation for your FAB once the onSlideCompleteAnimationStarted callback gets fired.

@LassassinX
Copy link

LassassinX commented Sep 13, 2020 via email

@cortinico
Copy link
Owner

Is there anyway to implement a drag listener to this that Will give me How much is Being dragged ??
.

Not at the moment. That's what the issue is about as of today 👍

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

No branches or pull requests

3 participants