Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: breakmachine on February 20, 2014, 10:10:03 AM

Title: Cancelling button actions when suspending app (Android)
Post by: breakmachine on February 20, 2014, 10:10:03 AM
Hi again Michael.

I wrote to you in "Improving NGUI" but I think my post and your reply have been erased. Anyhow, my problem was that if a user did this:
1. Press a ngui button (without releasing).
2. Tap the home button with a second finger.
3. Release the first finger once app is suspended.
4. Resume the app.
Then the button would be stuck in the down state.

You posted me a solution where you process all touches upon resuming the app in UICamera. Problem is, when I resume the app with this fix, all the OnClick functions are run aswell which means that the actions (such as go to next page) are fired aswell. My testers/users would expect that to be cancelled.

Now I can think of a few ways to fix this but I'd really like your input.
Title: Re: Cancelling button actions when suspending app (Android)
Post by: ArenMook on February 20, 2014, 10:23:44 AM
Nope, not erased. I split it into a separate post. I've also already fixed it in 3.5.0. Grab the update.
Title: Re: Cancelling button actions when suspending app (Android)
Post by: breakmachine on February 24, 2014, 04:56:52 AM
I grabbed the latest from git today but OnClick functions are still fired.
Title: Re: Cancelling button actions when suspending app (Android)
Post by: ArenMook on February 24, 2014, 03:20:00 PM
Just add
  1. currentTouch.clickNotification = ClickNotification.None;
before each ProcessTouch(false, true); call in the UICamera.OnApplicationPause
Title: Re: Cancelling button actions when suspending app (Android)
Post by: breakmachine on February 25, 2014, 03:23:47 AM
Thanks, got it from github :)