public class ButtonBarDialogDecorator extends AbstractDialogDecorator<ValidateableDialog> implements ButtonBarDialogDecorator
| Constructor and Description |
|---|
ButtonBarDialogDecorator(ValidateableDialog dialog)
Creates a new decorator, which allows to modify the view hierarchy of a dialog, which is
designed according to Android 5's Material design guidelines even on pre-Lollipop devices and
may contain up to three buttons.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
areButtonsStacked()
Returns, whether the buttons of the dialog are aligned vertically, or not.
|
android.widget.Button |
getButton(int whichButton)
Returns one of the buttons, which is shown by the dialog.
|
int |
getButtonBarDividerColor()
Returns the color of the divider, which is located above the dialog's buttons.
|
int |
getButtonTextColor()
Returns the color of the button texts of the dialog.
|
boolean |
isButtonBarDividerShown()
Returns, whether the divider, which is located above the dialog's buttons, is shown, or not.
|
protected void |
onAttach(android.view.View view)
The method, which is invoked, when the decorator is attached to the view hierarchy.
|
protected void |
onDetach()
The method, which is invoked, when the decorator is detached from the view hierarchy.
|
void |
onRestoreInstanceState(android.os.Bundle savedInstanceState)
The method, which is invoked in order to restore the state, which has previously stored
within a bundle.
|
void |
onSaveInstanceState(android.os.Bundle outState)
The method, which is invoked in order to stores the decorator's state.
|
void |
setButtonBarDividerColor(int color)
Sets the color of the divider, which is located above the dialog's buttons.
|
void |
setButtonTextColor(int color)
Sets the color of the button texts of the dialog.
|
void |
setNegativeButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the negative button of the dialog.
|
void |
setNegativeButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the negative button of the dialog.
|
void |
setNeutralButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the neutral button of the dialog.
|
void |
setNeutralButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the neutral button of the dialog.
|
void |
setPositiveButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the positive button of the dialog.
|
void |
setPositiveButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
Sets the text of the positive button of the dialog.
|
void |
showButtonBarDivider(boolean show)
Sets, whether the divider, which is located above the dialog's buttons, should be shown, or
not.
|
void |
stackButtons(boolean stackButtons)
Sets, whether the buttons of the dialog should be aligned vertically, or not.
|
attach, detach, getContext, getDialog, getViewclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetContextpublic ButtonBarDialogDecorator(ValidateableDialog dialog)
dialog - The dialog, whose view hierarchy should be modified by the decorator, as an instance
of the type ValidateableDialog. The dialog may not be nullpublic final android.widget.Button getButton(int whichButton)
ButtonBarDialogDecoratorgetButton in interface ButtonBarDialogDecoratorwhichButton - The identifier of the button, which should be returned, as an Integer value.
The identifier must either be DialogInterface.BUTTON_POSITIVE, DialogInterface.BUTTON_NEGATIVE or DialogInterface.BUTTON_NEUTRALButton or null, if the button is not shown or if the dialog has not been shown yetpublic final void setPositiveButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
ButtonBarDialogDecoratoronSaveInstanceState-method, because it is not serializable. Therefore this
method must be called again after configuration changes, e.g when the orientation of the
device has changed, in order to re-register the listener.setPositiveButton in interface ButtonBarDialogDecoratortext - The text, which should be set, as an instance of the type CharSequence or
null, if no positive button should be shownlistener - The listener, which should be notified, when the positive button is clicked, as an
instance of the type DialogInterface.OnClickListener or null, if no listener
should be notifiedpublic final void setPositiveButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
ButtonBarDialogDecoratoronSaveInstanceState-method, because it is not serializable. Therefore this
method must be called again after configuration changes, e.g when the orientation of the
device has changed, in order to re-register the listener.setPositiveButton in interface ButtonBarDialogDecoratorresourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcelistener - The listener, which should be notified, when the positive button is clicked, as an
instance of the type DialogInterface.OnClickListener or null, if no listener
should be notifiedpublic final void setNegativeButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
ButtonBarDialogDecoratoronSaveInstanceState-method, because it is not serializable. Therefore this
method must be called again after configuration changes, e.g when the orientation of the
device has changed, in order to re-register the listener.setNegativeButton in interface ButtonBarDialogDecoratortext - The text, which should be set, as an instance of the type CharSequence or
null, if no negative button should be shownlistener - The listener, which should be notified, when the negative button is clicked, as an
instance of the type DialogInterface.OnClickListener or null, if no listener
should be notifiedpublic final void setNegativeButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
ButtonBarDialogDecoratoronSaveInstanceState-method, because it is not serializable. Therefore this
method must be called again after configuration changes, e.g when the orientation of the
device has changed, in order to re-register the listener.setNegativeButton in interface ButtonBarDialogDecoratorresourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcelistener - The listener, which should be notified, when the negative button is clicked, as an
instance of the type DialogInterface.OnClickListener or null, if no listener
should be notifiedpublic final void setNeutralButton(java.lang.CharSequence text,
android.content.DialogInterface.OnClickListener listener)
ButtonBarDialogDecoratoronSaveInstanceState-method, because it is not serializable. Therefore this
method must be called again after configuration changes, e.g when the orientation of the
device has changed, in order to re-register the listener.setNeutralButton in interface ButtonBarDialogDecoratortext - The text, which should be set, as an instance of the type CharSequence or
null, if no neutral button should be shownlistener - The listener, which should be notified, when the neutral button is clicked, as an
instance of the type DialogInterface.OnClickListener or null, if no listener
should be notifiedpublic final void setNeutralButton(int resourceId,
android.content.DialogInterface.OnClickListener listener)
ButtonBarDialogDecoratoronSaveInstanceState-method, because it is not serializable. Therefore this
method must be called again after configuration changes, e.g when the orientation of the
device has changed, in order to re-register the listener.setNeutralButton in interface ButtonBarDialogDecoratorresourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcelistener - The listener, which should be notified, when the neutral button is clicked, as an
instance of the type DialogInterface.OnClickListener or null, if no listener
should be notifiedpublic final boolean areButtonsStacked()
ButtonBarDialogDecoratorareButtonsStacked in interface ButtonBarDialogDecoratorpublic final void stackButtons(boolean stackButtons)
ButtonBarDialogDecoratorstackButtons in interface ButtonBarDialogDecoratorstackButtons - True, if the buttons of the dialog should be aligned vertically, false otherwisepublic final int getButtonTextColor()
ButtonBarDialogDecoratorgetButtonTextColor in interface ButtonBarDialogDecoratorInteger valuepublic final void setButtonTextColor(int color)
ButtonBarDialogDecoratorsetButtonTextColor in interface ButtonBarDialogDecoratorcolor - The color, which should be set, as an Integer valuepublic final boolean isButtonBarDividerShown()
ButtonBarDialogDecoratorisButtonBarDividerShown in interface ButtonBarDialogDecoratorpublic final void showButtonBarDivider(boolean show)
ButtonBarDialogDecoratorshowButtonBarDivider in interface ButtonBarDialogDecoratorshow - True, if the divider, which is located above the dialog's buttons, should be show,
false otherwisepublic final int getButtonBarDividerColor()
ButtonBarDialogDecoratorgetButtonBarDividerColor in interface ButtonBarDialogDecoratorInteger valuepublic final void setButtonBarDividerColor(int color)
ButtonBarDialogDecoratorsetButtonBarDividerColor in interface ButtonBarDialogDecoratorcolor - The color, which should be set, as an Integer valuepublic final void onSaveInstanceState(android.os.Bundle outState)
DialogDecoratoronSaveInstanceState in interface DialogDecoratoroutState - The bundle, the decorator's state should be stored within, as an instance of the
class Bundle. The bundle may not be nullpublic final void onRestoreInstanceState(android.os.Bundle savedInstanceState)
DialogDecoratoronRestoreInstanceState in interface DialogDecoratorsavedInstanceState - The bundle, which has been used to store the state, as an instance of the class
Bundle. The bundle may not be nullprotected final void onAttach(android.view.View view)
AbstractDialogDecoratoronAttach in class AbstractDialogDecorator<ValidateableDialog>view - The root view of the dialog, which is modified by the decorator, as an instance of
the class View. The view may not be nullprotected final void onDetach()
AbstractDialogDecoratoronDetach in class AbstractDialogDecorator<ValidateableDialog>