Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6816] Android: UI - heavyweight window open event fired twice

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-01-23T16:17:24.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sSprint 2012-01, Release 2.0.0, Release 1.8.1
ComponentsAndroid
Labelsparity
ReporterDylan Sale
AssigneePing Wang
Created2011-12-20T18:13:48.000+0000
Updated2012-08-14T19:43:48.000+0000

Description

This code:
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#000000', 
    navBarHidden:true
});

win1.addEventListener("open", function(e) {
	Ti.API.debug("OPENED");
});


win1.open();
Changing navBarHidden:true to modal:true also produces the same result OPENED will be called twice when the app starts. Additionally, the win1.activity is stopped after the first time the event fires. I posted this on Q and A at http://developer.appcelerator.com/question/129668/heavyweight-windows-causing-open-event-to-fire-twice

Comments

  1. Ivan Skugor 2011-12-21

  2. Paul Dowsett 2011-12-21

    Dylan Thank you for raising this ticket. I have tested the code, and verified that it produces the results as described . Please note the changes that were necessary, as described in [JIRA Ticket Checklist](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist), in order for me to be able to escalate it. Cheers
  3. Dylan Sale 2011-12-21

    Hi Paul, Sorry about the formatting, I was in a hurry and missed some of the checklist it seems. I notice you changed the component to Android, as a community member it doesn't seem like I have access to that Component.
  4. Paul Dowsett 2011-12-22

    No worries, Dylan - it's all good :)
  5. leoncin 2011-12-27

    vote it. My application which heavily uses 'url' for window creation totally stop working. Hope Titanium can give a fast patch to fix this severe issue.
  6. Shawn Lipscomb 2011-12-27

    Voted. Problem occurs with the released 1.8.0.1 also.
  7. Frank Apap 2011-12-27

    Another vote here. This is preventing me from releasing my app on 1.8
  8. Shawn Lipscomb 2011-12-27

    Heck, I can't even TEST my app because all of my open events are firing twice, which causes all kinds of funny side-effects.
  9. Shawn Lipscomb 2011-12-27

    I've also noticed that the focus event gets fired twice (in my case, when opening a window with the "url" property set). This all works fine in 1.8.0.v... from 09/13/2011.
  10. Ping Wang 2012-01-04

    Below is a sample code to test both "open" and "focus" events. Run it for both heavyweight window and lightweight window. Check the log for result.
        Titanium.UI.setBackgroundColor('#000');
        var win1 = Titanium.UI.createWindow({  
            title:'Tab 1',
            backgroundColor:'#000000', 
            navBarHidden:true
        });
        
        win1.addEventListener("open", function(e) {
        	Ti.API.debug("*****************OPENED");
        });
        
        win1.addEventListener("focus", function(e) {
        	Ti.API.debug("****************FOCUSED");
        });
        
        win1.open();
        
  11. Wilson Luu 2012-01-12

    Closing bug. Verified fix for both heavyweight and lightweight windows on: SDK build: 1.9.0.v20120111233134 Runtime: V8, Rhino Titanium Studio, build: 1.0.8.201201111843 Device: Droid 3 (2.3.4)
  12. Shawn Lipscomb 2012-01-16

JSON Source