public class WizardDialog extends AbstractHeaderDialogFragment implements WizardDialogDecorator
WizardDialog#create() or
WizardDialog#show() of the builder WizardDialog.Builder can be used.| Modifier and Type | Class and Description |
|---|---|
static class |
WizardDialog.Builder
A builder, which allows to create and show dialogs, which are designed according to Android
5's Material Design guidelines even on pre-Lollipop devices and provide a navigation for
switching between multiple fragments.
|
static class |
WizardDialog.TabPosition
Contains all possible positions of the dialog's tabs.
|
static interface |
WizardDialog.WizardListener
Defines the interface a class, which should be notified when the user navigates within a
WizardDialog, by using its next-, back- and finish-button. |
android.content.DialogInterface.OnCancelListener, android.content.DialogInterface.OnClickListener, android.content.DialogInterface.OnDismissListener, android.content.DialogInterface.OnKeyListener, android.content.DialogInterface.OnMultiChoiceClickListener, android.content.DialogInterface.OnShowListener| Constructor and Description |
|---|
WizardDialog()
Creates a dialog, which is designed according to Android 5's Material Design guidelines even
on pre-Lollipop devices and provides a navigation for switching between multiple fragments.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFragment(java.lang.CharSequence title,
java.lang.Class<? extends Fragment> fragmentClass)
Adds a new fragment to the dialog.
|
void |
addFragment(java.lang.CharSequence title,
java.lang.Class<? extends Fragment> fragmentClass,
android.os.Bundle arguments)
Adds a new fragment to the dialog.
|
void |
addFragment(java.lang.Class<? extends Fragment> fragmentClass)
Adds a new fragment to the dialog.
|
void |
addFragment(java.lang.Class<? extends Fragment> fragmentClass,
android.os.Bundle arguments)
Adds a new fragment to the dialog.
|
void |
addFragment(int resourceId,
java.lang.Class<? extends Fragment> fragmentClass)
Adds a new fragment to the dialog.
|
void |
addFragment(int resourceId,
java.lang.Class<? extends Fragment> fragmentClass,
android.os.Bundle arguments)
Adds a new fragment to the dialog.
|
void |
addWizardListener(WizardDialog.WizardListener listener)
Adds a new listener, which should be notified, when the user navigates within the dialog.
|
void |
clearFragments()
Removes all fragments from the dialog.
|
void |
enableSwipe(boolean enable)
Sets, whether switching fragments using swipe gestures should be enabled, or not.
|
void |
enableTabLayout(boolean enable)
Enables or disables the tabs, which indicate the currently shown fragment.
|
android.widget.Button |
getBackButton()
Returns the button, which allows to show the previous fragment of the dialog.
|
java.lang.CharSequence |
getBackButtonText()
Returns the text of the dialog's back button.
|
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.
|
android.widget.Button |
getFinishButton()
Returns the button, which allows to close dialog when the last fragment is shown.
|
java.lang.CharSequence |
getFinishButtonText()
Returns the text of the dialog's finish button.
|
int |
getFragmentCount()
Returns the number of fragments, which are contained by the dialog.
|
android.widget.Button |
getNextButton()
Returns the button, which allows to show the next fragment of the dialog.
|
java.lang.CharSequence |
getNextButtonText()
Returns the text of the dialog's next button.
|
int |
getTabIndicatorColor()
Returns the color of the indicator, which indicates the currently shown fragment.
|
int |
getTabIndicatorHeight()
Returns the height of the indicator, which indicates the currently shown fragment.
|
TabLayout |
getTabLayout()
Returns the tab layout, which is contained by the dialog.
|
WizardDialog.TabPosition |
getTabPosition()
Returns the position of the tabs, which indicate the currently shown fragment.
|
int |
getTabSelectedTextColor()
Returns the selected text color of the tabs, which indicate the currently shown fragment.
|
int |
getTabTextColor()
Returns the text color of the tabs, which indicate the currently shown fragment.
|
ViewPager |
getViewPager()
Returns the view pager, which is contained by the dialog.
|
int |
indexOfFragment(java.lang.Class<? extends Fragment> fragmentClass)
Returns the index of a specific fragment.
|
boolean |
isButtonBarDividerShown()
Returns, whether the divider, which is located above the dialog's buttons, is shown, or not.
|
boolean |
isButtonBarShown()
Returns, whether the dialog's buttons are shown, or not.
|
boolean |
isSwipeEnabled()
Returns, whether switching fragments using swipe gestures is enabled, or not.
|
boolean |
isTabLayoutEnabled()
Returns, whether the tabs, which indicate the currently shown fragment, are enabled, or not.
|
boolean |
isTabLayoutShown()
Returns, whether the tabs, which indicate the currently shown fragment, are shown, or not.
|
protected void |
onAttachDecorators(android.view.View view,
FragmentManager fragmentManager)
The method, which is invoked when the dialog's decorators should be attached.
|
protected void |
onDetachDecorators()
The method, which is invoked when the dialog's decorators should be detached.
|
protected void |
onRestoreInstanceState(android.os.Bundle savedInstanceState)
The method, which is invoked when the dialog is re-created in order to restore its state.
|
void |
onSaveInstanceState(android.os.Bundle outState) |
void |
removeFragment(int index)
Removes the fragment at a specific index from the dialog.
|
void |
removeWizardListener(WizardDialog.WizardListener listener)
Removes a specific listener, which should not be notified, when the user navigates within the
dialog.
|
void |
setBackButtonText(java.lang.CharSequence text)
Sets the text of the dialog's back button.
|
void |
setBackButtonText(int resourceId)
Sets the text of the dialog's back button.
|
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 |
setFinishButtonText(java.lang.CharSequence text)
Sets the text of the dialog's finish button.
|
void |
setFinishButtonText(int resourceId)
Sets the text of the dialog's finish button.
|
void |
setNextButtonText(java.lang.CharSequence text)
Sets the text of the dialog's next button.
|
void |
setNextButtonText(int resourceId)
Sets the text of the dialog's next button.
|
void |
setTabIndicatorColor(int color)
Sets the color of the indicator, which indicates the currently shown fragment.
|
void |
setTabIndicatorHeight(int height)
Sets the height of the indicator, which indicates the currently shown fragment.
|
void |
setTabPosition(WizardDialog.TabPosition tabPosition)
Sets the position of the tabs, which indicate the currently shown fragment.
|
void |
setTabSelectedTextColor(int selectedTextColor)
Sets the selected text color of the tabs, which indicate the currently shown fragment.
|
void |
setTabTextColor(int textColor)
Sets the text color of the tabs, which indicates the currently shown fragment.
|
void |
showButtonBar(boolean show)
Sets, whether the dialog's buttons should be shown, or not.
|
void |
showButtonBarDivider(boolean show)
Sets, whether the divider, which is located above the dialog's buttons, should be shown, or
not.
|
void |
showTabLayout(boolean show)
Sets, whether the tabs, which indicate the currently shown fragment, should be shown shown,
or not.
|
getHeaderBackground, getHeaderDividerColor, getHeaderHeight, getHeaderIcon, isHeaderDividerShown, isHeaderShown, setHeaderBackground, setHeaderBackground, setHeaderBackgroundColor, setHeaderDividerColor, setHeaderHeight, setHeaderIcon, setHeaderIcon, showHeader, showHeaderDividercancel, getBackground, getContext, getIcon, getMessage, getMessageColor, getTitle, getTitleColor, onCancel, onCreateDialog, onCreateView, onDestroy, onDestroyView, onDismiss, onStart, setBackground, setBackground, setBackgroundColor, setContext, setCustomMessage, setCustomMessage, setCustomTitle, setCustomTitle, setIcon, setIcon, setIconAttribute, setMessage, setMessage, setMessageColor, setOnCancelListener, setOnDismissListener, setOnShowListener, setThemeResourceId, setTitle, setTitle, setTitleColor, setView, setViewclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetCancelable, setOnCancelListener, setOnDismissListener, setOnShowListenergetBackground, getIcon, getMessage, getMessageColor, getTitle, getTitleColor, setBackground, setBackground, setBackgroundColor, setCustomMessage, setCustomMessage, setCustomTitle, setCustomTitle, setIcon, setIcon, setIconAttribute, setMessage, setMessage, setMessageColor, setTitle, setTitle, setTitleColor, setView, setViewgetContextpublic WizardDialog()
public final ViewPager getViewPager()
WizardDialogDecoratorgetViewPager in interface WizardDialogDecoratorpublic final TabLayout getTabLayout()
WizardDialogDecoratorgetTabLayout in interface WizardDialogDecoratorpublic final android.widget.Button getBackButton()
WizardDialogDecoratorgetBackButton in interface WizardDialogDecoratorButton or null, if the dialog does not show any fragments or has not
been shown yetpublic final android.widget.Button getNextButton()
WizardDialogDecoratorgetNextButton in interface WizardDialogDecoratorButton or null, if the dialog does not show any fragments or has not been
shown yetpublic final android.widget.Button getFinishButton()
WizardDialogDecoratorgetFinishButton in interface WizardDialogDecoratorButton or null, if the dialog does not show any fragments or
has not been shown yetpublic final void addFragment(java.lang.Class<? extends Fragment> fragmentClass)
WizardDialogDecoratoraddFragment in interface WizardDialogDecoratorfragmentClass - The class of the fragment, which should be added, as an instance of the class Class. The class may not be nullpublic final void addFragment(java.lang.Class<? extends Fragment> fragmentClass,
android.os.Bundle arguments)
WizardDialogDecoratoraddFragment in interface WizardDialogDecoratorfragmentClass - The class of the fragment, which should be added, as an instance of the class Class. The class may not be nullarguments - A bundle, which should be passed to the fragment, when it is shown, as an instance of
the class Bundle or null, if no arguments should be passed to the fragmentpublic final void addFragment(int resourceId,
java.lang.Class<? extends Fragment> fragmentClass)
WizardDialogDecoratoraddFragment in interface WizardDialogDecoratorresourceId - The resource id of the title of the fragment, which should be added, as an Integer value. The resource id must correspond to a valid string resourcefragmentClass - The class of the fragment, which should be added, as an instance of the class Class. The class may not be nullpublic final void addFragment(int resourceId,
java.lang.Class<? extends Fragment> fragmentClass,
android.os.Bundle arguments)
WizardDialogDecoratoraddFragment in interface WizardDialogDecoratorresourceId - The resource id of the title of the fragment, which should be added, as an Integer value. The resource id must correspond to a valid string resourcefragmentClass - The class of the fragment, which should be added, as an instance of the class Class. The class may not be nullarguments - A bundle, which should be passed to the fragment, when it is shown, as an instance of
the class Bundle or null, if no arguments should be passed to the fragmentpublic final void addFragment(java.lang.CharSequence title,
java.lang.Class<? extends Fragment> fragmentClass)
WizardDialogDecoratoraddFragment in interface WizardDialogDecoratortitle - The title of the fragment, which should be added, as an instance of the type CharSequence or null, if no title should be setfragmentClass - The class of the fragment, which should be added, as an instance of the class Class. The class may not be nullpublic final void addFragment(java.lang.CharSequence title,
java.lang.Class<? extends Fragment> fragmentClass,
android.os.Bundle arguments)
WizardDialogDecoratoraddFragment in interface WizardDialogDecoratortitle - The title of the fragment, which should be added, as an instance of the type CharSequence or null, if no title should be setfragmentClass - The class of the fragment, which should be added, as an instance of the class Class. The class may not be nullarguments - A bundle, which should be passed to the fragment, when it is shown, as an instance of
the class Bundle or null, if no arguments should be passed to the fragmentpublic final void removeFragment(int index)
WizardDialogDecoratorremoveFragment in interface WizardDialogDecoratorindex - The index of the fragment, which should be removed, as an valuepublic final void clearFragments()
WizardDialogDecoratorclearFragments in interface WizardDialogDecoratorpublic final int indexOfFragment(java.lang.Class<? extends Fragment> fragmentClass)
WizardDialogDecoratorindexOfFragment in interface WizardDialogDecoratorfragmentClass - The class of the fragment, whose index should be returned, as an instance of the
class Class. The class may not be nullInteger value or -1, if the adapter
does not contain the given fragmentpublic final int getFragmentCount()
WizardDialogDecoratorgetFragmentCount in interface WizardDialogDecoratorInteger
valuepublic final WizardDialog.TabPosition getTabPosition()
WizardDialogDecoratorgetTabPosition in interface WizardDialogDecoratorWizardDialog.TabPositionpublic void setTabPosition(WizardDialog.TabPosition tabPosition)
WizardDialogDecoratorsetTabPosition in interface WizardDialogDecoratortabPosition - The position, which should be set, as a value of the enum WizardDialog.TabPosition. The
position may either be USE_HEADER, PREFER_HEADER or
NO_HEADERpublic final boolean isTabLayoutEnabled()
WizardDialogDecoratorisTabLayoutEnabled in interface WizardDialogDecoratorpublic final void enableTabLayout(boolean enable)
WizardDialogDecoratorenableTabLayout in interface WizardDialogDecoratorenable - True, if the tabs should be enabled, false otherwisepublic final boolean isTabLayoutShown()
WizardDialogDecoratorisTabLayoutShown in interface WizardDialogDecoratorpublic final void showTabLayout(boolean show)
WizardDialogDecoratorshowTabLayout in interface WizardDialogDecoratorshow - True, if the tabs, which indicate the currently shown fragment, should be shown,
false otherwisepublic final int getTabIndicatorHeight()
WizardDialogDecoratorgetTabIndicatorHeight in interface WizardDialogDecoratorInteger valuepublic final void setTabIndicatorHeight(int height)
WizardDialogDecoratorsetTabIndicatorHeight in interface WizardDialogDecoratorheight - The height, which should be set, in pixels as an Integer value. The height
must be at least 1public final int getTabIndicatorColor()
WizardDialogDecoratorgetTabIndicatorColor in interface WizardDialogDecoratorInteger valuepublic final void setTabIndicatorColor(int color)
WizardDialogDecoratorsetTabIndicatorColor in interface WizardDialogDecoratorcolor - The color, which should be set, as an Integer valuepublic final int getTabTextColor()
WizardDialogDecoratorgetTabTextColor in interface WizardDialogDecoratorInteger valuepublic final void setTabTextColor(int textColor)
WizardDialogDecoratorsetTabTextColor in interface WizardDialogDecoratortextColor - The text color, which should be set, as an Integer valuepublic final int getTabSelectedTextColor()
WizardDialogDecoratorgetTabSelectedTextColor in interface WizardDialogDecoratorInteger valuepublic final void setTabSelectedTextColor(int selectedTextColor)
WizardDialogDecoratorsetTabSelectedTextColor in interface WizardDialogDecoratorselectedTextColor - The selected text color, which should be set, as an Integer valuepublic final boolean isSwipeEnabled()
WizardDialogDecoratorisSwipeEnabled in interface WizardDialogDecoratorpublic final void enableSwipe(boolean enable)
WizardDialogDecoratorenableSwipe in interface WizardDialogDecoratorenable - True, if switching fragments using swipe gestures should be enabled, false otherwisepublic final boolean isButtonBarShown()
WizardDialogDecoratorisButtonBarShown in interface WizardDialogDecoratorpublic final void showButtonBar(boolean show)
WizardDialogDecoratorshowButtonBar in interface WizardDialogDecoratorshow - True, if the dialog's buttons should be shown, false otherwisepublic final int getButtonTextColor()
WizardDialogDecoratorgetButtonTextColor in interface WizardDialogDecoratorInteger value or -1, if no
custom color has been setpublic final void setButtonTextColor(int color)
WizardDialogDecoratorsetButtonTextColor in interface WizardDialogDecoratorcolor - The color, which should be set, as an Integer valuepublic final boolean isButtonBarDividerShown()
WizardDialogDecoratorisButtonBarDividerShown in interface WizardDialogDecoratorpublic final void showButtonBarDivider(boolean show)
WizardDialogDecoratorshowButtonBarDivider in interface WizardDialogDecoratorshow - True, if the divider, which is located above the dialog's buttons, should be show,
false otherwisepublic final int getButtonBarDividerColor()
WizardDialogDecoratorgetButtonBarDividerColor in interface WizardDialogDecoratorInteger valuepublic final void setButtonBarDividerColor(int color)
WizardDialogDecoratorsetButtonBarDividerColor in interface WizardDialogDecoratorcolor - The color, which should be set, as an Integer valuepublic final java.lang.CharSequence getBackButtonText()
WizardDialogDecoratorgetBackButtonText in interface WizardDialogDecoratorCharSequencepublic final void setBackButtonText(int resourceId)
WizardDialogDecoratorsetBackButtonText in interface WizardDialogDecoratorresourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcepublic final void setBackButtonText(java.lang.CharSequence text)
WizardDialogDecoratorsetBackButtonText in interface WizardDialogDecoratortext - The text, which should be set, as an instance of the class CharSequence. The
text may neither be null, nor emptypublic final java.lang.CharSequence getNextButtonText()
WizardDialogDecoratorgetNextButtonText in interface WizardDialogDecoratorCharSequencepublic final void setNextButtonText(int resourceId)
WizardDialogDecoratorsetNextButtonText in interface WizardDialogDecoratorresourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcepublic final void setNextButtonText(java.lang.CharSequence text)
WizardDialogDecoratorsetNextButtonText in interface WizardDialogDecoratortext - The text, which should be set, as an instance of the class CharSequence. The
text may neither be null, nor emptypublic final java.lang.CharSequence getFinishButtonText()
WizardDialogDecoratorgetFinishButtonText in interface WizardDialogDecoratorCharSequencepublic final void setFinishButtonText(int resourceId)
WizardDialogDecoratorsetFinishButtonText in interface WizardDialogDecoratorresourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcepublic final void setFinishButtonText(java.lang.CharSequence text)
WizardDialogDecoratorsetFinishButtonText in interface WizardDialogDecoratortext - The text, which should be set, as an instance of the class CharSequence. The
text may neither be null, nor emptypublic final void addWizardListener(WizardDialog.WizardListener listener)
WizardDialogDecoratoronSaveInstanceState-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 listeners.addWizardListener in interface WizardDialogDecoratorlistener - The listener, which should be added, as an instance of the type WizardDialog.WizardListener. The listener may not be nullpublic final void removeWizardListener(WizardDialog.WizardListener listener)
WizardDialogDecoratorremoveWizardListener in interface WizardDialogDecoratorlistener - The listener, which should be removed, as an instance of the type WizardDialog.WizardListener. The listener may not be nullpublic final void onSaveInstanceState(android.os.Bundle outState)
onSaveInstanceState in class AbstractHeaderDialogFragmentprotected final void onRestoreInstanceState(android.os.Bundle savedInstanceState)
AbstractMaterialDialogFragmentonSaveInstanceState-method.onRestoreInstanceState in class AbstractHeaderDialogFragmentsavedInstanceState - 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 onAttachDecorators(android.view.View view,
FragmentManager fragmentManager)
AbstractMaterialDialogFragmentonAttachDecorators in class AbstractHeaderDialogFragmentview - The root view of the view hierarchy, which should be modified by the decorators, as
an instance of the class View. The view may not be nullfragmentManager - The fragment manager, which can be used to show fragment within the dialog, as an
instance of the class FragmentManager. The fragment manager may not be nullprotected final void onDetachDecorators()
AbstractMaterialDialogFragmentonDetachDecorators in class AbstractHeaderDialogFragment