if (selectedTab == null
&& selectionChangeTransition == null) {
preferredWidth = getPreferredTabWidth(-1) + (padding.left + padding.right + 2);
preferredHeight = 1;
} else {
Dimensions preferredTabSize = getPreferredTabSize();
preferredWidth = preferredTabSize.width + (padding.left + padding.right + 2);
preferredHeight = preferredTabSize.height + (padding.top + padding.bottom);
if (selectionChangeTransition != null) {
float scale = selectionChangeTransition.getScale();
preferredHeight = (int)(preferredHeight * scale);
}
preferredHeight += 2;
}
int buttonAreaPreferredWidth = tabButtonPanorama.getPreferredWidth(-1);
if (corner != null) {
buttonAreaPreferredWidth += corner.getPreferredWidth(-1);
preferredHeight += Math.max(corner.getPreferredHeight(-1),
Math.max(tabButtonPanorama.getPreferredHeight(-1) - 1, 0));
buttonAreaPreferredWidth += 2; // space between corner and panorama
} else {
preferredHeight += Math.max(tabButtonPanorama.getPreferredHeight(-1) - 1, 0);
}
preferredWidth = Math.max(preferredWidth, buttonAreaPreferredWidth);
break;
}
case VERTICAL: {
if (selectedTab == null
&& selectionChangeTransition == null) {
preferredWidth = 1;
preferredHeight = getPreferredTabHeight(-1) + (padding.top + padding.bottom + 2);
} else {
Dimensions preferredTabSize = getPreferredTabSize();
preferredWidth = preferredTabSize.width + (padding.left + padding.right);
preferredHeight = preferredTabSize.height + (padding.top + padding.bottom + 2);
if (selectionChangeTransition != null) {
float scale = selectionChangeTransition.getScale();
preferredWidth = (int)(preferredWidth * scale);
}
preferredWidth += 2;
}
int buttonAreaPreferredHeight = tabButtonPanorama.getPreferredHeight(-1);
if (corner != null) {
buttonAreaPreferredHeight += corner.getPreferredHeight(-1);
preferredWidth += Math.max(corner.getPreferredWidth(-1),
Math.max(tabButtonPanorama.getPreferredWidth(-1) - 1, 0));
buttonAreaPreferredHeight += 2; // space between corner and panorama
} else {
preferredWidth += Math.max(tabButtonPanorama.getPreferredWidth(-1) - 1, 0);
}
preferredHeight = Math.max(preferredHeight, buttonAreaPreferredHeight);
break;
}
default: {
preferredWidth = 0;
preferredHeight = 0;
}
}
return new Dimensions(preferredWidth, preferredHeight);
}