UiHelpers

class UiHelpers @JvmOverloads constructor(val activity: () -> Activity?, val externalFragmentOpener: (Fragment) -> Unit? = null, val isRootViewInHostHierarchy: Boolean = false, val externalFragmentCloser: () -> Unit? = null, val contentInsets: (Fragment) -> StateFlow<Insets>?? = null)

Helpers to allow Books to open activities and fragments.

Constructors

Link copied to clipboard
constructor(activity: () -> Activity?, externalFragmentOpener: (Fragment) -> Unit? = null, isRootViewInHostHierarchy: Boolean = false, externalFragmentCloser: () -> Unit? = null, contentInsets: (Fragment) -> StateFlow<Insets>?? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val activity: () -> Activity?

Required, but may return null if the Activity is no longer valid. You can pass the activity through requireValidActivity to only provide valid activities.

Link copied to clipboard
val contentInsets: (Fragment) -> StateFlow<Insets>??

The insets of the host chrome drawn around a Books Fragment's content, resolved per fragment. Books pads its scrollable content by these so that it scrolls clear of the chrome.

Link copied to clipboard

Called when a Books view wants to close itself but has no back stack of its own to pop, which is the case when externalFragmentOpener puts views somewhere they are a root view. Required if it does; without it such a view stays open when it asks to be closed.

Link copied to clipboard

Required if you need to open Books Fragments outside of Books itself, e.g. via BookLibraryController.openBooksView.

Link copied to clipboard

Set to true if a Books root view is integrated deeper into your view hierarchy and shouldn't open child fragments in the same view hierarchy.