[TIMOB-9994] Android: postlayout event not fired for labels
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-10-26T23:38:18.000+0000 |
Affected Version/s | Release 2.1.0 |
Fix Version/s | Sprint 2012-15 Core, Release 2.1.4, Release 3.0.0 |
Components | Android |
Labels | core, layout, module_label, qe-review, qe-testadded |
Reporter | FabianS |
Assignee | Allen Yeung |
Created | 2012-07-05T03:21:33.000+0000 |
Updated | 2013-11-07T05:27:49.000+0000 |
Description
On android no postlayout event is fired.
On iOS, the postlayout event is fired once after adding the label to the window.
If you change label properties, for example width, you can see that the properties are changed but no postlayout event is fired.
The code snippet below is my simple testcase.
var win = Ti.UI.createWindow({
backgroundColor : '#FFF',
layout : 'vertical'
});
var label = Ti.UI.createLabel({
text : "hello",
left : 0,
width : Ti.UI.SIZE,
height : Ti.UI.SIZE
});
label.addEventListener("postlayout", function(e) {
Ti.API.info("label postlayout");
//alert("label post layout");
});
var doBtn = Ti.UI.createButton({
title : "do",
width : Ti.UI.SIZE,
height : Ti.UI.SIZE
});
doBtn.addEventListener("click", function() {
label.text = "new text";
label.backgroundColor = '#F00';
label.left += 20;
});
win.add(doBtn);
win.add(label);
win.open();
Attachments
File | Date | Size |
---|---|---|
app.js | 2012-07-30T18:41:37.000+0000 | 3619 |
Test notes: I have attached an app.js with 12 test cases for the post layout event. At the very bottom of the app.js file, there are 3 groups of controls that you need to test. To make things easier to read, I would recommend running the app three times, each with a different group enabled. Each time you run the app, verify that the postlayout event prints out at least once for each control enabled (the postlayout event may be fired multiple times). Before my change, postlayout events don't fire for any of these controls
Fixed by PR https://github.com/appcelerator/titanium_mobile/pull/2660 against master
Environment used for verification - Tested with Titanium SDK: 2.2.0.v20120815194913 Tested with Titanium Studio: 2.1.1.201207271312 Device - Samsung GALAXY Note Android 2.3.6 Machine OS - MAC 10.7.3
Reopening to update labels
Backport: https://github.com/appcelerator/titanium_mobile/pull/3344
reopen to update fix versions.
Tested with 2.1.4.v20121030173408 on Droid 3 2.3.4
Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4787