Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3082] Android: Vertical layout test in KS is missing header

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T02:00:52.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M09
ComponentsAndroid
Labelsandroid, defect, regression, release-1.6.0, reported-1.6.0
ReporterBill Dawson
AssigneeBill Dawson
Created2011-04-15T03:36:27.000+0000
Updated2011-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.

Comments

  1. Bill Dawson 2011-04-15

    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 (the propertyChanged code in TiUIWindow doesn't run.)

    setModelListener gets called when the new activity sends the MSG_ACTIVITY_CREATED message back to TiUIWindow (see TiUIWindow's handleMessage). For reasons I don't understand, that doesn't happen until all these views (in the for loop in my code sample above) have already been created and added to the window.

  2. Bill Dawson 2011-04-15

    I misspoke in the previous comment. The MSG_ACTIVITY_CREATED handling in TiUIWindow occurs before views get added to the window. But layout was not being handled in processProperties (which runs when setModelListener is set). When he handle it in processProperties, everything works fine.

  3. Bill Dawson 2011-04-15

    (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...

  4. Thomas Huelbert 2011-04-15

    [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

JSON Source