Created
December 3, 2015 09:29
-
-
Save dzwillpower/3ec5f58e4d198bd6935e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void apply(AlertController dialog) { | |
if (mCustomTitleView != null) { | |
dialog.setCustomTitle(mCustomTitleView); | |
} else { | |
if (mTitle != null) { | |
dialog.setTitle(mTitle); | |
} | |
if (mIcon != null) { | |
dialog.setIcon(mIcon); | |
} | |
if (mIconId != 0) { | |
dialog.setIcon(mIconId); | |
} | |
if (mIconAttrId != 0) { | |
dialog.setIcon(dialog.getIconAttributeResId(mIconAttrId)); | |
} | |
} | |
if (mMessage != null) { | |
dialog.setMessage(mMessage); | |
} | |
if (mPositiveButtonText != null) { | |
dialog.setButton(DialogInterface.BUTTON_POSITIVE, mPositiveButtonText, | |
mPositiveButtonListener, null); | |
} | |
if (mNegativeButtonText != null) { | |
dialog.setButton(DialogInterface.BUTTON_NEGATIVE, mNegativeButtonText, | |
mNegativeButtonListener, null); | |
} | |
if (mNeutralButtonText != null) { | |
dialog.setButton(DialogInterface.BUTTON_NEUTRAL, mNeutralButtonText, | |
mNeutralButtonListener, null); | |
} | |
if (mForceInverseBackground) { | |
dialog.setInverseBackgroundForced(true); | |
} | |
// For a list, the client can either supply an array of items or an | |
// adapter or a cursor | |
if ((mItems != null) || (mCursor != null) || (mAdapter != null)) { | |
createListView(dialog); | |
} | |
if (mView != null) { | |
if (mViewSpacingSpecified) { | |
dialog.setView(mView, mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight, | |
mViewSpacingBottom); | |
} else { | |
dialog.setView(mView); | |
} | |
} else if (mViewLayoutResId != 0) { | |
dialog.setView(mViewLayoutResId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment