Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2579] Window does not reopen properly, different background color and will not close

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:59:30.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M04
ComponentsAndroid
Labelsandroid, defect, release-1.6.0
Reporterpete
AssigneeDon Thorp
Created2011-04-15T03:23:18.000+0000
Updated2011-04-17T01:59:30.000+0000

Description

My app is a type of calculator. Once the user clicks the button Calculate, a new window is opened that shows the results. On this output window I have added a back button which closes the current window. This all works fine unless upon clicking back you once again click calculate. This time, the window opens but the background is black and none of the buttons work, even hitting the Android back key.
What is happening? Was the output window never fully closed?

Comments

  1. Nate Allen 2011-04-15

    I've run into this same problem. It happening to me in Android 1.5.1+. Probably in 1.5.0 as well, but I haven't tested it. It appears to me like the background is simply not there when reopening windows. I've asked this in QA here for more details:

    http://developer.appcelerator.com/question/93591/background-disappears-after-re-opening-window"> http://developer.appcelerator.com/question/93591/background-disappe...

  2. Nate Allen 2011-04-15

    Here is some simplified code that reproduces the issue. This is the entire app.js. Run this with 1.4.3 and the background will return to white after each cycle. Run with 1.5.2, and the screen goes to black after the first click.

       Titanium.UI.setBackgroundColor('#000');
       
       
       var win1 = Titanium.UI.createWindow({  
           backgroundColor:'#000',
           exitOnClose:true,
           navBarHidden:true,
           orientationModes: [Ti.UI.PORTRAIT],
           zIndex:-1
       });
       
       win1.open();
       
       var win3 = Ti.UI.createWindow({backgroundColor:'#FFF'});
       
       var button = Titanium.UI.createButton({
           title:'click to cycle',
           top:190,
           left:30,
           height:50,
           width:250,
           font:{fontSize:20}
       });
       
       win3.add(button);
       
       win3.open();
       
       button.addEventListener('click', function(){
       
       win3.close();
       win3.open();
       });
       
  3. Don Thorp 2011-04-15

    (from [a1a9c2af2ac88a98c13baee4e64ef6e91891e4b7]) [#2579 state:fixed-in-qa] processProperties expects a clone of the properties to be passed. Values are removed by some specialized classes before sending the properties to their parent's processProperties. Note: This example works with open and close in the same click handler because it's a lightweight window. Trying it with an Activity/heavyweight window has unpredictable side-effect due to having to create the new Activity. https://github.com/appcelerator/titanium_mobile/commit/a1a9c2af2ac88a98c13baee4e64ef6e91891e4b7"> https://github.com/appcelerator/titanium_mobile/commit/a1a9c2af2ac8...

  4. Thomas Huelbert 2011-04-15

    closed against Titanium SDK version: 1.6.0 (01/06/11 08:47 8b2fd0e) G1 (1.6) droid 1 (2.2.1) emulator 2.1. checked ipod touch 4gt 4.2.1

  5. pete 2011-04-15

    If I understood correctly the fix is included in the build located
    here:http://builds.appcelerator.com.s3.amazonaws.com/index.html">http://builds.appcelerator.com.s3.amazonaws.com/index.html
    under: Jan 6 2011 02:15 r8b2fd0e4

    If so then the issue is still not resolved for me. The background is no longer black and is now correct however when I scroll up I can see the previous window behind the first.

  6. Don Thorp 2011-04-15

    There is no scroll region in that test. How are you "scrolling up"

  7. pete 2011-04-15

    I created the ticket someone else posted an example. Apparently the example had a different issue than mine. Example code is below:

    app.js

       
       Titanium.UI.setBackgroundColor('#000');


    var win1 = Titanium.UI.createWindow({


       backgroundColor:'#000',
       exitOnClose:true,
       navBarHidden:true,
       orientationModes: [Ti.UI.PORTRAIT],
       zIndex:-1
       
       
       
       
    });
    win1.open();
    var win3 = Titanium.UI.createWindow({
       title: 'Window 3',
       name: 'Window 3',
       backgroundColor: '#C4D5DA',
       fullscreen: false,
       animate: ({opacity: 0,duration: 300 }),
       url: 'win3.js'
       });
       
       
       
       
    win3.open();

    win3.js

       var win3 = Titanium.UI.currentWindow;


    var body = Titanium.UI.createScrollView({

       contentWidth:Titanium.Platform.displayCaps.platformWidth,contentHeight:500,
       right:0,left:0,top:60,bottom:50,width:'auto',height:'auto',
       showHorizontalScrollIndicator:false,showVerticalScrollIndicator:false});
       
       
       
       
    win3.add(body)
    var button = Titanium.UI.createButton({
       title:'click to cycle',
       top:190,
       left:30,
       height:50,
       width:250,
       font:{fontSize:20}
       
       
       
       
    });
    body.add(button);
    button.addEventListener('click', function(){
       win3.close();
       win3.open();
       });</code>
       
       
       
       
  8. pete 2011-04-15

    I apologize for the terrible formatting. I did preview my post but was distracted by a work emergency before I could fix it. I was hoping to be able to edit it after the fact...

    Also, I will try putting my code into a single page and see if that solves my problem.

  9. pete 2011-04-15

    I did create this issue but it seems there were multiple issues I was running into, should I create a new issue? (perhaps someone else should who could define it more clearly...)

  10. pete 2011-04-15

    New ticket created here: https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/2838-reopening-a-window-opens-it-twice"> https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobi...

JSON Source