Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9846] Android: Views like Label and Label on Button remain on the screen even after window is closed

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-08-02T00:02:12.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sSprint 2012-14 API, Release 2.1.1, Release 3.0.0
ComponentsAndroid
Labelscore, module_views, qe-review, qe-testadded
ReporterAnirudh Nagesh
AssigneePing Wang
Created2012-06-29T13:26:15.000+0000
Updated2012-08-02T00:02:12.000+0000

Description

Views like Label and Label on buttons remain in the screen even after window closes. The views wont get removed instantly as the window closes and can be seen for 1-2secs when back button is pressed. The example application was tried with different approaches such as simple app.js, using Ti.Include() and also Common JS approach ( require). The labels can be seen in all the approaches but with Common Js approach, the transition back from second window to first is fast that labels staying on the window is hard to observe. But it remains on the window. 1. Run the attached app.js to test the bug. 2. To test the bug using common JS approach, run the below code as specified. 3. In app.js
var MainWin = require('mainwin');

MainWin().open();
4. Copy the below code in 'mainwin.js' in resources.
module.exports = function(){
	var win = Ti.UI.createWindow({
		tabBarHidden: true,
		navBarHidden: false,
		backgroundColor: '#a0a0a0'
	});


	var winButton = Ti.UI.createButton({
		title: 'Open window',
		width: 200, height: 100
	});

	winButton.addEventListener('click', function(){
		var OtherWin = require('otherwin');
		OtherWin().open();
	});

	win.add(winButton);

	win.open();

	/*
	win.addEventListener('focus', function() {
		var i, v;

		Ti.API.info('received focus event');
		for(i=0; i<100; i++) {
			Ti.App.Properties.setInt('v', i*i);
			v = Ti.App.Properties.getInt('v', 0);
			Ti.API.info('square: ' + v);
		}
	});
	*/

	return win;
}
5. Copy the below code in 'otherwin.js' under resources.
module.exports = function(){
	var win2 = Ti.UI.createWindow({
		navBarHidden: false,
		tabBarHidden: true
	});

	win2.addEventListener('android:back', function() {
		win2.close();
	});

	var imageView = Ti.UI.createImageView({
		top: 0,
		width: 100, height: 100,
		image: 'KS_nav_ui.png',
		borderColor: 'red'
	});


	var testButton = Ti.UI.createButton({
		title: 'TEST BUTTON',
		font: {
			fontSize: 24,
			fontWeight: 'bold'
		},
		color: 'red',
		width: 200, height: 100
	});

	var labelView = Ti.UI.createLabel({
		text: 'TEST LABEL',
		font: {
			fontSize: 24,
			fontWeight: 'bold'
		},
		color: 'red',
		width: 200, height: 100,
		bottom: 0
	});

	var scrollView = Ti.UI.createScrollView({
		top: 110, height: 200, width: 300,
		scrollType: 'horizontal', contentWidth: 1090,
		backgroundColor: 'green'
	});

	for(i=0; i<10; i++) {
		scrollView.add(Ti.UI.createImageView({
			left: i*110,
			width: 100, height: 100,
			image: 'KS_nav_ui.png',
			borderColor: 'red'
		}));
		scrollView.add(Ti.UI.createLabel({
			text: 'Label ' + i,
			color: 'red',
			font: {
				fontSize: 24,
				fontWeight: 'bold'
			},
			left: i*110,
			width: 100, height: 40,
			bottom: 0
		}));
	}

	win2.add(imageView);
	win2.add(testButton);
	win2.add(labelView);
	win2.add(scrollView);
	return win2;
}
Expected Behavior: As soon as the second window closes, all the views attached to it have to removed. Actual Behavior: The label and button label can be still seen as the second window is closed. This was tested on Samsung Galaxy Tab (3.2), Motorola Atrix(2.3.3) and 4.0 Android emulator. This is not reproducible on Google Nexus running 2.3.3

Attachments

FileDateSize
app.js2012-06-29T13:26:15.000+00001770

Comments

  1. Anirudh Nagesh 2012-07-09

    HD Ticket: appc.me/c/APP-567378
  2. Ping Wang 2012-07-13

    PR https://github.com/appcelerator/titanium_mobile/pull/2537
  3. Anshu Mittal 2012-07-17

    Verified On: SDK: 2.2.0.v20120713210112 Studio: 2.1.1.201207161421 Device: Samsung Galaxy tab(v 3.2) Views like Label and Button label do not remain on screen when window is closed.
  4. Anshu Mittal 2012-07-17

    Verified On: SDK: 2.1.1.v20120716180600 Studio: 2.1.1.201207161421 Device: Samsung Galaxy tab(V 3.2)
  5. Shyam Bhadauria 2012-08-02

    Re-opening to edit label

JSON Source