Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-26274] Android: Do not set action bar home icon #10243

Merged
merged 1 commit into from Aug 9, 2018

Conversation

garymathews
Copy link
Contributor

  • Do not enable the action bar home icon, this should be done in Javascript
win.addEventListener('open', function(){
    var activity = win.getActivity(),
        actionBar = activity.getActionBar();

    if (actionBar) {
        actionBar.displayHomeAsUp = true;
        actionBar.onHomeIconItemSelected = function() {
            drawer.toggleLeft();
        };
    }
});
TEST CASE
var window = Ti.UI.createWindow({ backgroundColor: 'white', theme: 'Theme.AppCompat.NoTitleBar', exitOnClose: false });

var btn = Ti.UI.createButton({
	title: 'Trigger'
});

btn.addEventListener('click', function() {
	var window2 = Ti.UI.createWindow({  title: 'Test' });
	var left = Ti.UI.createView({ backgroundColor: 'red' });
	var center = Ti.UI.createView({ backgroundColor: 'blue' });

	var button2 = Ti.UI.createButton({ title: 'Close'});
	left.add(button2);

	button2.addEventListener('click', function () {
		drawer.closeLeft();
		window.open();
		window2.close();
	})

	var drawer = Ti.UI.Android.createDrawerLayout({
		centerView: center,
		leftView: left
	});

        // hamburger menu should only show when this is uncommented
	/*window2.addEventListener('open', function(){
        var activity = window2.getActivity(),
            actionBar = activity.getActionBar();

        if (actionBar) {
            actionBar.displayHomeAsUp = false;
            actionBar.onHomeIconItemSelected = function() {
                drawer.toggleLeft();
            };
        }
    });*/

	window2.add(drawer);
	window2.open();
	window.close();
});

window.add(Ti.UI.createTableView({
	data: [{
		title: 'Test'
	}],
	footerView: btn
}));

window.open();

JIRA Ticket

@build
Copy link
Contributor

build commented Aug 9, 2018

Messages
📖

👍 Hey!, You deleted more code than you added. That's awesome!

📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

@hansemannn
Copy link
Collaborator

Should we do this for 8.0.0? Looks like a behavior change.

@garymathews
Copy link
Contributor Author

garymathews commented Aug 9, 2018

@hansemannn It's actually a bug, we shouldn't be displaying the hamburger menu (by default) when no action/listener has been set

@garymathews garymathews added this to the 7.4.0 milestone Aug 9, 2018
@hansemannn
Copy link
Collaborator

I agree, but personally, I'd rather prefer it in 8 to prevent these "it used to show up before so why does it not now" tickets. But I am fine if you are.

@garymathews
Copy link
Contributor Author

We already document how to use it correctly. I'm sure we would have had "why does it show but disappear when I click it" tickets already. This is the only scenario this PR is affecting. So I'm happy with it to go into 7.4.0.

@hansemannn hansemannn merged commit 7a7b1b1 into tidev:master Aug 9, 2018
@jquick-axway jquick-axway modified the milestones: 7.4.0, 7.5.0 Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants