[TIMOB-16888] Android: Add Actionbar.setHomeButtonEnabled functionality
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2014-05-21T20:04:12.000+0000 |
| Affected Version/s | Release 3.2.2 |
| Fix Version/s | 2014 Sprint 10, 2014 Sprint 10 SDK, Release 3.3.0, Release 3.4.0 |
| Components | Android |
| Labels | module_actionbar, qe-testadded |
| Reporter | Mark Mokryn |
| Assignee | Ingo Muschenetz |
| Created | 2014-04-26T18:18:56.000+0000 |
| Updated | 2014-05-23T23:21:26.000+0000 |
Description
The home button is automatically enabled when the DISPLAY_HOME_AS_UP is enabled (natively by Android). However, the home button cannot be disabled later unless this method is exposed - thus its necessity.
Pull request adding this functionality: https://github.com/appcelerator/titanium_mobile/pull/5649 Test app:
var win = Ti.UI.createWindow({}); var actionBar, homeButtonEnabled = true;; var btn = Ti.UI.createButton({ title: 'Toggle homeButtonEnabled', width: "90%", height: "50dp" }); btn.addEventListener('click', function() { homeButtonEnabled = !homeButtonEnabled; actionBar.setHomeButtonEnabled(homeButtonEnabled); }); win.add(btn); win.addEventListener("open", function() { if (Ti.Platform.osname === "android") { actionBar = win.activity.actionBar; if (actionBar) { actionBar.title = "New Title"; actionBar.onHomeIconItemSelected = function() { alert("Home icon clicked!"); }; } } }); win.open();Moving this feature request to engineering for further evaluation and prioritization. Note that TIMOB-16212 is similar but not same.
Guys, this is a very small PR and can be easily reviewed, exposes yet more ActionBar functionality, and I can assure you it is working in my app in production. Please review and accept. Thanks.
PR's merged master - https://github.com/appcelerator/titanium_mobile/pull/5716 3_3_X - https://github.com/appcelerator/titanium_mobile/pull/5717
Verified , the Actionbar.setHomeButtonEnabled functionality works as expected. Closing. Environment: Appc Studio : 3.3.0.201405211748 Ti SDK : 3.3.0.v20140523143057 Mac OSX : 10.8.5 Alloy : 1.4.0-alpha4 CLI - 3.3.0-alpha5 Code Processor: 1.1.1 Samsung Galaxy S4 running android 4.2.2 Sony Xperia - android 2.3.7