public class FragmentDialogController<T extends ActionHandler> extends Object
An abstract base-class for easing automated dialog creation.
This class will make use of the ConfirmationActionHandler. Should the Activity calling this dialog not implement this interface, a ClassCastException will be thrown with an appropriate error-message.
| Constructor and Description |
|---|
FragmentDialogController(Class<T> type,
boolean registerHandler,
DialogFragmentInterface parent)
This constructor initializes the
BaseDialogFragment. |
| Modifier and Type | Method and Description |
|---|---|
android.view.View |
callInterceptor(android.view.View view)
Calls the
ViewInterceptor of the parent dialog fragment. |
boolean |
canRegisterHandler()
Returns the registerHandler flag, which is used to determine whether an
ActionHandler
should be registered or not. |
T |
getActionHandler()
Returns the currently set
ActionHandler, or null if none was set. |
String |
getDialogTag()
Returns the tag under which the parent dialog can be registered with the fragment manager.
|
ViewInterceptor |
getViewInterceptor()
Returns the
ViewInterceptor of the parent dialog. |
void |
onAttach(android.app.Activity activity)
Called when a fragment is first attached to its activity.
|
android.app.Dialog |
onCreateDialog(android.os.Bundle savedInstanceState)
Shows an AlertDialog, set the buttons and populate the Dialog with
content.
|
void |
setActionHandler(T handler)
Sets the
ActionHandler explicitly. |
void |
setRegisterHandler(boolean registerHandler)
Sets the flag whether to allow automatic implicit registering of an
ActionHandler. |
void |
setViewInterceptor(ViewInterceptor interceptor)
Sets the
ViewInterceptor for the parent dialog fragment. |
public FragmentDialogController(Class<T> type, boolean registerHandler, DialogFragmentInterface parent)
This constructor initializes the BaseDialogFragment. All descendents must call
through to either this or the default constructor.
The registerHandler parameter is used to allow or forbid registering the
parent Activity as an ActionHandler.
In case it is forbidden, the method setActionHandler() can (and should) be used
to set an ActionHandler manually that can actually be any class, not just the
parent Activity.
registerHandler - Flag whether to register an ActionHandler or not.public android.app.Dialog onCreateDialog(android.os.Bundle savedInstanceState)
savedInstanceState - The last saved instance state of the Fragment, or null if this is
a freshly created Fragment.public void onAttach(android.app.Activity activity)
activity - the Activity this dialog is attached to.public void setActionHandler(T handler)
ActionHandler explicitly.handler - the ActionHandler to setpublic boolean canRegisterHandler()
ActionHandler
should be registered or not.public void setRegisterHandler(boolean registerHandler)
ActionHandler.registerHandler - Flag whether to register an ActionHandler or not.ActionHandlerpublic void setViewInterceptor(ViewInterceptor interceptor)
Sets the ViewInterceptor for the parent dialog fragment.
interceptor - The ViewInterceptor for the parent dialog fragment.ViewInterceptorpublic ViewInterceptor getViewInterceptor()
Returns the ViewInterceptor of the parent dialog.
ViewInterceptor of the parent dialog fragment.public android.view.View callInterceptor(android.view.View view)
Calls the ViewInterceptor of the parent dialog fragment.
view - The View containing this dialog's UI elementspublic String getDialogTag()
FragmentManager.public T getActionHandler()
ActionHandler, or null if none was set.ActionHandler of the parent dialog, or null if none was set.