{ "id": "63483", "key": "TIMOB-2851", "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": "12077", "description": "", "name": "Sprint 2011-37", "archived": true, "released": true, "releaseDate": "2011-09-19" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-09-28T13:59:28.000+0000", "created": "2011-04-15T03:31:10.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "stage" ], "versions": [ { "id": "11260", "description": "", "name": "Release 1.6.2", "archived": true, "released": true, "releaseDate": "2011-04-20" } ], "issuelinks": [], "assignee": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-11-01T00:09:37.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": "{html}
The specific problem relates to an issue where Android will not\r\ndisplay a view instantiated at 0.0 opacity. In addition, animation\r\nworks strangely even when instantiating at > 0.0 opacity.
\r\nSidebar: An additional expectation may lie in the necessity to\r\nset the view's opacity after the animation completes. Should the\r\nproperty be set by the completion of the animation, or leave this\r\nto the developer?
\r\nPlease note that the Android example uses a workaround for\r\nissue: \r\nhttps://appcelerator.lighthouseapp.com/projects/32238/tickets/2776-android-animation-callback-is-called-multiple-times
\r\nComparison between iOS and Android @ 1.6.0 (HTC Evo 2.2)
\r\n\r\n// iOS / Ti 1.6.0:\r\n// Red box displays at 0.0 opacity. Use toggle button to fade in and fade out view.\r\n\r\nvar win = Ti.UI.createWindow({ backgroundColor:'#000' });\r\nvar view = Ti.UI.createView({ backgroundColor:'#f00', opacity:0.0, width:100, height:100 });\r\nvar toggleBtn = Ti.UI.createButton({ width:200, height:30, bottom:10, title:'toggle opacity' });\r\n\r\nfunction toggleOpacity(e) {\r\n view.animate({ opacity:(view.opacity === 0.0) ? 1.0 : 0.0, duration:1000 }, function(e) {\r\n view.opacity = (view.opacity === 0.0) ? 1.0 : 0.0;\r\n Ti.API.info(view.opacity);\r\n });\r\n}\r\n\r\ntoggleBtn.addEventListener('click', toggleOpacity);\r\n\r\nwin.add(view);\r\nwin.add(toggleBtn);\r\nwin.open();
\r\n
\r\n\r\n// iOS / Ti 1.6.0:\r\n// Red box displays at 1.0 opacity. Use toggle button to fade out and fade in view.\r\n\r\nvar win = Ti.UI.createWindow({ backgroundColor:'#000' });\r\nvar view = Ti.UI.createView({ backgroundColor:'#f00', opacity:1.0, width:100, height:100 });\r\nvar toggleBtn = Ti.UI.createButton({ width:200, height:30, bottom:10, title:'toggle opacity' });\r\n\r\nfunction toggleOpacity(e) {\r\n view.animate({ opacity:(view.opacity === 0.0) ? 1.0 : 0.0, duration:1000 }, function(e) {\r\n view.opacity = (view.opacity === 0.0) ? 1.0 : 0.0;\r\n Ti.API.info(view.opacity);\r\n });\r\n}\r\n\r\ntoggleBtn.addEventListener('click', toggleOpacity);\r\n\r\nwin.add(view);\r\nwin.add(toggleBtn);\r\nwin.open();
\r\n
\r\n\r\n// Android 2.2 HTC Evo / Ti 1.6.0\r\n// Red box displays at 1.0 opacity. Toggle button will successfully fade.\r\n// After fade, toggle button will not work until the second press. Fade back in.\r\n// Next press will fade out to 0.0. Rinse, repeat. :-)\r\n\r\nvar win = Ti.UI.createWindow({ backgroundColor:'#000' });\r\nvar view = Ti.UI.createView({ backgroundColor:'#f00', opacity:1.0, width:100, height:100 });\r\nvar toggleBtn = Ti.UI.createButton({ width:200, height:30, bottom:10, title:'toggle opacity' });\r\n\r\nfunction toggleOpacity(e) {\r\n var counter = 0;\r\n \r\n view.animate({ opacity:(view.opacity === 0.0) ? 1.0 : 0.0, duration:1000 }, function(e) {\r\n if (counter === 0) {\r\n Ti.API.info('This is only called once due to the counter.');\r\n \r\n view.opacity = (view.opacity === 0.0) ? 1.0 : 0.0;\r\n \r\n Ti.API.info(view.opacity);\r\n \r\n counter ++;\r\n }\r\n });\r\n}\r\n\r\ntoggleBtn.addEventListener('click', toggleOpacity);\r\n\r\nwin.add(view);\r\nwin.add(toggleBtn);\r\nwin.open();
\r\n