shalskar / PeekAndPop

496 stars 65 forks source link

Not get pop method some times #15

Open JitenNumberTank opened 8 years ago

JitenNumberTank commented 8 years ago

Hello sir,

I have put my peekAndPop code in adapter. Sometimes its not call pop method and view available on screen after peek method. I am getting this 1 of 25 times. So its very ridicules for me to test that event. I track this code. I am getting this thing when Its call MotionEvent.ACTION_CANCEL in onTouch Method. looking forward for your reply asap

shalskar commented 8 years ago

Hello, is the MotionEvent.ACTION_CANCEL event being received by the PeekAndPopOnTouchListener? Or is it being intercepted by another view/listener?

JitenNumberTank commented 8 years ago

No. I have disable other controls. I am some time stucked in peek event. my screen getting open. not get pop event after getting MotionEvent.ACTION_CANCEL event

JitenNumberTank commented 8 years ago

No. I have disable other controls. I am some time stucked in peek event. my screen getting open. not get pop event after getting MotionEvent.ACTION_CANCEL event

On Fri, Jun 3, 2016 at 10:29 PM, Vincent Te Tau notifications@github.com wrote:

Hello, is the MotionEvent.ACTION_CANCEL event being received by the PeekAndPopOnTouchListener? Or is it being intercepted by another view/listener?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/shalskar/PeekAndPop/issues/15#issuecomment-223634307, or mute the thread https://github.com/notifications/unsubscribe/ANb0Tqm3HubyaC3PndHREQOa8AzGhem_ks5qIF1pgaJpZM4Itgt6 .

       Thanks & Regards,

Jiten Ramoliya

JitenNumberTank commented 8 years ago

I manually call pop method in ontouch for cancel event. I found animation end also call with resetViews() where you did hide peekLayout but I not going view in my screen screenshot_20160604-145448 1

shalskar commented 8 years ago

Hi, I believe the problem was to do with the small latency between the longHoldTimer and and the Runnable within it that was ran on the UI thread. This meant that the longHoldTimer would be cancelled after the Runnable was put onto the task back stack, however since the Runnable hadn't actually begun and set peekShown to true, pop() wasn't called.

I have fixed this storing the Runnable as a field and checking if it is null when cancelling the pending timer. I believe this should fix the problem, however if it still persists please let me know!

The new version is: v1.0.1

JitenNumberTank commented 8 years ago

Still getting that issue. not not getting pop method. screen showing that I have attached

shalskar commented 8 years ago

Oh ok, I'm finding it quite hard to reproduce (I clicked over 200 times). I've made another change in a separate branch that mayhave fixed it.

https://github.com/shalskar/PeekAndPop/tree/bugfix-persistentpeekview

Try that out (use the Jitpack build from that branch) and see if it helps. If that fixes it I'll merge in back into master.

JitenNumberTank commented 8 years ago

Ok. Let me check that branch. I have found another issue. If I continues peek on image then background blured going to black gradually. I think this because of doing get screenshot in R.id.content where we have adding this peekview so peekview added in next screenshot.

On Sat, Jun 4, 2016 at 4:47 PM, Vincent Te Tau notifications@github.com wrote:

Oh ok, I'm finding it quite hard to reproduce (I clicked over 200 times). I've made another change in a separate branch that mayhave fixed it.

https://github.com/shalskar/PeekAndPop/tree/bugfix-persistentpeekview

Try that out (use the Jitpack build from that branch) and see if it helps. If that fixes it I'll merge in back into master.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/shalskar/PeekAndPop/issues/15#issuecomment-223750321, or mute the thread https://github.com/notifications/unsubscribe/ANb0Tn6jWebddNoRiyTfCnTw0oG2S_Jbks5qIV7IgaJpZM4Itgt6 .

       Thanks & Regards,

Jiten Ramoliya

JitenNumberTank commented 8 years ago

I have checked that branch but issue is still remaining. Do you know how to fix that?

shalskar commented 8 years ago

In response to your message on the other issue: "hello shalskar, Do you have any forked user who make this library better after forking and get more star? If you have then suggest me so I can check difference there and rectify this issue"

I have had a few small contributions from other devs but I don't think anyone has made a fork and done any drastic changes. You're welcome to create your own fork and see if you can fix this issue (or any other improvements you have in mind.)

I'm having trouble replicating this bug after using the latest branch. I've tried it on 2 devices (one running 6.0 and the other 4.4) and even after locking/unlocking the phone and pressing the peekview 500+ times I couldn't replicate it.

I'm thinking of writing some instrumentation tests to simplify the testing of such bugs.

If you have any more info on how to reproduce this bug then feel free to tell me.

JitenNumberTank commented 8 years ago

I am using with listview. So You can try this lock/unlock case with it. I also provided parentViewGroupToDisallowTouchEvents(listview). but I don't know why I am getting this issue everytime after lock/unlock device.

shalskar commented 8 years ago

Are you calling peekAndPop.destroy() in your activity's onDestroy() method? Are you still getting the bug even when you don't lock/unlock the device?

JitenNumberTank commented 8 years ago

yes, but I am doing test in only one activity. so that activity not destroy before I got this issue

JitenNumberTank commented 8 years ago

this is going as well in action_down. but only getting problem while get action_cancel

shalskar commented 8 years ago

Sorry I don't completely understand, could you please rephrase that?

JitenNumberTank commented 8 years ago

Sorry, this is working as well when tringgered action_up event in touch. but only getting problem while triggered action_cancel in touch event for peekandpop class.

shalskar commented 8 years ago

That's really strange, as action_cancel is included in both if statements with action_up. If the peekView itself is receiving these events then I can't see what the difference would be.

Another developer had the same issue, he was able to solve it by including the following into the xml file of the long click view:

android:clickable="true"
android:focusableInTouchMode="true"
android:focusable="true"

He found that somehow the view was losing focus and then not receiving any further touch events. I'm not sure if this would work in your case however.

JitenNumberTank commented 8 years ago

I have used this three line im my xml file. But getting same issue

android:clickable="true"
android:focusableInTouchMode="true"
android:focusable="true"
shalskar commented 8 years ago

OK, I'm going to write so instrumentation tests in the following weeks when I have more time. This should help replicating bugs like this. In the mean time feel free to create a branch and see if you can resolve the issue yourself.

JitenNumberTank commented 8 years ago

​ PeekpopDemo.tar.gz https://drive.google.com/a/numbertank.com/file/d/0ByyUWVxqBHVvMEttZkY5OVZUUzA/view?usp=drive_web ​hello sir, I have made one demo so you get idea about my using cash. I am getting same problem in this demo. I have used your branch that you have provided. but I was got problem in that. so I have changes code and check. but it still getting problem

On Mon, Jun 6, 2016 at 3:55 PM, Vincent Te Tau notifications@github.com wrote:

That's really strange, as action_cancel is included in both if statements with action_up. If the peekView itself is receiving these events then I can't see what the difference would be.

Another developer had the same issue, he was able to solve it by including the following into the xml file of the long click view:

android:clickable="true" android:focusableInTouchMode="true" android:focusable="true"

He found that somehow the view was losing focus and then not receiving any further touch events. I'm not sure if this would work in your case however.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/shalskar/PeekAndPop/issues/15#issuecomment-223921811, or mute the thread https://github.com/notifications/unsubscribe/ANb0TnjyIm3PlEH-_c_a5Fr-ATgNFHq3ks5qI_WGgaJpZM4Itgt6 .

       Thanks & Regards,

Jiten Ramoliya

shalskar commented 8 years ago

I have had a look at your code and was able to find the cause of the problem. If the longHoldView doesn't also have an OnClickListener set, then the PeekAndPopOnTouchListener will fail to receive any up or cancel MotionEvents.

I have updated the branch with a fix that should solve your problem:

https://github.com/shalskar/PeekAndPop/tree/bugfix-persistentpeekview

Please let me know if this works and I will merge it back into master.

JitenNumberTank commented 8 years ago

Ok. Let me check that branch. I will let you know what result I get

shalskar commented 8 years ago

Did this work?

JitenNumberTank commented 8 years ago

Currently I am working on another Module. i will contact you soon when move on that module.

On Mon, Jun 13, 2016 at 12:39 PM, Vincent Te Tau notifications@github.com wrote:

Did this work?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/shalskar/PeekAndPop/issues/15#issuecomment-225504058, or mute the thread https://github.com/notifications/unsubscribe/ANb0Tm7aRmna2MRLaMXmgcClzdJdPr5vks5qLQISgaJpZM4Itgt6 .

       Thanks & Regards,

Jiten Ramoliya

JitenNumberTank commented 8 years ago

Hello sir, I returned on this module now. I have tried that updated code but still getting same error.

JitenNumberTank commented 8 years ago

Sir, I already comment here. Please! could you tell me why We all getting this isuue?

shalskar commented 8 years ago

Unfortunately I am having trouble reproducing this bug even using your demo with the new branch. I am very busy with work at the moment and will only be able to get back to this project once I am not so busy.

If this bug is urgent I recommend jumping into the code yourself and seeing if you can find where the bug is caused, which may be easier seeing as you can reproduce it.

JitenNumberTank commented 8 years ago

Lots of thanks sir for your work, I am also trying to get rid of this bug. I am getting pop method call but stil found image hanged at top.

shalskar commented 8 years ago

Ok, if you find a solution, feel free to make a pull request. Otherwise once I can start working on this again I will comment here if I think I have resolved this bug.

JitenNumberTank commented 8 years ago

Sure, If i get any solution then make a pull request.

JitenNumberTank commented 8 years ago

I found used listview with Swipelayout. https://github.com/daimajia/AndroidSwipeLayout It also work on touch and I think its getting clash with Peek and Pop Library. Pop method every time call after peek but I didn't get idea why is come MotionEvent.Action_Cancel after lock and unlock phone. before that I am getting MotionEvent.Action_Cancel lock and unlock phone. before that I am getting MotionEvent.Action_Up and everything is working fine.

JitenNumberTank commented 8 years ago

Hello Shalskar,

I have founded where is problem remain. I put log in peek and pop method and done some changes. I add peekLayout in peek and remove it from peekLayout. and I got log like

In Normal case---------- peek before::3 after adding view ( contentView.addView(peekLayout)); peek after::4

pop before::4 after removing peekLayout (contentView.removeView(peekLayout);) pop after::3

n Phone Unlock case (Got MotionEvent.Action_Cancel) case---------- peek before::3 after adding view ( contentView.addView(peekLayout)); peek after::4

pop before::4 after removing peekLayout ( contentView.removeView(peekLayout)); pop after::4

Could you tell me how I am getting this issue while removing chilview from parent.