Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18872] Actionbar 'icon' property is broken with latest 4.0.0 SDK

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-08-09T18:17:45.000+0000
Affected Version/sRelease 4.0.0
Fix Version/sRelease 6.2.0
ComponentsAndroid
Labelsqe-4.0.0, regression
ReporterLokesh Choudhary
AssigneeYordan Banev
Created2015-05-07T00:52:04.000+0000
Updated2017-08-17T01:08:56.000+0000

Description

This is a regression. Works fine with 3.5.1.GA SDK.

Steps to Reproduce:

1. Create an app for android for actionbar.
var win = Ti.UI.createWindow({
    navBarHidden: false
});
var actionBar;

win.addEventListener("open", function() {
    if (Ti.Platform.osname === "android") {
        if (! win.activity) {
            Ti.API.error("Can't access action bar on a lightweight window.");
        } else {
            actionBar = win.activity.actionBar;
            if (actionBar) {
                actionBar.icon = "/icon.png"; 
                actionBar.title = "New Title";
                actionBar.onHomeIconItemSelected = function() {
                    Ti.API.info("Home icon clicked!");
                };
            }
        }
    }
});

win.open();
2. Build for android device/emulator with latest 4.0.0 SDK.

Actual Result:

1. The actionbar icon is not shown. 2. When built with SDK 3.5.1.GA the actionbar icon is shown as expected.

Expected Result:

1. The actionbar icon should be seen with latest 4.0.0 SDK.

Comments

  1. Hieu Pham 2015-05-07

    This is a behavior change after our AppCompat update: "In modern Android UIs developers should lean more on a visually distinct color scheme for toolbars than on their application icon. The use of application icon plus title as a standard layout is discouraged on API 21 devices and newer"
  2. Lokesh Choudhary 2015-05-13

    Closing as this is a behaviour change according to [~hpham].
  3. Neville Dastur 2015-05-27

    Please can we look at re-opening this. Although the guidelines suggest not using the app icon, the use of a menu icon (3 lines) for slide menu is still very much in use. See gmail app for example. As far as I can see this is the only way to achieve this
  4. Thomas Neerup 2015-05-27

    You have my vote on this one...
  5. Manuel Lehner 2015-09-09

    It should be possible to use a logo instead of a title. This is indeed a behaviour change and as stated in the docs Google does not recommend using both logo and title. But as it is possible to fix this, this issue should be re-opened.
  6. Far 2016-01-14

    It's strange decision to ignore very popular case of using icon as menu. For now there is no way to do it with standard Ti API. Please add setHomeAsUpIndicator() method to ActionBar at least. Workaround that can be helpful to someone: 1. actionBar.displayHomeAsUp = true; 2. actionbarextras.setHomeAsUpIcon(icon) from https://github.com/ricardoalcocer/actionbarextras
  7. Yordan Banev 2017-07-12

    Android Support Library v23 added a way for fixing this. PR: https://github.com/appcelerator/titanium_mobile/pull/9218
  8. Yordan Banev 2017-08-09

    6_2_X: https://github.com/appcelerator/titanium_mobile/pull/9291
  9. Lokesh Choudhary 2017-08-09

    FR Passed for backport PR. PR merged.
  10. Lokesh Choudhary 2017-08-17

    Verified the fix with 7.0.0.v20170816113226 & 6.2.0.v20170816173122. Closing. Studio Ver: 4.9.1.201707200100 SDK Ver: 6.2.0.v20170816173122, 7.0.0.v20170816113226 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.2.3 Ti CLI Ver: 5.0.14 Alloy Ver: 1.9.13 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Pixel --- Android 7.1.1 ⇨ google Nexus 5 --- Android 6.0.1 Emulator: Android 4.4.4

JSON Source