fix title align issues on android

This commit is contained in:
Nick Wientge 2015-01-17 17:12:56 -08:00
parent 7095005b91
commit 6985ddbb7f
2 changed files with 11 additions and 2 deletions

View file

@ -3,7 +3,7 @@ IonHeaderBar = {
var align = this.alignTitle || 'center';
var $title = this.$('.title');
if (align === 'center' && Platform.isAndroid()) {
if (Platform.isAndroid() && !this.alignTitle) {
$title.addClass('title-left');
return;
}
@ -33,7 +33,13 @@ IonHeaderBar = {
rightButtonWidth = $rightButton.outerWidth();
}
var margin = Math.max(leftButtonWidth, rightButtonWidth);
// If we're on Android, we only care about the left button
var margin;
if (Platform.isAndroid()) {
margin = leftButtonWidth;
} else {
margin = Math.max(leftButtonWidth, rightButtonWidth);
}
$title.css('left', margin);
$title.css('right', margin);
}

View file

@ -30,6 +30,9 @@ Template.ionNavBar.rendered = function () {
if (!$node.hasClass('title') && !$node.hasClass('button') || IonNavigation.skipTransitions) {
$node.insertBefore(next);
// Changing tabs skips transition animations, but we still want to update the position of the title
IonHeaderBar.alignTitle.call(template);
IonHeaderBar.positionTitle.call(template);
return;
}