MenuItemLayoutHelper.java revision 1637
0N/Apublic class MenuItemLayoutHelper {
private boolean isColumnLayout;
private boolean useCheckAndArrow;
private boolean isLeftToRight;
private boolean isTopLevelMenu;
private int verticalAlignment;
private int horizontalAlignment;
private int verticalTextPosition;
private int horizontalTextPosition;
private int gap;
private int leadingGap;
private int afterCheckIconGap;
private int minTextOffset;
private int leftTextExtraWidth;
protected MenuItemLayoutHelper() {
private void calcExtraWidths() {
return -lsb;
private void setOriginalWidths() {
return accText;
return icon;
return minimumTextOffset;
return afterCheckIconGap;
return checkIconOffset;
protected void calcWidthsAndHeights() {
if (useCheckAndArrow) {
if (isColumnLayout) {
protected void calcMaxWidths() {
if (isColumnLayout) {
return value;
return maxValue;
int horizontalAlignment,
int verticalTextPosition) {
if (isLeftToRight) {
if (isColumnLayout()) {
if (isLeftToRight()) {
if (isLeftToRight()) {
return lr;
return new LayoutResult(
if (useCheckAndArrow) {
if (r.y < viewRect.y) {
return null;
if (c != null) {
for (int i : values) {
if (i > maxValue) {
maxValue = i;
return maxValue;
return mi;
return miParent;
return font;
return accFont;
return fm;
return accFm;
return icon;
return checkIcon;
return arrowIcon;
return text;
return accText;
public boolean isColumnLayout() {
return isColumnLayout;
public boolean useCheckAndArrow() {
return useCheckAndArrow;
public boolean isLeftToRight() {
return isLeftToRight;
public boolean isTopLevelMenu() {
return isTopLevelMenu;
return htmlView;
public int getVerticalAlignment() {
return verticalAlignment;
public int getHorizontalAlignment() {
return horizontalAlignment;
public int getVerticalTextPosition() {
return verticalTextPosition;
public int getHorizontalTextPosition() {
return horizontalTextPosition;
public int getGap() {
return gap;
public int getLeadingGap() {
return leadingGap;
public int getAfterCheckIconGap() {
return afterCheckIconGap;
public int getMinTextOffset() {
return minTextOffset;
return viewRect;
return iconSize;
return textSize;
return accSize;
return checkSize;
return arrowSize;
return labelSize;
public int getLeftTextExtraWidth() {
return leftTextExtraWidth;
public static class LayoutResult {
public LayoutResult() {
return iconRect;
return textRect;
return accRect;
return checkRect;
return arrowRect;
return labelRect;
return result;
public static class ColumnAlignment {
private int checkAlignment;
private int iconAlignment;
private int textAlignment;
private int accAlignment;
private int arrowAlignment;
new ColumnAlignment(
new ColumnAlignment(
int arrowAlignment) {
public int getCheckAlignment() {
return checkAlignment;
public int getIconAlignment() {
return iconAlignment;
public int getTextAlignment() {
return textAlignment;
public int getAccAlignment() {
return accAlignment;
public int getArrowAlignment() {
return arrowAlignment;
public static class RectSize {
private int width;
private int height;
private int origWidth;
private int maxWidth;
public RectSize() {
public int getWidth() {
return width;
public int getHeight() {
return height;
public int getOrigWidth() {
return origWidth;
public int getMaxWidth() {
return maxWidth;