{ "id": "63811", "key": "TIMOB-3179", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": "11256", "description": "", "name": "Sprint-2011-08", "archived": true, "released": true, "releaseDate": "2011-02-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T02:01:07.000+0000", "created": "2011-04-15T03:38:53.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "feature", "release-1.7.0", "reported-1.5.1", "rplist" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T02:01:07.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}

Now that we expose Ti.Android.R we should allow\nresource ids instead of paths to the icon property of\ntabs.

\n

Excerpt from HD:

\n
\n

I've put a {root}/platform/android/res/drawable directory in\nplace.

\n

In there I've put in a state-list-drawable XML file for each of\nmy tabs following the naming convention \"ic_tab_tabName1.xml\"

\n

I've then put in corresponding\n{root}/platform/android/res/drawable-{ldpi/mdpi/hdpi} directories\nwith appropriately sized icons for both the selected and unselected\nstates.

\n

Then when I create the tab, my call looks something like\nthis:

\n
\n
\nvar tab1 = Titanium.UI.createTab({\n    icon:Titanium.Android.R.drawable.ic_tab_tabName1,\n    title:'Tab 1',\n    window:win1\n});\n \ntabGroup.add(tab1);\n
\n
\n

So, this doesn't work... At runtime I get an exception like\nthis:

\n
\n
\n[TRACE] E/TiUncaughtHandler( 429): java.lang.ClassCastException: org.appcelerator.titanium.proxy.RProxy\n[TRACE] E/TiUncaughtHandler( 429): at ti.modules.titanium.ui.TabGroupProxy.addTabToGroup(TabGroupProxy.java:163)\n
{html}", "attachment": [], "flagged": false, "summary": "Android: Tab icons should support resource ids", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "130234", "author": { "name": "jean-etiennelavallee", "key": "jean-etiennelavallee", "displayName": "Jean-Etienne LaVallee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Thanks for reporting this, Bill. I'm also wondering if there\nshould be an over-all assessment of the entire API to address all\nthe various properties where @drawable resources could/should be\nallowed as values (and correspondingly, properly resolved in the\nnative layer)?

\n

Also, I've noticed in an app I'm currently working on that if I\ndo use Ti.Android.R.xxx I receive an \"no such method for [undefined]\" javascript error in iOS\nEVEN IF I go through the trouble of using a\nTi.Platform.osname-based resolver (e.g. like the tt.os utility\nmethod in the Tweetanium app). This totally makes sense since the\nwhole Ti.Android.xxx namespace is unresolved in the iOS build\nconfiguration.

\n

BUT, this makes coding much more complicated because I have to\nrevert back to encapsulating such references in their own include\nfiles and then doing conditional-wrapped Ti.Platform.osname\nswitching. Is there any way we can make this more graceful w/r/t\nsupporting multi-target app development?

\n

Thanks,
\nEtienne

{html}", "updateAuthor": { "name": "jean-etiennelavallee", "key": "jean-etiennelavallee", "displayName": "Jean-Etienne LaVallee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:38:55.000+0000", "updated": "2011-04-15T03:38:55.000+0000" }, { "id": "130235", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

Yes, we're looking at it for the whole api.

\n

Re your other problem: be sure to put it in Helpdesk so our\nSupport guys can try to help you.

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:38:55.000+0000", "updated": "2011-04-15T03:38:55.000+0000" }, { "id": "130236", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

Test Case for QE:

\n\n
\nTitanium.UI.setBackgroundColor('#000');\nvar tabGroup = Titanium.UI.createTabGroup();\nvar win1 = Titanium.UI.createWindow({  \n    title:\"Tab 1 with icon\",\n    backgroundColor:'#fff'\n});\nvar tab1 = Titanium.UI.createTab({  \n    icon:Ti.App.Android.R.drawable.ic_tab1,\n    title:\"Tab 1 with icon\",\n    window:win1\n});\nwin1.add(Ti.UI.createLabel({text: 'Win1'}));\n\nvar win2 = Titanium.UI.createWindow({  \n    title:'Tab 2 no icon',\n    backgroundColor:'#fff'\n});\nvar tab2 = Titanium.UI.createTab({  \n    title:'Tab 2 no icon',\n    window:win2\n});\nwin2.add(Ti.UI.createLabel({text: 'Win2'}));\n\ntabGroup.addTab(tab1);  \ntabGroup.addTab(tab2);  \ntabGroup.open();\n
\n\n
\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:drawable=\"@drawable/selected\" android:state_pressed=\"false\" android:state_selected=\"true\"/>\n    <item android:drawable=\"@drawable/unselected\"/>\n</selector>\n
\n\n

In the \"old\" version (pre-commit), the app will crash\nimmediately. If you look at logcat you will see a\nClassCastException similar to:

\n
\nE/AndroidRuntime( 1434): java.lang.ClassCastException: java.lang.Integer\nE/AndroidRuntime( 1434):    at ti.modules.titanium.ui.TabGroupProxy.addTabToGroup(TabGroupProxy.java:163)\n
\n

With the post-commit version, you should see that the first tab\nhas a bird icon when selected, and a star icon when not selected\n(i.e., when the other tab is selected).

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:38:55.000+0000", "updated": "2011-04-15T03:38:55.000+0000" }, { "id": "130237", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

removed tbs-1.7.0 added release-1.7.0

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:38:56.000+0000", "updated": "2011-04-15T03:38:56.000+0000" }, { "id": "130238", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

don't know why this didn't get updated with my commits. Here\nthey are:

\n

\nhttps://github.com/appcelerator/titanium_mobile/commit/dddf612e4919...

\n

\nhttps://github.com/appcelerator/titanium_mobile/commit/979a1c50a695...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:38:56.000+0000", "updated": "2011-04-15T03:38:56.000+0000" }, { "id": "130239", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tested with Titanium SDK version: 1.7.0 (03/01/11 16:09\ne613126)
\nGalaxyTab 2.2
\nEmulator 2.1

{html}", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:38:56.000+0000", "updated": "2011-04-15T03:38:56.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }