[AC-3212] Support android:back event for non-heavy windows
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2012-02-21T14:42:21.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Mark Burggraf |
Assignee | Radamantis Torres-Lechuga |
Created | 2012-01-22T16:27:40.000+0000 |
Updated | 2016-03-08T07:57:37.000+0000 |
Description
Please support the android:back event for light windows as well as heavy windows. At this time, unless a window is heavy (i.e. contains a url parameter from which all its code is derived) the android:back even does not fire on that window.
As a result, in order to trap the android [hardware] back button, I need to employ a pretty extensive workaround, that includes the following steps:
Attach an android:back event handler to the main (root) window.
Ti.App.fireEvent when the event handler is triggered.
Maintain an application-wide stack of window names.
Push and pop each window's name onto the stack as it is opened and closed.
Write an event handler in each window that checks to see if it's currently the top window on the stack, and if so, close the current window.
Hi Mark. To make window heavyweight on Android, you don't have to use "url" property. "url" besides creating heavyweight window, creates new context. But, to make window heavyweight, you can define its "modal", "fullscreen" or "navbarHidden" property (and that would not create new context). So, you can create window and include necessary code via "Ti.include" or "require" functions. Cheers, Ivan.
As Ivan suggested, there is a bunch of ways to get this functionality.
Tested with Android Samsung Galaxy Nexus SDK 3.2.0.GA Android version: 4.1.1 Test code is working, alert is showing, that means the window (lightweight) is getting the event.
Closing this since the feature exists in our latest version of the SDK.