PdfTabBar

open class PdfTabBar @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : LinearLayout

View showing a horizontal list of document tabs. It is bound to a DocumentCoordinator through bindToDocumentCoordinator, which it mirrors: documents become tabs, the visible document is the selected tab, and tapping, closing or dragging a tab is forwarded back to the coordinator.

The tabs are rendered with Jetpack Compose in a single child view that takes the remaining width. The bar stays a horizontal LinearLayout, so integrators can keep adding their own views next to the tabs, such as an "add tab" button at index 0.

Constructors

Link copied to clipboard
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)

Types

Link copied to clipboard

Listener for clicks on tabs and their close buttons.

Link copied to clipboard
fun interface OnTabsChangedListener

Listener for changes to tabs list.

Properties

Link copied to clipboard
open val size: Int

Number of tabs in the tab bar.

Link copied to clipboard

Tab bar items that are currently added to the tab bar, in display order.

Functions

Link copied to clipboard

Registers OnTabClickedListener to get notified about clicks on tabs in this tab bar. If the listener has been registered previously, this method will be a no-op.

Link copied to clipboard

Registers OnTabsChangedListener to get notified when tabs list changes. If the listener has been registered previously, this method will be a no-op.

Link copied to clipboard
open fun bindToDocumentCoordinator(documentCoordinator: DocumentCoordinator)

Binds the tab bar to the DocumentCoordinator. Document coordinator is used to manage loaded documents and to switch between them.

Link copied to clipboard
open fun getTabBarItem(documentDescriptor: DocumentDescriptor?): PdfTabBarItem?

Searches tabs for tab that corresponds to the given document descriptor.

Link copied to clipboard

Removes a previously registered OnTabClickedListener. If the listener hasn't been registered previously, this method will be a no-op.

Link copied to clipboard

Removes a previously registered OnTabsChangedListener. If the listener hasn't been registered previously, this method will be a no-op.

Link copied to clipboard
open fun setCloseMode(closeMode: PdfTabBarCloseMode)

Sets the tab close mode which determines how the user is able to close documents. Defaults to showing tab close button on selected tab only.

Link copied to clipboard

Unbinds the tab bar from the DocumentCoordinator.