[TIMOB-3082] Android: Vertical layout test in KS is missing header
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T02:00:52.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.6.0 M09 |
Components | Android |
Labels | android, defect, regression, release-1.6.0, reported-1.6.0 |
Reporter | Bill Dawson |
Assignee | Bill Dawson |
Created | 2011-04-15T03:36:27.000+0000 |
Updated | 2011-04-17T02:00:52.000+0000 |
Description
Generally speaking: if a heavyweight window's
layout
property is set to vertical
via
its proxy after the window is already open, things added
to the window after that don't respect the vertical layout.
The KitchenSink vertical layout test is a good example: the header doesn't show.
But here's a simpler app.js failcase:
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({
backgroundColor:'#000',
exitOnClose: true,
fullscreen: true,
navBarHidden: true
});
win.open();
win.layout = 'vertical';
for (var i = 0; i < 10; i++) {
win.add( Ti.UI.createLabel({ text: 'Label ' + i, height: 40 }) );
}
The labels added there near the end will all stack up on each other in the middle of the window.
The reason this happens is that when
win.layout = 'vertical';
occurs in the code above, the view (TiUIWindow) has not yet been set as a model listener on the window proxy. So though KrollProxy fires a property change when
layout
gets set, TiUIWindow doesn't know about it and doesn't set its layout accordingly (thepropertyChanged
code in TiUIWindow doesn't run.)setModelListener
gets called when the new activity sends theMSG_ACTIVITY_CREATED
message back to TiUIWindow (see TiUIWindow'shandleMessage
). For reasons I don't understand, that doesn't happen until all these views (in thefor
loop in my code sample above) have already been created and added to the window.I misspoke in the previous comment. The
MSG_ACTIVITY_CREATED
handling in TiUIWindow occurs before views get added to the window. Butlayout
was not being handled inprocessProperties
(which runs whensetModelListener
is set). When he handle it inprocessProperties
, everything works fine.(from [bd9d12403051a464ec102f46aac9c4420a45a7e6]) [#3082 state:fixed-in-qa] Add 'layout' to one of the properties checked and handled in TiUIWindow processProperties https://github.com/appcelerator/titanium_mobile/commit/bd9d12403051a464ec102f46aac9c4420a45a7e6"> https://github.com/appcelerator/titanium_mobile/commit/bd9d12403051...
[INFO] Titanium SDK version: 1.6.0 (02/08/11 20:55 bd9d124...) galaxy tab (2.2.2) G1 (1.6) Nexus S (2.3) sim 2.1