Package 

Class ControllerChangeHandler


  • 
    public abstract class ControllerChangeHandler
    
                        

    ControllerChangeHandlers 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.

    • Constructor Detail

      • ControllerChangeHandler

        ControllerChangeHandler()
    • Method Detail

      • 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 transition
        to - The next View that should be put in the container or {@code null} if no Controller is being transitioned to
        isPush - 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.
      • 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 aborted
        newTop - 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.