Program: 92506
Project: 92506
Buggy source:
@Override protected void onLayout(boolean changed,final int l,int t,final int r,int b){
  if (isVisible(mTitleBar)) {
    int height=mTitleBar.getMeasuredHeight();
    mTitleBar.layout(l,t,r,t + height);
    t+=height;
  }
 else   if (mUseFullPadding) {
    t+=mNoTitlePaddingFull;
  }
  if (isVisible(mContent))   mContent.layout(l,t,r,t + mContent.getMeasuredHeight());
  if (mIsStacked) {
    b-=mButtonPaddingFull;
    for (    MDButton mButton : mButtons) {
      if (isVisible(mButton)) {
        mButton.layout(l,b - mButton.getMeasuredHeight(),r,b);
        b-=mButton.getMeasuredHeight();
      }
    }
  }
 else {
    int barTop;
    int barBottom=b;
    if (mUseFullPadding)     barBottom-=mButtonPaddingFull;
    barTop=barBottom - mButtonBarHeight;
    int offset=mButtonHorizontalEdgeMargin;
    int neutralLeft=-1;
    int neutralRight=-1;
    if (isVisible(mButtons[INDEX_POSITIVE])) {
      int bl, br;
      if (mButtonGravity == GravityEnum.END) {
        bl=l + offset;
        br=bl + mButtons[INDEX_POSITIVE].getMeasuredWidth();
      }
 else {
        br=r - offset;
        bl=br - mButtons[INDEX_POSITIVE].getMeasuredWidth();
        neutralRight=bl;
      }
      mButtons[INDEX_POSITIVE].layout(bl,barTop,br,barBottom);
      offset+=mButtons[INDEX_POSITIVE].getMeasuredWidth();
    }
    if (isVisible(mButtons[INDEX_NEGATIVE])) {
      int bl, br;
      if (mButtonGravity == GravityEnum.END) {
        bl=l + offset;
        br=bl + mButtons[INDEX_NEGATIVE].getMeasuredWidth();
      }
 else       if (mButtonGravity == GravityEnum.START) {
        br=r - offset;
        bl=br - mButtons[INDEX_NEGATIVE].getMeasuredWidth();
      }
 else {
        bl=l + mButtonHorizontalEdgeMargin;
        br=bl + mButtons[INDEX_NEGATIVE].getMeasuredWidth();
        neutralLeft=br;
      }
      mButtons[INDEX_NEGATIVE].layout(bl,barTop,br,barBottom);
    }
    if (isVisible(mButtons[INDEX_NEUTRAL])) {
      int bl, br;
      if (mButtonGravity == GravityEnum.END) {
        br=r - mButtonHorizontalEdgeMargin;
        bl=br - mButtons[INDEX_NEUTRAL].getMeasuredWidth();
      }
 else       if (mButtonGravity == GravityEnum.START) {
        bl=l + mButtonHorizontalEdgeMargin;
        br=bl + mButtons[INDEX_NEUTRAL].getMeasuredWidth();
      }
 else {
        if (neutralLeft == -1 && neutralRight != -1) {
          neutralLeft=neutralRight - mButtons[INDEX_NEUTRAL].getMeasuredWidth();
        }
 else         if (neutralRight == -1 && neutralLeft != -1) {
          neutralRight=neutralLeft + mButtons[INDEX_NEUTRAL].getMeasuredWidth();
        }
 else         if (neutralRight == -1) {
          neutralLeft=(r - l) / 2 - mButtons[INDEX_NEUTRAL].getMeasuredWidth() / 2;
          neutralRight=neutralLeft + mButtons[INDEX_NEUTRAL].getMeasuredWidth();
        }
        bl=neutralLeft;
        br=neutralRight;
      }
      mButtons[INDEX_NEUTRAL].layout(bl,barTop,br,barBottom);
    }
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,final int l,int t,final int r,int b){
  if (isVisible(mTitleBar)) {
    int height=mTitleBar.getMeasuredHeight();
    mTitleBar.layout(l,t,r,t + height);
    t+=height;
  }
 else   if (mUseFullPadding) {
    t+=mNoTitlePaddingFull;
  }
  if (isVisible(mContent))   mContent.layout(l,t,r,t + mContent.getMeasuredHeight());
  if (mIsStacked) {
    b-=mButtonPaddingFull;
    for (    MDButton mButton : mButtons) {
      if (isVisible(mButton)) {
        mButton.layout(l,b - mButton.getMeasuredHeight(),r,b);
        b-=mButton.getMeasuredHeight();
      }
    }
  }
 else {
    int barTop;
    int barBottom=b;
    if (mUseFullPadding)     barBottom-=mButtonPaddingFull;
    barTop=barBottom - mButtonBarHeight;
    int offset=mButtonHorizontalEdgeMargin;
    int neutralLeft=-1;
    int neutralRight=-1;
    if (isVisible(mButtons[INDEX_POSITIVE])) {
      int bl, br;
      if (mButtonGravity == GravityEnum.END) {
        bl=l + offset;
        br=bl + mButtons[INDEX_POSITIVE].getMeasuredWidth();
      }
 else {
        br=r - offset;
        bl=br - mButtons[INDEX_POSITIVE].getMeasuredWidth();
        neutralRight=bl;
      }
      mButtons[INDEX_POSITIVE].layout(bl,barTop,br,barBottom);
      offset+=mButtons[INDEX_POSITIVE].getMeasuredWidth();
    }
    if (isVisible(mButtons[INDEX_NEGATIVE])) {
      int bl, br;
      if (mButtonGravity == GravityEnum.END) {
        bl=l + offset;
        br=bl + mButtons[INDEX_NEGATIVE].getMeasuredWidth();
      }
 else       if (mButtonGravity == GravityEnum.START) {
        br=r - offset;
        bl=br - mButtons[INDEX_NEGATIVE].getMeasuredWidth();
      }
 else {
        bl=l + mButtonHorizontalEdgeMargin;
        br=bl + mButtons[INDEX_NEGATIVE].getMeasuredWidth();
        neutralLeft=br;
      }
      mButtons[INDEX_NEGATIVE].layout(bl,barTop,br,barBottom);
    }
    if (isVisible(mButtons[INDEX_NEUTRAL])) {
      int bl, br;
      if (mButtonGravity == GravityEnum.END) {
        br=r - mButtonHorizontalEdgeMargin;
        bl=br - mButtons[INDEX_NEUTRAL].getMeasuredWidth();
      }
 else       if (mButtonGravity == GravityEnum.START) {
        bl=l + mButtonHorizontalEdgeMargin;
        br=bl + mButtons[INDEX_NEUTRAL].getMeasuredWidth();
      }
 else {
        if (neutralLeft == -1 && neutralRight != -1) {
          neutralLeft=neutralRight - mButtons[INDEX_NEUTRAL].getMeasuredWidth();
        }
 else         if (neutralRight == -1 && neutralLeft != -1) {
          neutralRight=neutralLeft + mButtons[INDEX_NEUTRAL].getMeasuredWidth();
        }
 else         if (neutralRight == -1) {
          neutralLeft=(r - l) / 2 - mButtons[INDEX_NEUTRAL].getMeasuredWidth() / 2;
          neutralRight=neutralLeft + mButtons[INDEX_NEUTRAL].getMeasuredWidth();
        }
        bl=neutralLeft;
        br=neutralRight;
      }
      mButtons[INDEX_NEUTRAL].layout(bl,barTop,br,barBottom);
    }
  }
  setUpDividersVisibility(mContent,true,false);
}