GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-09-12T23:41:42.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 19, 2013 Sprint 19 API, Release 3.1.3, Release 3.2.0 |
Components | Android |
Labels | android, defect, menu, module_android, qe-testadded, regression, titanbeta, triage |
Reporter | Shawn Lipscomb |
Assignee | Hieu Pham |
Created | 2013-09-12T14:18:28.000+0000 |
Updated | 2014-04-22T06:35:21.000+0000 |
Problem
Under mobile SDK 3.1.2.GA, normal menus don't pop up any more when the menu button is pressed. Works fine in 3.1.1.GA. Therefore, this is a regression.
Testcase
Using the following code, run the app and press the menu button. With SDK 3.1.2.GA, no menu will appear. With SDK 3.1.1.GA, the menu will appear as normal.
{panel:title=app.js}
var win1=Ti.UI.createWindow({ layout:'vertical',
navBarHidden:true,
exitOnClose:true,
url:'win1.js' });
win1.open();
{panel}
{panel:title=win1.js}
var win1=Ti.UI.currentWindow;
var Label1=Ti.UI.createLabel({ text:'Push the menu button' });
win1.add(Label1);
function MenuHandler(evt)
{
switch (evt.source.order)
{
case 0 : alert('First Option');
break;
case 1 : alert('Second Option');
break;
}
}
function CreateMenu(evt)
{
var MenuItem1,MenuItem2;
MenuItem1=evt.menu.add({title:'Option 1', icon:null, order:0, itemId:0});
MenuItem2=evt.menu.add({title:'Option 2', icon:null, order:1, itemId:1});
MenuItem1.addEventListener('click',MenuHandler);
MenuItem2.addEventListener('click',MenuHandler);
}
win1.activity.onCreateOptionsMenu=CreateMenu;
{panel}
Investigating. Issue seems to be related to using an Android MenuItem in a Window using the 'url' property, thus being opened in a sub-context. The following code is the one provided in the description, but without using the 'url' property and defining everything in a single context. This is working as expected using also 3.1.2.GA and latest 3.1.3
Federico, yes, I noticed that a simple "all-app.js" example worked. But this bug report is about it no longer working in url-based (secondary context) windows.
master PR: https://github.com/appcelerator/titanium_mobile/pull/4683
3.1.X PR: https://github.com/appcelerator/titanium_mobile/pull/4684
Verified as fixed TiSDK 3.1.3.v20130912171547 TiStudio 3.1.3.201309132456 CLI 3.1.2 GA Closing