Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15809] Android: Black window does not appear while clicking next window

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsdev-invalidate, qe-3.2.0
ReporterPragya Rastogi
AssigneeUnknown
Created2013-11-25T10:41:45.000+0000
Updated2018-02-28T20:04:23.000+0000

Description

This is a regression issue as it works fine in SDK:3.1.3.GA Steps to reproduce: 1.Click 'Open win 2'. 2.Click on 'open win 3'. 3.Continue this for few more number of windows. 4.Now hit the device back button & start going back one window every time. Actual: No black window appears when clicked on Next window Expected results: 1.You should see a black window followed by next window with 'open win 3'.You should also see 'focus on win 2'. 2.You should see a black window followed by next window with 'open win 4'.You should also see 'focus on win 3'. 4.With every back button tap we should go one window back & we should get 'focus on win 'x''.where 'x' is the window you are currently on everytime..

var _window = Titanium.UI.createWindow();
if(!(Ti.Platform.osname == 'android')) { // effectively a list of supported platforms
	        var label = tpl.ui.getSkipLabel();
	        _window.add(label);
	        return _window;
	    }
	/**
	 * Creates a simple black light weight window
	 */
	function LightWeightWindow(){
	    var win = Ti.UI.createWindow({
	        backgroundColor: 'black',
	    });
	 
	    return win;
	}
	 
	/**
	 * Creates a heavy weight window
	 * @param {Number} num  the window number
	 */
	function HeavyWeightWindow(num){
	    num ++;
	    // create the window
	    var win = Ti.UI.createWindow({
	        fullscreen: false, // make it heavy weight
	        backgroundColor: '#ccc',
	        title: 'win '+num
	    });
	 
	    // let's do some processing
	    for(var i = 0; i < 200; i++) {
	        win.add(Ti.UI.createView({width:0,height:0,left:0,top:0}));
	    }
	 
	    // open next window
	    var btn = Ti.UI.createButton({
	        title: 'open win ' + (num + 1)
	    });
	 
	    btn.addEventListener('click', function(){
	        // open light weight window
	        var lightWeight = LightWeightWindow();
	        lightWeight.open();
	        // create the next heavy weight window
	        var next =  HeavyWeightWindow(num);
	        // open the heavy weight window
	        next.open();
	        // lastly, close the light weight window
	        lightWeight.close();
	    });
	 
	    // on focus, show the toast notification
	    win.addEventListener('focus', function(){
	        Ti.UI.createNotification({
	            message:'focus on win '+ num,
	            duration: Ti.UI.NOTIFICATION_DURATION_SHORT
	        }).show();
	 
	        Ti.API.info('focus on win '+ num)
	    });
		win.addEventListener('blur', function(){
  
        	Ti.API.info('blur on win '+ num)
    	});
	 
	    win.add(btn);
	 
	    return win;
	}
	 
	_window=HeavyWeightWindow(0);
 _window.open();

Comments

  1. Lokesh Choudhary 2013-11-25

    As of 3.2.0 sdk we do not have any lightweight windows.You can add this flag in your tiapp.xml to create lightweight windows:
    <property name="ti.android.useLegacyWindow" type="bool">true</property>
    Running the above code with the flag in my tiapp.xml, I am seeing the expected results as described above. Environment: Appcel Studio : 3.2.0.201311221207 Ti SDK : 3.2.0.v20131122172908 Mac OSX : 10.8.5 Alloy : 1.3.0 CLI - 3.2.0-alpha Nexus 5 - android 4.4 Samsung Galaxy S4 running android 4.2.2

JSON Source