{ "id": "170482", "key": "AC-5413", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2017-12-27T22:10:56.000+0000", "created": "2017-11-28T22:03:31.000+0000", "labels": [], "versions": [], "issuelinks": [ { "id": "56193", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "170504", "key": "TIMOB-25572", "fields": { "summary": "Android: Provide Toolbar customization through DrawerLayout", "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" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2018-01-12T08:46:36.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Ti.UI.Android.createDrawerLayout SDK 6.3.0.GA\r\n\r\nThere is no way to set the color of the title on AppBar via theme XML file.\r\nDefaults to black, in this case I want the title on white.\r\n\r\nThe only way (not ideal because editing the SDK file) I've found so far is editing the file https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/res/layout/titanium_ui_drawer_layout.xml\r\nand add android:theme=\"@style/ThemeOverlay.AppCompat.Dark.ActionBar\" to android.support.v7.widget.Toolbar\r\n\r\nSample Alloy project:\r\n\r\n*inde.js*\r\nvar win = Ti.UI.createWindow({\r\n\ttheme: \"Theme.AudioVerse.NoActionBar\"\r\n});\r\n\r\nvar leftView = Ti.UI.createView({ backgroundColor:'white' });\r\nvar centerView = Ti.UI.createView({ backgroundColor:'white' });\r\n\r\nvar drawer = Ti.UI.Android.createDrawerLayout({\r\n leftView: leftView,\r\n centerView: centerView\r\n});\r\n\r\nwin.add(drawer);\r\nwin.open();\r\n\r\n\r\n*themes.xml on app/platform/android/res/values*\r\n\r\n\r\n\r\n\r\n \r\n\r\n \r\n\r\n\r\n\r\n", "attachment": [ { "id": "63704", "filename": "Screen Shot 2017-11-28 at 4.54.05 PM.png", "author": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-28T21:55:40.000+0000", "size": 9831, "mimeType": "image/png" }, { "id": "63703", "filename": "Screen Shot 2017-11-28 at 5.00.52 PM.png", "author": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-28T22:01:11.000+0000", "size": 9928, "mimeType": "image/png" } ], "flagged": false, "summary": "Ti.UI.Android.createDrawerLayout there is no way to set the color of the title on AppBar via theme", "creator": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "431426", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~horozco], \r\nThanks for sharing with us. Please provide a full sample test project that regenerates the issue. We will test the issue in our environment. Also, provide the SDK and CLI version you are testing on. Thanks.\r\n\r\nBest", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-11-29T05:01:03.000+0000", "updated": "2017-11-29T05:01:03.000+0000" }, { "id": "431448", "author": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Mostafizur!\r\n\r\nI've updated the description to include the full sample code that regenerates the issue. Thanks!\r\n\r\nKind regards.", "updateAuthor": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-29T14:31:51.000+0000", "updated": "2017-11-29T14:33:47.000+0000" }, { "id": "432568", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "The issue is resolved in SDK 7.0.1.GA.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-12-27T22:10:19.000+0000", "updated": "2017-12-27T22:10:19.000+0000" }, { "id": "432970", "author": { "name": "gfigueras", "key": "gfigueras", "displayName": "Guillermo Figueras", "active": true, "timeZone": "Europe/Madrid" }, "body": "When using a Toolbar as an Actionbar, how do I add the left icon which used to show the left drawer menu? I mean, the icon that's in the blue rectangle: http://belencruz.com/wp-content/uploads/2015/04/android_actionbar_default-1024x253.png\r\n\r\nI have this on my alloy file:\r\n{code:xml}\r\n\t\r\n\t\r\n\t\t\r\n\t\r\n\t\t\t\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t \r\n\t\r\n\r\n{code}\r\n\r\nAnd I have this on my controller:\r\n{code:javascript}\r\nvar actionBar = $.actionBar;\r\n\r\nif (actionBar) \r\n{\r\n actionBar.displayHomeAsUp = true;\r\n actionBar.onHomeIconItemSelected = function() {\r\n $.drawerLayout.toggleLeft();\r\n };\r\n}\r\n{code}", "updateAuthor": { "name": "gfigueras", "key": "gfigueras", "displayName": "Guillermo Figueras", "active": true, "timeZone": "Europe/Madrid" }, "created": "2018-01-10T12:39:41.000+0000", "updated": "2018-01-10T12:39:41.000+0000" }, { "id": "432972", "author": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hey Guillermo,\r\n\r\nCheck this out:\r\nAdd a custom toolbar and use the navigationIcon property - http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Toolbar\r\nSample: https://github.com/appcelerator/titanium_mobile/pull/9646\r\n\r\nHope that helps :)", "updateAuthor": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-10T14:25:24.000+0000", "updated": "2018-01-10T14:25:24.000+0000" }, { "id": "433013", "author": { "name": "gfigueras", "key": "gfigueras", "displayName": "Guillermo Figueras", "active": true, "timeZone": "Europe/Madrid" }, "body": "@Henry Orozco thank you!", "updateAuthor": { "name": "gfigueras", "key": "gfigueras", "displayName": "Guillermo Figueras", "active": true, "timeZone": "Europe/Madrid" }, "created": "2018-01-11T08:09:37.000+0000", "updated": "2018-01-11T08:09:37.000+0000" }, { "id": "433019", "author": { "name": "gfigueras", "key": "gfigueras", "displayName": "Guillermo Figueras", "active": true, "timeZone": "Europe/Madrid" }, "body": "Well, now I'm not sure on how to show the drawer menu when clicking on the navigationIcon. How do I add the click listener to it?", "updateAuthor": { "name": "gfigueras", "key": "gfigueras", "displayName": "Guillermo Figueras", "active": true, "timeZone": "Europe/Madrid" }, "created": "2018-01-11T09:06:39.000+0000", "updated": "2018-01-11T09:06:39.000+0000" }, { "id": "433030", "author": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Guillermo\r\n\r\n{code:javascript}\r\n var activity = $.myWindow.getActivity();\r\n\t\r\n\t if (activity) {\r\n\t\r\n\t var actionBar = activity.getActionBar();\r\n\t\r\n\t if (actionBar) {\r\n\t actionBar.displayHomeAsUp = true;\r\n\t actionBar.onHomeIconItemSelected = function() {\r\n\t $.drawerLayout.toggleLeft();\r\n\t };\r\n\t }\r\n\t }\r\n{code}\r\n", "updateAuthor": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-11T13:53:12.000+0000", "updated": "2018-01-11T14:18:44.000+0000" }, { "id": "433031", "author": { "name": "gfigueras", "key": "gfigueras", "displayName": "Guillermo Figueras", "active": true, "timeZone": "Europe/Madrid" }, "body": "I'm getting this error when using your code:\r\n\r\n{code}\r\n[ERROR] : TiExceptionHandler: (main) [1782,3374] ----- Titanium Javascript Runtime Error -----\r\n[ERROR] : TiExceptionHandler: (main) [0,3374] - In undefined:240,42\r\n[ERROR] : TiExceptionHandler: (main) [0,3374] - Message: Uncaught TypeError: Cannot read property 'getActivity' of undefined\r\n[ERROR] : TiExceptionHandler: (main) [0,3374] - Source: var activity = $.drawerLayout.window.getActivity();\r\n[ERROR] : V8Exception: Exception occurred at undefined:240: Uncaught TypeError: Cannot read property 'getActivity' of undefined\r\n{code}", "updateAuthor": { "name": "gfigueras", "key": "gfigueras", "displayName": "Guillermo Figueras", "active": true, "timeZone": "Europe/Madrid" }, "created": "2018-01-11T14:00:15.000+0000", "updated": "2018-01-11T14:00:15.000+0000" }, { "id": "433032", "author": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Guillermo, replace $.drawerLayout.window for the id of the window that is wrapping your DrawerLayout. e.g var activity = $.myWindow.getActivity();", "updateAuthor": { "name": "horozco", "key": "horozco", "displayName": "Henry Orozco", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-11T14:17:51.000+0000", "updated": "2018-01-11T14:19:32.000+0000" }, { "id": "433064", "author": { "name": "gfigueras", "key": "gfigueras", "displayName": "Guillermo Figueras", "active": true, "timeZone": "Europe/Madrid" }, "body": "I tried that but nothing happens. I also tried this but it doesn't work:\r\n\r\n{code:javascript}\r\n$.toolbarId.onHomeIconItemSelected = function() {\r\n\t$.drawerLayout.toggleLeft();\r\n};\r\n{code}", "updateAuthor": { "name": "gfigueras", "key": "gfigueras", "displayName": "Guillermo Figueras", "active": true, "timeZone": "Europe/Madrid" }, "created": "2018-01-12T08:46:36.000+0000", "updated": "2018-01-12T08:46:36.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }