Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11539] Android: Action bar logo changes when action item is expanded

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2012-10-30T22:51:51.000+0000
Affected Version/sRelease 3.0.0
Fix Version/s2012 Sprint 22 API, 2012 Sprint 22
ComponentsAndroid
Labelsapi, triage
ReporterArthur Evans
AssigneePing Wang
Created2012-10-19T02:27:00.000+0000
Updated2013-11-07T18:30:09.000+0000

Description

If the user specifies a custom applogo and creates an expandable action item, the logo changes when the item is expanded. Given an android manifest like this:
    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <tool-api-level>14</tool-api-level>
        <manifest android:installLocation="auto">
            <uses-sdk targetSdkVersion="14"/>
            <application android:logo="@drawable/applogo" android:theme="@android:style/Theme.Holo">
            </application>                
        </manifest>
    </android>
The applogo image must exist in platforms/android/res/drawable/applogo.png and/or the appropriate density-specific drawables- folders. The icon must be different from the default titanium app icon. An unmistakably ugly one is attached for your testing pleasure. Run the sample code below:
var win = Ti.UI.createWindow({fullscreen: false, backgroundColor: 'red'});

win.activity.onCreateOptionsMenu = function(e) {
  var item = e.menu.add({title: 'Expand'});
  item.showAsAction = Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW;

  var collapseActionButton = Ti.UI.createButton({
    title: 'Collapse'
  });
  collapseActionButton.addEventListener('click', function() {
    item.collapseActionView();
  });
  item.actionView = collapseActionButton;

  item.on('expand', function() {
    alert('Expanded menu item!');
  });
  item.on('collapse', function() {
    alert('Collapsed menu item!');
  });
  item.on('click', function() {
    alert('clicked!');
  });
}

win.open();
Note that when the action item is expanded, the custom applogo disappears, replaced by the standard app icon (the Up affordance is also displayed, which is correct).

Attachments

FileDateSize
applogo.png2012-10-19T02:38:15.000+00005574

Comments

  1. Arthur Evans 2012-10-29

    Might possibly be related.
  2. Arthur Evans 2012-10-29

    This may actually be the right behavior. From re-reading the Android docs, the "app logo" can be wider than the "app icon", so what may be happening here is that the app logo is being collapsed to the app icon when the action bar needs more space. I think someone who understands this code should take a look at this and the linked issue to make sure we're doing the correct thing.
  3. Ping Wang 2012-10-30

    Tested using a native Android project with action bar. It has the same behavior as described in the ticket. So this is a native Android behavior. Mark the ticket as invalid.
  4. Anshu Mittal 2013-05-10

    As per Arthur Evans and Ping Wang comments, the ticket seems to be invalid. So, closing the issue.

JSON Source