Package icyllis.modernui.lifecycle

# Interface LifecycleObserver

public interface LifecycleObserver
Callback interface for listening to `LifecycleOwner` state changes.

Methods like `onCreate(LifecycleOwner)` will be called first, and then followed by the call of `onStateChanged(LifecycleOwner, Lifecycle.Event)`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default void`
  `onCreate(LifecycleOwner owner)`
  Notifies that `ON_CREATE` event occurred.
  `default void`
  `onDestroy(LifecycleOwner owner)`
  Notifies that `ON_DESTROY` event occurred.
  `default void`
  `onPause(LifecycleOwner owner)`
  Notifies that `ON_PAUSE` event occurred.
  `default void`
  `onResume(LifecycleOwner owner)`
  Notifies that `ON_RESUME` event occurred.
  `default void`
  `onStart(LifecycleOwner owner)`
  Notifies that `ON_START` event occurred.
  `default void`
  `onStateChanged(LifecycleOwner source, Lifecycle.Event event)`
  Called when a state transition event happens.
  `default void`
  `onStop(LifecycleOwner owner)`
  Notifies that `ON_STOP` event occurred.

- ## Method Details

  - ### onCreate

    default void onCreate(@Nonnull LifecycleOwner owner)
    Notifies that `ON_CREATE` event occurred.

    This method will be called after the `LifecycleOwner`'s `onCreate` method returns.

    Parameters:
      `owner` - the component, whose state was changed

  - ### onStart

    default void onStart(@Nonnull LifecycleOwner owner)
    Notifies that `ON_START` event occurred.

    This method will be called after the `LifecycleOwner`'s `onStart` method returns.

    Parameters:
      `owner` - the component, whose state was changed

  - ### onResume

    default void onResume(@Nonnull LifecycleOwner owner)
    Notifies that `ON_RESUME` event occurred.

    This method will be called after the `LifecycleOwner`'s `onResume` method returns.

    Parameters:
      `owner` - the component, whose state was changed

  - ### onPause

    default void onPause(@Nonnull LifecycleOwner owner)
    Notifies that `ON_PAUSE` event occurred.

    This method will be called before the `LifecycleOwner`'s `onPause` method is called.

    Parameters:
      `owner` - the component, whose state was changed

  - ### onStop

    default void onStop(@Nonnull LifecycleOwner owner)
    Notifies that `ON_STOP` event occurred.

    This method will be called before the `LifecycleOwner`'s `onStop` method is called.

    Parameters:
      `owner` - the component, whose state was changed

  - ### onDestroy

    default void onDestroy(@Nonnull LifecycleOwner owner)
    Notifies that `ON_DESTROY` event occurred.

    This method will be called before the `LifecycleOwner`'s `onStop` method is called.

    Parameters:
      `owner` - the component, whose state was changed

  - ### onStateChanged

    default void onStateChanged(@Nonnull LifecycleOwner source, @Nonnull Lifecycle.Event event)
    Called when a state transition event happens.
    Parameters:
      `source` - The source of the event
      `event` - The event