android-components / mozilla.components.feature.readerview / ReaderViewFeature

ReaderViewFeature

class ReaderViewFeature : SelectionAwareSessionObserver, LifecycleAwareFeature, UserInteractionHandler (source)

Feature implementation that provides a reader view for the selected session, based on a web extension.

Types

Name Summary
ColorScheme enum class ColorScheme
Config inner class Config
FontType enum class FontType

Constructors

Name Summary
<init> ReaderViewFeature(context: <ERROR CLASS>, engine: Engine, sessionManager: SessionManager, controlsView: ReaderViewControlsView, onReaderViewAvailableChange: OnReaderViewAvailableChange = { })
Feature implementation that provides a reader view for the selected session, based on a web extension.

Inherited Properties

Name Summary
activeSession open var activeSession: Session?
the currently observed session

Functions

Name Summary
hideControls fun hideControls(): Unit
Hides the reader view appearance controls.
hideReaderView fun hideReaderView(session: Session? = activeSession): Unit
Hides the reader view UI.
onBackPressed fun onBackPressed(): Boolean
Called when this UserInteractionHandler gets the option to handle the user pressing the back key.
onReaderableStateUpdated fun onReaderableStateUpdated(session: Session, readerable: Boolean): Unit
onSessionAdded fun onSessionAdded(session: Session): Unit
The given session has been added.
onSessionRemoved fun onSessionRemoved(session: Session): Unit
The given session has been removed.
onSessionSelected fun onSessionSelected(session: Session): Unit
The selection has changed and the given session is now the selected session.
onUrlChanged fun onUrlChanged(session: Session, url: String): Unit
showControls fun showControls(): Unit
Shows the reader view appearance controls.
showReaderView fun showReaderView(session: Session? = activeSession): Unit
Shows the reader view UI.
start fun start(): Unit
stop fun stop(): Unit
Stops the observer.

Inherited Functions

Name Summary
observeFixed fun observeFixed(session: Session): Unit
Starts observing changes to the specified session.
observeIdOrSelected fun observeIdOrSelected(sessionId: String?): Unit
Starts observing changes to the session matching the sessionId. If the session does not exist, then observe the selected session.
observeSelected fun observeSelected(): Unit
Starts observing changes to the selected session (see SessionManager.selectedSession). If a different session is selected the observer will automatically be switched over and only notified of changes to the newly selected session.
onHomePressed open fun onHomePressed(): Boolean
In most cases, when the home button is pressed, we invoke this callback to inform the app that the user is going to leave the app.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.