public abstract class BaseDialogFragment<T extends ActionHandler> extends android.app.DialogFragment implements DialogFragmentInterface
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.
| Modifier and Type | Field and Description |
|---|---|
protected FragmentDialogController<T> |
controller |
| Constructor and Description |
|---|
BaseDialogFragment(Class<T> type)
Default constructor, actually forwarding to
BaseDialogFragment(boolean registerHandler)
with registerHandler being set to true. |
BaseDialogFragment(Class<T> type,
boolean registerHandler)
This constructor initializes the
BaseDialogFragment. |
| Modifier and Type | Method and Description |
|---|---|
protected android.view.View |
callInterceptor(android.view.View view)
Calls the
ViewInterceptor of this BaseDialogFragment. |
String |
getDialogTag()
Returns the tag under which this dialog can be registered with the fragment manager.
|
protected ViewInterceptor |
getViewInterceptor()
Returns the
ViewInterceptor of this BaseDialogFragment. |
boolean |
isRegisterHandler()
Returns the registerHandler flag, which is used to determine whether an
ActionHandler
should be registered or not. |
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.
|
abstract void |
populateDialog(android.app.AlertDialog.Builder builder,
android.os.Bundle arguments)
Abstract method to populate the given builder-object with appropriate
content.
|
void |
setActionHandler(T handler) |
void |
setRegisterHandler(boolean registerHandler)
Sets the flag whether to allow registering of an
ActionHandler. |
void |
setViewInterceptor(ViewInterceptor interceptor)
Sets the
ViewInterceptor for this BaseDialogFragment. |
dismiss, dismissAllowingStateLoss, dump, getDialog, getShowsDialog, getTheme, isCancelable, onActivityCreated, onCancel, onCreate, onDestroyView, onDetach, onDismiss, onSaveInstanceState, onStart, onStop, setCancelable, setShowsDialog, setStyle, show, showequals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getEnterTransition, getExitTransition, getFragmentManager, getId, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isVisible, onActivityResult, onConfigurationChanged, onContextItemSelected, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onCreateView, onDestroy, onDestroyOptionsMenu, onHiddenChanged, onInflate, onInflate, onLowMemory, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPrepareOptionsMenu, onResume, onTrimMemory, onViewCreated, onViewStateRestored, registerForContextMenu, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, startActivity, startActivity, startActivityForResult, startActivityForResult, toString, unregisterForContextMenuclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetActivity, getArgumentsprotected FragmentDialogController<T extends ActionHandler> controller
public BaseDialogFragment(Class<T> type)
Default constructor, actually forwarding to BaseDialogFragment(boolean registerHandler)
with registerHandler being set to true.
public BaseDialogFragment(Class<T> type, boolean registerHandler)
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)
onCreateDialog in class android.app.DialogFragmentsavedInstanceState - The last saved instance state of the Fragment, or null if this is
a freshly created Fragment.public void onAttach(android.app.Activity activity)
onAttach in class android.app.DialogFragmentactivity - the Activity this dialog is attached to.public abstract void populateDialog(android.app.AlertDialog.Builder builder,
android.os.Bundle arguments)
populateDialog in interface DialogFragmentInterfacebuilder - The Builder-object that should be populated and represents the
actual dialogarguments - The arguments of the DialogFragment, as retrievable via getArguments().public void setActionHandler(T handler)
handler - the handler to setpublic boolean isRegisterHandler()
ActionHandler
should be registered or not.public void setRegisterHandler(boolean registerHandler)
ActionHandler.registerHandler - Flag whether to register a handler or not.ActionHandlerpublic void setViewInterceptor(ViewInterceptor interceptor)
Sets the ViewInterceptor for this BaseDialogFragment.
interceptor - The ViewInterceptor for this BaseDialogFragment.ViewInterceptorprotected ViewInterceptor getViewInterceptor()
Returns the ViewInterceptor of this BaseDialogFragment.
ViewInterceptor of this BaseDialogFragment.protected android.view.View callInterceptor(android.view.View view)
Calls the ViewInterceptor of this BaseDialogFragment.
view - The View containing this dialog's UI elementspublic String getDialogTag()
FragmentManager.