{ "id": "116366", "key": "ALOY-719", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "15758", "description": "Alloy 1.4.0", "name": "Alloy 1.4.0", "archived": false, "released": true, "releaseDate": "2014-07-17" } ], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2014-05-13T20:17:01.000+0000", "created": "2013-06-23T09:17:32.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "alloy", "android" ], "versions": [], "issuelinks": [], "assignee": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-05-13T23:33:40.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": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" }, { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "For Android, there is often conditional UI code based on the presence/absence of Action Bar capabilities. I find myself doing this manually on very single window, and it's a chore (e.g. configure the action bar in my controller code, or set up an action bar lookalike for API <= 10).... It would be great to add to the \"platform=...\" flags something along the line of \"android-api-lte10\" and \"android-api-gt10\" for views and styles.\r\nEdit: the Android API level is determined at runtime, and the platform view/style attribute is used at build. So to generalize this request - what we really need is a runtime view/style conditional attribute, e.g. \"condition = someVariable\", where someVariable would be set at controller init, e.g. in my case it would be someVariable = Ti.Platform.Android.API_LEVEL <= 10 for a pre-Action Bar window header.", "attachment": [], "flagged": false, "summary": "Alloy Android feature request: view/style API level conditional code", "creator": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "subtasks": [], "reporter": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "environment": "SDK 3.1.1.GA", "comment": { "comments": [ { "id": "259154", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~mokesmokes] can you please include a proposed use case with code? I'd like to see the XML/JS you'd like this feature to encompass.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-06-24T13:14:54.000+0000", "updated": "2013-06-24T13:14:54.000+0000" }, { "id": "259164", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "XML:\r\n{code}\r\n\r\n \r\n \r\n....\r\n{code}\r\n\r\ncontroller code:\r\n{code}\r\nif (OS_ANDROID) {\r\n var preHoneycomb = Ti.Platform.Android.API_LEVEL < 11;\r\n}\r\n{code}\r\n\r\nI'm wondering if we need it in style files as well, in similar fashion. Not sure if it's a must, but perhaps it should be mirrored there, as done today for \"platform\".\r\nThe use case I have today is indeed for Android Action Bars, where I like to have them where possible, and provide a view look-alike on 2.x. However, since this is done at runtime, why not just make it a generic conditional? Could be useful in many other cases as well.", "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2013-06-24T15:20:11.000+0000", "updated": "2013-06-24T15:20:11.000+0000" }, { "id": "259229", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "Just a couple more thoughts.... the example above is a simple case where the condition is static, and can be evaluated at controller initialization. Another class of conditions (unrelated to this specific case) would be binding the creation/destruction of views to models.", "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2013-06-24T19:31:20.000+0000", "updated": "2013-06-24T19:31:20.000+0000" }, { "id": "304660", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "[~mokesmokes] I think your request is at least partially resolved by ALOY-871. With that change, you can use the custom conditionals (with conditions defined in alloy.js as properties of Alloy.Globals) to accomplish the XML example you gave above. Those globals would also accomplish the controller code you show, though because those are evaluated at run time, non-matching branches can't be optimized out like the compile-time OS_* globals. Finally, Titanium 3.3 will include the AppCompat library to support the ActionBar on pre-ICS devices.\r\n\r\nIs there more to your request or could this be considered resolved by the other ticket and closed?", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-05-13T20:00:56.000+0000", "updated": "2014-05-13T20:00:56.000+0000" }, { "id": "304662", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "Awesome - yes, you can close this ticket. Thanks.", "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2014-05-13T20:08:48.000+0000", "updated": "2014-05-13T20:08:48.000+0000" }, { "id": "304664", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Resolved by ALOY-871 so closing this as a duplicate (yeah, this one came in first ...) ", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-05-13T20:17:01.000+0000", "updated": "2014-05-13T20:17:01.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }