{ "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.
Excerpt from HD:
\n\n\nI've put a {root}/platform/android/res/drawable directory in\nplace.
\nIn there I've put in a state-list-drawable XML file for each of\nmy tabs following the naming convention \"ic_tab_tabName1.xml\"
\nI'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.
\nThen when I create the tab, my call looks something like\nthis:
\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\nSo, this doesn't work... At runtime I get an exception like\nthis:
\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
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)?
\nAlso, 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.
\nBUT, 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?
\nThanks,
\nEtienne
Yes, we're looking at it for the whole api.
\nRe your other problem: be sure to put it in Helpdesk so our\nSupport guys can try to help you.
Test Case for QE:
\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
\nFrom the project's root folder, create the folder\nplatform/android/res/drawable
.
Plop the two .pngs here -- selected.png & unselected.png --\ninto the platform/android/res/drawable
folder.
Save the following xml as\nplatform/android/res/drawable/ic_tab1.xml
:
\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
\nIn the \"old\" version (pre-commit), the app will crash\nimmediately. If you look at logcat you will see a\nClassCastException
similar to:
\nE/AndroidRuntime( 1434): java.lang.ClassCastException: java.lang.Integer\nE/AndroidRuntime( 1434): at ti.modules.titanium.ui.TabGroupProxy.addTabToGroup(TabGroupProxy.java:163)
\n
\nWith 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).
removed tbs-1.7.0 added release-1.7.0
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...
Tested with Titanium SDK version: 1.7.0 (03/01/11 16:09\ne613126)
\nGalaxyTab 2.2
\nEmulator 2.1