{ "id": "85346", "key": "TIMOB-7351", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13408", "description": "Sprint 2012-12 API", "name": "Sprint 2012-12 API", "archived": true, "released": true, "releaseDate": "2012-06-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-07-05T03:40:07.000+0000", "created": "2012-01-24T07:34:10.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "module_imageview", "parity", "qe-testadded" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [], "assignee": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-07-05T10:32:14.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h2. Problem\r\n\r\nThe {{animating}} property defaults to {{false}} on creation, but is then set to {{true}} on load, even though the animation does not run.\r\n\r\nThe {{start()}} method needs to be invoked to start the animation, and the {{animating}} property remains set at the same value ({{true}}).\r\n\r\nHence, to resolve this, ensure that the {{start()}} method works correctly, and the {{animating}} property reflects the actual animation state. Hence, surely {{animating}} should be {{false}} on load until the {{start}} event is fired?\r\n\r\nh2. Test case\r\n\r\n# create a new project\r\n# replace the {{app.js}} code with the code below\r\n# extract the attached zip of images to the {{/images}} folder. Note that the campfire images included in the archive are taken from the KS\r\n# launch project\r\n# on second launch, enable the {{start()}} method in the load eventListener\r\n\r\n{code:lang=javascript|title=app.js}\r\nTi.UI.backgroundColor = 'white';\r\nvar win = Ti.UI.createWindow({\r\n exitOnClose: true,\r\n layout: 'vertical'\r\n});\r\n\r\nvar switchAnimation = Ti.UI.createSwitch({\r\n title: 'Start',\r\n value:false,\r\n top: 20\r\n});\r\nwin.add(switchAnimation);\r\n\r\nvar imageArray = [];\r\n\r\nvar imgName = 'campFire';\r\nvar imgExt = 'gif';\r\nvar imgNum = 17;\r\n\r\nfor (var i=1;i<=imgNum;i++){\r\n imageArray.push('/images/' + imgName + ((i<10) ? '0'+i : i) + '.' + imgExt);\r\n}\r\n\r\nvar imageSeries = Ti.UI.createImageView({\r\n defaultImage: '/images/campFire01.gif',\r\n images: imageArray,\r\n duration:100,\r\n repeatCount:0,\r\n top: 20,\r\n height:200\r\n});\r\nwin.add(imageSeries);\r\n\r\nTi.API.info('Before load 1): imageSeries.animating = ' + imageSeries.animating); // returns false\r\n\r\nimageSeries.addEventListener('load', function(e){\r\n Ti.API.info('After load 1): imageSeries.animating = ' + imageSeries.animating); // returns true\r\n // e.source.start(); // uncomment this to allow the animation to run properly\r\n Ti.API.info('After load 2): imageSeries.animating = ' + imageSeries.animating); // returns true\r\n});\r\n\r\nswitchAnimation.addEventListener('click', function(e){\r\n if(imageSeries.animating === false){\r\n e.value = true;\r\n imageSeries.start();\r\n Ti.API.info('After switch 3): imageSeries.animating = ' + imageSeries.animating);\r\n } else {\r\n e.value = false;\r\n imageSeries.stop();\r\n Ti.API.info('After switch 4): imageSeries.animating = ' + imageSeries.animating);\r\n }\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\nh2. Logs\r\n\r\nWith start() NOT invoked in the load event listener, animation DOES NOT start and gives the following results.\r\n\r\n{code:lang=none|title=}\r\n887 TiAPI I (kroll$1: app://app.js) [247,923] Before load 1): imageSeries.animating = false\r\n887 TiAPI I (kroll$1: app://app.js) [622,1384] After load 1): imageSeries.animating = true\r\n887 TiAPI I (kroll$1: app://app.js) [1,1385] After load 2): imageSeries.animating = true\r\n{code}\r\n\r\nWith start() invoked in the load event listener, animation DOES start, and gives the same results.\r\n\r\n{code:lang=none|title=console}\r\n887 TiAPI I (kroll$1: app://app.js) [247,923] Before load 1): imageSeries.animating = false\r\n887 TiAPI I (kroll$1: app://app.js) [622,1384] After load 1): imageSeries.animating = true\r\n887 TiAPI I (kroll$1: app://app.js) [1,1385] After load 2): imageSeries.animating = true\r\n{code}\r\n\r\n", "attachment": [ { "id": "25289", "filename": "images.zip", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-24T07:42:34.000+0000", "size": 1145043, "mimeType": "application/zip" } ], "flagged": false, "summary": "Android: ImageView.images - animated images do not start on load and animating property value incorrect", "creator": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "environment": null, "comment": { "comments": [ { "id": "197695", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Test case for functional test:\r\n{code}\r\nTi.UI.backgroundColor = 'white';\r\nvar win = Ti.UI.createWindow({\r\n exitOnClose: true,\r\n layout: 'vertical'\r\n});\r\n \r\nvar switchAnimation = Ti.UI.createSwitch({\r\n title: 'Start',\r\n value:false,\r\n top: 20\r\n});\r\nwin.add(switchAnimation);\r\n \r\nvar imageArray = [];\r\n \r\nvar imgName = 'campFire';\r\nvar imgExt = 'gif';\r\nvar imgNum = 17;\r\n \r\nfor (var i=1;i<=imgNum;i++){\r\n imageArray.push('/images/' + imgName + ((i<10) ? '0'+i : i) + '.' + imgExt);\r\n}\r\n \r\nvar imageSeries = Ti.UI.createImageView({\r\n defaultImage: '/images/campFire01.gif',\r\n images: imageArray,\r\n duration:100,\r\n repeatCount:0,\r\n top: 20,\r\n height:200\r\n});\r\nwin.add(imageSeries);\r\n \r\nTi.API.info('******************* Before load: imageSeries.animating = ' + imageSeries.animating);\r\n \r\nimageSeries.addEventListener('load', function(e){\r\n Ti.API.info('******************* After load: imageSeries.animating = ' + imageSeries.animating);\r\n});\r\n\r\nimageSeries.addEventListener('start', function(e){\r\n Ti.API.info('******************* After start: imageSeries.animating = ' + imageSeries.animating);\r\n});\r\n\r\nimageSeries.addEventListener('stop', function(e){\r\n Ti.API.info('******************* After stop: imageSeries.animating = ' + imageSeries.animating);\r\n});\r\n\r\nswitchAnimation.addEventListener('click', function(e){\r\n if(imageSeries.animating === false){\r\n e.value = true;\r\n imageSeries.start();\r\n } else {\r\n e.value = false;\r\n imageSeries.stop();\r\n }\r\n});\r\n \r\nwin.open();\r\n{code}\r\n\r\nTest steps:\r\n1. Extract the attached zip of images to the /images folder\r\n2. Run the above code and check the console. Output should be:\r\n{code}\r\n******************* Before load: imageSeries.animating = false\r\n******************* After load: imageSeries.animating = false\r\n{code}\r\n3. Click the switch button. Animation is shown and started. Output in the console is:\r\n{code}\r\n******************* After start: imageSeries.animating = true\r\n{code}\r\n4. Click the switch button again. Animation is stopped. Output is:\r\n{code}\r\n******************* After stop: imageSeries.animating = false\r\n{code}", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-07T10:47:34.000+0000", "updated": "2012-06-07T10:47:58.000+0000" }, { "id": "197698", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR https://github.com/appcelerator/titanium_mobile/pull/2349", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-07T10:55:03.000+0000", "updated": "2012-06-07T10:55:03.000+0000" }, { "id": "200664", "author": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fix with \r\nTitanium Studio, build: 2.1.0.201206251749\r\nTitanium SDK: 2.1.0.v20120626204252\r\n\r\nLG VS910 4G\r\nAndroid version 2.3.6", "updateAuthor": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-27T14:16:06.000+0000", "updated": "2012-06-27T14:16:06.000+0000" }, { "id": "201540", "author": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Re-opening to edit the label.", "updateAuthor": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-05T03:39:33.000+0000", "updated": "2012-07-05T03:39:33.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }