shalskar / PeekAndPop

497 stars 65 forks source link

onLongHold out of PeekView #8

Closed AngleV closed 8 years ago

AngleV commented 8 years ago

@shalskar

When user hold his finger on a view that i have assing as a LongHoldView, a small tooltip pops up as like instagram does.

The issue here is that when user moves his finger out of the peekview, the tooltip stays there as i dont have a way to dismiss it. Consider adding an OnLeaveListener would be nice.

shalskar commented 8 years ago

For functionality similar to Instagram I think the using a HoldAndReleaseView would be better for this. Currently for the HoldAndReleaseView an event is only triggered on release but I'll be updating the library shortly to include an event for on hold too and on leave.

Does this help?

AngleV commented 8 years ago

@shalskar What it would be more useful. Consider the following code.

        peekAndPop.setOnHoldAndReleaseListener(new PeekAndPop.OnHoldAndReleaseListener() {

          @Override
            public void onHoldAndRelease(View view, int position) {
               //user released the finger
              //do your stuff
            }

          @Override
            public void onHold(View view, int position) {
               //user is holding the finger on the view
              a setLongHoldDuration method would be nice here for this also.
              //do your stuff also
            }

          @Override
            public void onLeave(View view, int position) {
               //user left his finger from the view

              //do your stuff also
            }

        });

what do you think ?

shalskar commented 8 years ago

Cool, that's why I'm currently doing now, I should have it up soon.

AngleV commented 8 years ago

Awesome mate !!! :p

shalskar commented 8 years ago

I have added the functionality now, let me know if you have any problems.

compile 'com.github.shalskar:PeekAndPop:3e3225c340'

AngleV commented 8 years ago

it works PERFECT !!! Thank you