Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8705] Android: Orientation change doesn't properly reflect the behavior for 'auto' properties

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-04-16T16:32:37.000+0000
Affected Version/sRelease 1.8.1
Fix Version/sn/a
ComponentsAndroid
Labelscore, parity
ReporterJunaid Younus
AssigneeMarshall Culpepper
Created2012-04-12T15:02:36.000+0000
Updated2017-03-09T23:25:28.000+0000

Description

*Code*
var win = Ti.UI.createWindow({
	orientationModes: [ Ti.UI.PORTRAIT,
						Ti.UI.UPSIDE_PORTRAIT,
						Ti.UI.LANDSCAPE_LEFT,
						Ti.UI.LANDSCAPE_RIGHT ],
	backgroundColor: 'white'
});

var view = Ti.UI.createView({
	width: 100,
	height: 100,
	backgroundColor: 'red'
});

Ti.Gesture.addEventListener('orientationchange', function(e)
{
	if (e.orientation == Titanium.UI.PORTRAIT || 
		e.orientation == Titanium.UI.UPSIDE_PORTRAIT)
	{
		Ti.API.info('In portrait mode.');
		view.left = 'auto';
	}
	
	else if (e.orientation == Titanium.UI.LANDSCAPE_LEFT || 
			 e.orientation == Titanium.UI.LANDSCAPE_RIGHT)
	{
		Ti.API.info('In landscape mode.');
		view.left = 10;
	}
});

win.add(view);
win.open();

*Expected behavior* When you rotate the device from portrait to landscape -> the red square should be 10px from the left. Now if you rotate back from landscape to portrait -> the square should be in the center again. *Actual behavior* On the iOS simulator, this is perfectly fine. On an Android device, instead of moving back to the center, left = 0. *Notes* -Only tested on the iOS simulator & HTC Sensation 4G. -Will update customer priority, once I get a reply. *EDIT* Updated priority. -HD ticket: http://support-admin.appcelerator.com/display/APP-647528

Comments

  1. Vishal Duggal 2012-04-13

    'auto' is not a valid value for a positioning pin (left, right, top, bottom, center). 'auto' is supposed to be used with dimension parameters only. Invalid values on IOS are treated as undefined and as 0 on Android.
  2. Junaid Younus 2012-04-16

    Thanks Vishal, makes sense. This ticket can be closed/marked as invalid.
  3. Opie Cyrus 2012-04-16

  4. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source