question: private void placeGroups ( ) { startRow ( ) ; placeChild ( mCloseButton , Gravity . END ) ; placeGroup ( mMainGroup ) ; int customGroupWidth = 0 ; if ( mCustomGroup != null ) { updateCustomGroupForRow ( ROW_MAIN ) ; customGroupWidth = getWidthWithMargins ( mCustomGroup ) ; } int buttonGroupWidth = 0 ; if ( mButtonGroup != null ) { updateButtonGroupForRow ( ROW_MAIN ) ; buttonGroupWidth = getWidthWithMargins ( mButtonGroup ) ; } boolean customGroupOnMainRow = customGroupWidth <= availableWidth ( ) ; boolean buttonGroupOnMainRow = customGroupWidth + buttonGroupWidth <= availableWidth ( ) ; if ( mCustomGroup != null ) { if ( customGroupOnMainRow ) { mCustomGroup . gravity = ( mButtonGroup != null && buttonGroupOnMainRow ) ? Gravity . START : Gravity . END ; } else { startRow ( ) ; updateCustomGroupForRow ( ROW_OTHER ) ; } placeGroup ( mCustomGroup ) ; } if ( mButtonGroup != null ) { if ( ! buttonGroupOnMainRow ) { startRow ( ) ; updateButtonGroupForRow ( ROW_OTHER ) ; if ( mCustomGroup == null && mMessageTextView != null ) { LayoutParams lp = ( LayoutParams ) mMessageTextView . getLayoutParams ( ) ; int messageBottom = lp . top + mMessageTextView . getMeasuredHeight ( ) ; mTop = Math . max ( mTop , messageBottom + 2 * mMargin ) ; } } placeGroup ( mButtonGroup ) ; if ( mCustomButton != null && ! buttonGroupOnMainRow ) { LayoutParams primaryButtonLP = ( LayoutParams ) mPrimaryButton . getLayoutParams ( ) ; LayoutParams customButtonLP = ( LayoutParams ) mCustomButton . getLayoutParams ( ) ; LayoutParams messageLP = ( LayoutParams ) mMessageView . getLayoutParams ( ) ; if ( customButtonLP . start >= messageLP . start ) { customButtonLP . start = messageLP . start ; } else { customButtonLP . start = mMargin ; } if ( ! mButtonGroup . isStacked ) { customButtonLP . top = primaryButtonLP . top + ( mPrimaryButton . getMeasuredHeight ( ) - mCustomButton . getMeasuredHeight ( ) ) / 2 ; } } } startRow ( ) ; if ( buttonGroupOnMainRow ) { int layoutHeight = mBottom ; for ( int i = 0 ; i < getChildCount ( ) ; i ++ ) { View child = getChildAt ( i ) ; int extraSpace = layoutHeight - child . getMeasuredHeight ( ) ; LayoutParams lp = ( LayoutParams ) child . getLayoutParams ( ) ; lp . top = extraSpace / 2 ; } } }
target:  Assigns positions to all of the views in the infobar. The icon, text, and close button are placed on the main row. The custom content and finally the buttons are placed on the main row if they fit. Otherwise, they go on their own rows.