cortinico / slidetoact

A simple 'Slide to Unlock' Material widget for Android, written in Kotlin 📱🎨🦄
MIT License
1.2k stars 165 forks source link

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

Open fugogugo opened 4 years ago

fugogugo commented 4 years ago

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 commented 4 years ago

Oh wait I'm sorry.

apparently onSlideCompleteAnimationStarted treshold is exactly what I needed.

thank you :)

fugogugo commented 4 years ago

.... 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 commented 4 years ago

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:

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 commented 4 years ago

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

cortinico commented 4 years ago

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

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

LassassinX commented 4 years ago

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 commented 4 years ago

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

cortinico commented 4 years ago

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 commented 4 years ago

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

On Sun, 13 Sep 2020, 3:15 pm Nicola Corti, notifications@github.com wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cortinico/slidetoact/issues/122#issuecomment-691641885, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANM7O5XHN2PJFM5LADX6I2TSFSER5ANCNFSM4N57SWJA .

cortinico commented 4 years ago

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 👍