Package icyllis.modernui.fragment

# Interface FragmentResultOwner

All Known Implementing Classes:
  `FragmentManager`

public interface FragmentResultOwner
A class that manages passing data between fragments.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clearFragmentResult(String requestKey)`
  Clears the stored result for the given requestKey.
  `void`
  `clearFragmentResultListener(String requestKey)`
  Clears the stored `FragmentResultListener` for the given requestKey.
  `void`
  `setFragmentResult(String requestKey, DataSet result)`
  Sets the given result for the requestKey.
  `void`
  `setFragmentResultListener(String requestKey, LifecycleOwner lifecycleOwner, FragmentResultListener listener)`
  Sets the `FragmentResultListener` for a given requestKey.

- ## Method Details

  - ### setFragmentResult

    void setFragmentResult(@Nonnull String requestKey, @Nonnull DataSet result)
    Sets the given result for the requestKey. This result will be delivered to a `FragmentResultListener` that is called given to `setFragmentResultListener(String, LifecycleOwner, FragmentResultListener)` with the same requestKey. If no `FragmentResultListener` with the same key is set or the Lifecycle associated with the listener is not at least `Lifecycle.State.STARTED`, the result is stored until one becomes available, or `clearFragmentResult(String)` is called with the same requestKey.
    Parameters:
      `requestKey` - key used to identify the result
      `result` - the result to be passed to another fragment

  - ### clearFragmentResult

    void clearFragmentResult(@Nonnull String requestKey)
    Clears the stored result for the given requestKey.

    This clears any result that was previously set via `setFragmentResult(String, DataSet)` that hasn't yet been delivered to a `FragmentResultListener`.

    Parameters:
      `requestKey` - key used to identify the result

  - ### setFragmentResultListener

    void setFragmentResultListener(@Nonnull String requestKey, @Nonnull LifecycleOwner lifecycleOwner, @Nonnull FragmentResultListener listener)
    Sets the `FragmentResultListener` for a given requestKey. Once the given `LifecycleOwner` is at least in the `Lifecycle.State.STARTED` state, any results set by `setFragmentResult(String, DataSet)` using the same requestKey will be delivered to the `callback`. The callback will remain active until the LifecycleOwner reaches the `Lifecycle.State.DESTROYED` state or `clearFragmentResultListener(String)` is called with the same requestKey.
    Parameters:
      `requestKey` - requestKey used to identify the result
      `lifecycleOwner` - lifecycleOwner for handling the result
      `listener` - listener for result changes

  - ### clearFragmentResultListener

    void clearFragmentResultListener(@Nonnull String requestKey)
    Clears the stored `FragmentResultListener` for the given requestKey.

    This clears any `FragmentResultListener` that was previously set via `setFragmentResultListener(String, LifecycleOwner, FragmentResultListener)`.

    Parameters:
      `requestKey` - key used to identify the result