Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24478] Android: postlayout function is called twice when the app starts

GitHub Issuen/a
TypeBug
PriorityMedium
StatusResolved
ResolutionFixed
Resolution Date2017-03-20T22:20:21.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterILAY SENER
AssigneeGary Mathews
Created2017-03-12T23:46:10.000+0000
Updated2017-03-20T22:20:21.000+0000

Description

postlayout calls the linked function twice when the app starts for the first time. when the view/window called/loaded the second time, postlayout function gets called only once. This is also the same with titanium.

Attachments

FileDateSize
bluewin.js2017-03-12T23:44:48.000+0000787
bluewin.xml2017-03-12T23:44:56.000+0000255
index.js2017-03-14T02:43:36.000+0000156
index.js2017-03-12T23:44:46.000+0000989
index.xml2017-03-14T02:43:43.000+0000192
index.xml2017-03-12T23:44:53.000+00001646
Screen Shot 2017-03-14 at 13.41.39.png2017-03-14T02:43:57.000+0000136349

Comments

  1. Hans Knöchel 2017-03-13

    Hey Ilay! This is iOS right? We need to build a single-file example to simplify the testing. Let me know if we can help with that, thx! And in addition to that: On Ti.UI.Window instances, you would rather choose the open or focus event that are specifically made for window lifetime-tracking. Anyway, the postlayout event should still only fire once.
  2. ILAY SENER 2017-03-13

    HI Hans, Ran the app on Android simulator. Will send the single file tomorrow for testing. Is it any easier if I upload the file to github for future ?
  3. Hans Knöchel 2017-03-13

    Thanks, changed the title! Just a simple app.js attached to this ticket, inline as JS or linked via Github is fine. Assigning to [~gmathews] for now, thx!
  4. ILAY SENER 2017-03-14

    OK. Please find the single js & xml file, along with the console screengrab.
  5. ILAY SENER 2017-03-14

    On load is called once, but the postlayout is called twice...
  6. Gary Mathews 2017-03-14

       var win = Ti.UI.createWindow({backgroundColor: 'gray'});
       
       win.addEventListener('open', function() {
           Ti.API.info('open event fired.');
       });
       
       win.addEventListener('postlayout', function() {
           Ti.API.info('postlayout event fired.');
       });
       
       win.open();
       
  7. Gary Mathews 2017-03-14

    master: https://github.com/appcelerator/titanium_mobile/pull/8887

JSON Source