Author Topic: Cancelling button actions when suspending app (Android)  (Read 6860 times)

breakmachine

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 71
    • View Profile
Cancelling button actions when suspending app (Android)
« 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Cancelling button actions when suspending app (Android)
« Reply #1 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.

breakmachine

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 71
    • View Profile
Re: Cancelling button actions when suspending app (Android)
« Reply #2 on: February 24, 2014, 04:56:52 AM »
I grabbed the latest from git today but OnClick functions are still fired.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Cancelling button actions when suspending app (Android)
« Reply #3 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

breakmachine

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 71
    • View Profile
Re: Cancelling button actions when suspending app (Android)
« Reply #4 on: February 25, 2014, 03:23:47 AM »
Thanks, got it from github :)