public class UniversiActivityDelegate extends UniversiContextDelegate
UniversiContextDelegate implementation that can be used within context of Activity.
Activity delegate has additional support for Fragments management via FragmentController.
Fragment controller can be accessed via getFragmentController() and custom controller can
be specified via setFragmentController(FragmentController). Fragment factory that provides
fragments to be displayed in a context of a specific UniversiActivity can be specified via
setFragmentFactory(FragmentFactory).
Navigational transition that can be specified via setNavigationalTransition(BaseNavigationalTransition)
can be used to finish the associated activity.
Note that this class has not been made final on purpose so it may be easily mocked in tests, thought it should not been extended.
UniversiFragmentDelegate| Modifier and Type | Method and Description |
|---|---|
static UniversiActivityDelegate |
create(androidx.fragment.app.FragmentActivity activity)
Creates a new instance of UniversiActivityDelegate for the given activity.
|
androidx.fragment.app.Fragment |
findCurrentFragment()
Searches for current fragment displayed in container that is used by
FragmentController
of this delegate to show fragments in the context of the associated activity. |
boolean |
finishWithNavigationalTransition()
Finishes the associated activity with navigational transition specified via
setNavigationalTransition(BaseNavigationalTransition) (if any). |
FragmentController |
getFragmentController()
Returns the default controller or the one specified via
setFragmentController(FragmentController)
that is used to manage fragments of the associated activity. |
FragmentFactory |
getFragmentFactory()
Returns the factory providing fragment instances for fragment controller of this delegate.
|
BaseNavigationalTransition |
getNavigationalTransition()
Returns the navigational transition used to finish associated activity via
finishWithNavigationalTransition(). |
boolean |
popFragmentsBackStack()
Pops stack with fragments of the associated activity via
FragmentManager.popBackStack() |
void |
setFragmentController(FragmentController controller)
Sets a controller used to manage (show/hide) fragments in context of the associated activity.
|
void |
setFragmentFactory(FragmentFactory factory)
Sets a factory that provides fragment instances for fragment controller of this delegate.
|
void |
setNavigationalTransition(BaseNavigationalTransition transition)
Sets a navigational transition that can be used to finish associated activity via
finishWithNavigationalTransition(). |
dismissDialogWithId, dismissXmlDialog, getDialogController, getDialogFactory, isActiveNetworkConnected, isNetworkConnected, isPaused, isRequestRegistered, isStateSaved, isViewCreated, registerRequest, setDialogController, setDialogFactory, setDialogXmlFactory, setPaused, setStateSaved, setViewCreated, showDialogWithId, showXmlDialog, unregisterRequest@NonNull public static UniversiActivityDelegate create(@NonNull androidx.fragment.app.FragmentActivity activity)
activity - The activity context in which will be the new delegate used.public void setNavigationalTransition(@Nullable
BaseNavigationalTransition transition)
finishWithNavigationalTransition().
If the given transition is not null this method will also configure incoming transitions
for the associated activity via BaseNavigationalTransition.configureIncomingTransitions(Activity).
transition - The desired transition. May be null to clear the current one.getNavigationalTransition()@Nullable public BaseNavigationalTransition getNavigationalTransition()
finishWithNavigationalTransition().null if no transition has been specified.setNavigationalTransition(BaseNavigationalTransition)public boolean finishWithNavigationalTransition()
setNavigationalTransition(BaseNavigationalTransition) (if any).True if transition has been started, false otherwise.public void setFragmentController(@Nullable
FragmentController controller)
controller - The desired controller. May be null to use the default one.getFragmentController(),
setFragmentFactory(FragmentFactory)@NonNull public FragmentController getFragmentController()
setFragmentController(FragmentController)
that is used to manage fragments of the associated activity.public void setFragmentFactory(@Nullable
FragmentFactory factory)
factory - The desired factory. May be null to clear the current one.setFragmentController(FragmentController),
getFragmentController(),
getFragmentFactory()@Nullable public FragmentFactory getFragmentFactory()
null if no factory has been specified.setFragmentFactory(FragmentFactory)@Nullable public androidx.fragment.app.Fragment findCurrentFragment()
FragmentController
of this delegate to show fragments in the context of the associated activity.FragmentController.findCurrentFragment()
or null if there is no fragment displayed.public boolean popFragmentsBackStack()
FragmentManager.popBackStack()True if the stack has ben popped, false otherwise.