{ "id": "79399", "key": "TIMOB-5041", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-09-12T13:36:25.000+0000", "created": "2011-08-17T18:07:23.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "enterprise" ], "versions": [ { "id": "11570", "description": "", "name": "Release 1.7.2", "archived": true, "released": true, "releaseDate": "2011-07-21" } ], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-23T21:37:29.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "The activity related events fire only once on tabgroup activity, but works fine with a heavyweight window.\r\nThe Sample code is below.\r\n{code}\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\n// create tab group\r\nvar tabGroup = Titanium.UI.createTabGroup();\r\n\r\n\r\n//\r\n// create base UI tab and root window\r\n//\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Tab 1',\r\n backgroundColor:'#fff'\r\n});\r\nvar tab1 = Titanium.UI.createTab({ \r\n icon:'KS_nav_views.png',\r\n title:'Tab 1',\r\n window:win1\r\n});\r\n\r\nvar label1 = Titanium.UI.createLabel({\r\n\tcolor:'#999',\r\n\ttext:'I am Window 1',\r\n\tfont:{fontSize:20,fontFamily:'Helvetica Neue'},\r\n\ttextAlign:'center',\r\n\twidth:'auto'\r\n});\r\n\r\nwin1.add(label1);\r\n\r\n//\r\n// create controls tab and root window\r\n//\r\nvar win2 = Titanium.UI.createWindow({ \r\n title:'Tab 2',\r\n backgroundColor:'#fff'\r\n});\r\nvar tab2 = Titanium.UI.createTab({ \r\n icon:'KS_nav_ui.png',\r\n title:'Tab 2',\r\n window:win2\r\n});\r\n\r\nvar label2 = Titanium.UI.createLabel({\r\n\tcolor:'#999',\r\n\ttext:'I am Window 2',\r\n\tfont:{fontSize:20,fontFamily:'Helvetica Neue'},\r\n\ttextAlign:'center',\r\n\twidth:'auto'\r\n});\r\n\r\nwin2.add(label2);\r\n\r\n\r\n\r\n//\r\n// add tabs\r\n//\r\ntabGroup.addTab(tab1); \r\ntabGroup.addTab(tab2); \r\n\r\n\r\n// open tab group\r\ntabGroup.open();\r\n\r\nTi.Android.currentActivity.addEventListener('pause', function(e){\r\n\tTi.API.info('changeState App is pausing');\r\n});\r\n\r\nTi.Android.currentActivity.addEventListener('resume', function(e){\r\n\tTi.API.info('changeState App is resuming');\r\n});\r\n{code}\r\n\r\nh3. Associated Hepdesk ticket:\r\nappc.me/c/APP-834283", "attachment": [], "flagged": false, "summary": "Android: Activity related events fire only once for tabgroup activity", "creator": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Ti SDK 1.7.2 and Android 2.2", "comment": { "comments": [ { "id": "164324", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "Check out the workaround on [TIMOB-4121] for an explanation of how to get around what you are seeing.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-08-29T10:12:11.000+0000", "updated": "2011-08-29T10:12:11.000+0000" }, { "id": "164519", "author": { "name": "moshebox@gmail.com", "key": "moshebox@gmail.com", "displayName": "Moshe Marciano", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "The example in that ticket relies on multi-context application (url parameter in the createWindow call), we have a big app that suffered major stability issues until we were advised by you guys to convert it to a single-context app - that helped a lot, but set us back weeks behind our schedule.\r\n\r\nwe cannot convert it back to multi-context because we don't have the time and it will bring instability back to the app.\r\n\r\nwe need another workaround even if it is only temporary and even if it means a private fork of the framework...we need to ship the product ASAP.", "updateAuthor": { "name": "moshebox@gmail.com", "key": "moshebox@gmail.com", "displayName": "Moshe Marciano", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2011-08-30T09:56:01.000+0000", "updated": "2011-08-30T09:56:01.000+0000" }, { "id": "164521", "author": { "name": "moshebox@gmail.com", "key": "moshebox@gmail.com", "displayName": "Moshe Marciano", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "BTW, all we need is to repsond to when the user presses the HOME key and send the app to the background...we need to cleanup and also when the app is resumed, we need to reinitiate. We don't need control per tab...right now we get a single event and further pause/resumed are not triggered.", "updateAuthor": { "name": "moshebox@gmail.com", "key": "moshebox@gmail.com", "displayName": "Moshe Marciano", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2011-08-30T10:06:31.000+0000", "updated": "2011-08-30T10:06:31.000+0000" }, { "id": "165682", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "The activity is in relationship with the window. This code works as expected:\r\n\r\n(assuming this is a single context application)\r\nh3. Code:\r\n{code}\r\nvar W = {};\r\nW.Window = function(currentTab){\r\n\t\r\n\tvar win = Ti.UI.createWindow({\r\n\t\tfullscreen:false,\r\n\t\tbackgroundColor:\"#\"+((1<<24)*Math.random()|0).toString(16)\r\n\t});\r\n\tvar btn = Ti.UI.createButton({\r\n\t\ttitle:'click',\r\n\t\twidth:200,\r\n\t\theight:50\r\n\t});\r\n\twin.add(btn);\r\n\t\r\n\tbtn.addEventListener('click', function(){\r\n\t\tcurrentTab.open(W.Window(currentTab));\r\n\t});\r\n\t\r\n\twin.addEventListener('focus', function(){\r\n\t\tTi.API.info(' -=-=-=-=-=-=- focus -=-=-=-=-=-=- ');\r\n\t});\r\n\twin.activity.addEventListener('pause', function(){\r\n\t\tTi.API.info(' -=-=-=-=-=-=- pause -=-=-=-=-=-=- ');\r\n\t});\r\n\twin.activity.addEventListener('resume', function(){\r\n\t\tTi.API.info(' -=-=-=-=-=-=- resume -=-=-=-=-=-=- ');\r\n\t});\r\n\treturn win;\r\n}\r\n\r\nW.TabGroup = function(){\r\n\tvar tabGroup = Ti.UI.createTabGroup();\r\n\tvar tab1 = Ti.UI.createTab({\r\n\t\ttitle:'win1'\r\n\t});\r\n\ttab1.window = W.Window(tab1);\r\n\tvar tab2 = Ti.UI.createTab({\r\n\t\ttitle:'win2'\r\n\t});\r\n\ttab2.window = W.Window(tab2);\r\n\ttabGroup.addTab(tab1);\r\n\ttabGroup.addTab(tab2);\r\n\treturn tabGroup;\r\n}\r\n\r\nW.TabGroup().open();\r\n{code}\r\n\r\nh3. Conclusion:\r\n- Make the windows \"fullscreen: false\"\r\n- And set the event listener to the window's activity", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-09-12T13:02:26.000+0000", "updated": "2011-09-12T13:02:26.000+0000" }, { "id": "165691", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Working sample code provided. This is not a bug.", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-09-12T13:36:25.000+0000", "updated": "2011-09-12T13:36:25.000+0000" }, { "id": "195897", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This example only works if the window is part of a tabGroup. \r\nOtherwise, if you have a heavyweight window that is not part of a tabGroup, \r\n\r\nif you try to do something with the activity of the heavyweight window, such as\r\n\r\nwin.activity.addEventListener('pause', function () { Ti.API.info('pause') });\r\n\r\nyou get \"Uncaught TypeError: Object # has no method 'addEventListener'\r\n\r\nIf you need an example, just remove the tabGroup from the above example.\r\n\r\nSo for us that do not use tabGroup's, what should we do to get access to pause & resume events.", "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-24T03:49:44.000+0000", "updated": "2012-05-24T03:49:44.000+0000" }, { "id": "195899", "author": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "jfalcone", "key": "jfalcone", "displayName": "Joe Falcone", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-24T04:00:03.000+0000", "updated": "2012-05-24T04:00:03.000+0000" }, { "id": "415416", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid with reference to the previous comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-23T21:37:29.000+0000", "updated": "2017-03-23T21:37:29.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }