Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16212] Android: ActionBar expose setDisplayShowHomeEnabled and setDisplayShowTitleEnabled

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-04-25T07:18:10.000+0000
Affected Version/sRelease 3.1.3, Release 3.2.0
Fix Version/s2014 Sprint 08, 2014 Sprint 08 SDK, Release 3.3.0
ComponentsAndroid
Labelsactionbar, module_actionbar, qe-closed-3.3.0, qe-testadded, supportTeam
ReporterMarco Cota
AssigneeHieu Pham
Created2014-01-16T22:27:55.000+0000
Updated2014-04-27T01:22:35.000+0000

Description

Request

Expose the setDisplayShowHomeEnabled and setDisplayShowTitleEnabled methods from the Android actionBar in order to allow the user to disable the action bar icon and title in order to let the navigation tabs to collapse into the main actionBar when user is using a split actionBar and TabGroup(as shown on the right in actionbar.png).

Current Behavior

Even whene user is able to split the actionBar the TitleBar will remain always on top of the tabs when using the tabgroup even when there no title or icon(splitActionBar.png).

Reference

http://developer.android.com/guide/topics/ui/actionbar.html

Attachments

FileDateSize
actionbar.png2014-01-16T22:27:55.000+000068147
splitActionBar.png2014-01-16T22:27:55.000+0000145878

Comments

  1. Hieu Pham 2014-04-22

    Test Code:
       var win = Ti.UI.createWindow({
           title : "Actionbar Title",
           navBarHidden : false,
           layout : 'vertical'
       });
       
       var b3 = Ti.UI.createButton({
           title : "Toggle setDisplayShowHomeEnabled"
       });
       
       var b4 = Ti.UI.createButton({
           title : "Toggle setDisplayShowTitleEnabled"
       });
        
       var actionBar;
       
       win.add(b3);
       win.add(b4);
        
       var home = false;
       var title = false;
       b3.addEventListener("click", function() {
           if (actionBar) {
           	if (home) {
               	actionBar.setDisplayShowHomeEnabled(home);
               	home = false;
               } else {
                	actionBar.setDisplayShowHomeEnabled(home);
               	home = true;
               }
        
           } else {
               Ti.API.warn("Action bar not available.");
           }
       });
       b4.addEventListener("click", function() {
           if (actionBar) {
               if (title) {
               	actionBar.setDisplayShowTitleEnabled(title);
               	title = false;
               } else {
               	actionBar.setDisplayShowTitleEnabled(title);
               	title = true;
               }
        
           } else {
               Ti.API.warn("Action bar not available.");
           }
       });
       
       
       win.addEventListener("open", function() {
           if (Ti.Platform.osname === "android") {
               if (! win.activity) {
                   Ti.API.error("Can't access action bar on a lightweight window.");
               }
               actionBar = win.activity.actionBar;
           }
       });
        
       win.open();
       
  2. Hieu Pham 2014-04-22

    master PR: https://github.com/appcelerator/titanium_mobile/pull/5640
  3. Vishal Duggal 2014-04-23

    PR merged
  4. Paras Mishra 2014-04-25

    Verified as fixed, hence closing the issue Verified on: Device : Google Nexus 4, Android Version: 4.1.1 SDK: 3.3.0.v20140423155715 CLI version : 3.3.0-dev OS : MAC OSX 10.9.2 Alloy: 1.4.0-dev ACS: 1.0.14 npm:1.3.2 Appcelerator Studio, build: 3.3.0.201404211130 titanium-code-processor: 1.1.1-alpha XCode : 5.1.1
  5. Paras Mishra 2014-04-25

    reopening to edit the comment
  6. Mark Mokryn 2014-04-27

JSON Source