-
public abstract class ControllerChangeHandlerControllerChangeHandlers are responsible for swapping the View for one Controller to the View of another. They can be useful for performing animations and transitions between Controllers. Several default ControllerChangeHandlers are included.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceControllerChangeHandler.ControllerChangeListenerA listener interface useful for allowing external classes to be notified of change events.
public interfaceControllerChangeHandler.ControllerChangeCompletedListenerA simplified listener for being notified when the change is complete. This MUST be called by any customControllerChangeHandlers in order to ensure that Controllers will be notified of this change.
-
Field Summary
Fields Modifier and Type Field Description booleanforceRemoveViewOnPush
-
Constructor Summary
Constructors Constructor Description ControllerChangeHandler()
-
Method Summary
Modifier and Type Method Description voidsetForceRemoveViewOnPush(boolean force)abstract voidperformChange(@NonNull() ViewGroup container, @Nullable() View from, @Nullable() View to, boolean isPush, @NonNull() ControllerChangeHandler.ControllerChangeCompletedListener changeListener)Responsible for swapping Views from one Controller to another. voidsaveToBundle(@NonNull() Bundle bundle)Saves any data about this handler to a Bundle in case the application is killed. voidrestoreFromBundle(@NonNull() Bundle bundle)Restores data that was saved in the saveToBundle method. voidonAbortPush(@NonNull() ControllerChangeHandler newHandler, @Nullable() Controller newTop)Will be called on change handlers that push a controller if the controller being pushed ispopped before it has completed. voidcompleteImmediately()Will be called on change handlers that push a controller if the controller being pushed isneeds to be attached immediately, without any animations or transitions. ControllerChangeHandlercopy()Returns a copy of this ControllerChangeHandler. booleanisReusable()Returns whether or not this is a reusable ControllerChangeHandler. static ControllerChangeHandlerfromBundle(@Nullable() Bundle bundle)booleanremovesFromViewOnPush()-
-
Method Detail
-
setForceRemoveViewOnPush
void setForceRemoveViewOnPush(boolean force)
-
performChange
abstract void performChange(@NonNull() ViewGroup container, @Nullable() View from, @Nullable() View to, boolean isPush, @NonNull() ControllerChangeHandler.ControllerChangeCompletedListener changeListener)
Responsible for swapping Views from one Controller to another.
- Parameters:
container- The container these Views are hosted in.from- The previous View in the container or{@code null}if there was no Controller before this transitionto- The next View that should be put in the container or{@code null}if no Controller is being transitioned toisPush- True if this is a push transaction, false if it's a pop.changeListener- This listener must be called when any transitions or animations are completed.
-
saveToBundle
void saveToBundle(@NonNull() Bundle bundle)
Saves any data about this handler to a Bundle in case the application is killed.
- Parameters:
bundle- The Bundle into which data should be stored.
-
restoreFromBundle
void restoreFromBundle(@NonNull() Bundle bundle)
Restores data that was saved in the saveToBundle method.
- Parameters:
bundle- The bundle that has data to be restored
-
onAbortPush
void onAbortPush(@NonNull() ControllerChangeHandler newHandler, @Nullable() Controller newTop)
Will be called on change handlers that push a controller if the controller being pushed ispopped before it has completed.
- Parameters:
newHandler- The change handler that has caused this push to be abortednewTop- The Controller that will now be at the top of the backstack or{@code null}if there will be no new Controller at the top
-
completeImmediately
void completeImmediately()
Will be called on change handlers that push a controller if the controller being pushed isneeds to be attached immediately, without any animations or transitions.
-
copy
@NonNull() ControllerChangeHandler copy()
Returns a copy of this ControllerChangeHandler. This method is internally used by the library, soensure it will return an exact copy of your handler if overriding. If not overriding, the handlerwill be saved and restored from the Bundle format.
-
isReusable
boolean isReusable()
Returns whether or not this is a reusable ControllerChangeHandler. Defaults to false and shouldONLY be overridden if there are absolutely no side effects to using this handler more than once.In the case that a handler is not reusable, it will be copied using the copy methodprior to use.
-
fromBundle
@Nullable() static ControllerChangeHandler fromBundle(@Nullable() Bundle bundle)
-
removesFromViewOnPush
boolean removesFromViewOnPush()
-
-
-
-