android-components / mozilla.components.feature.session / SwipeRefreshFeature

SwipeRefreshFeature

class SwipeRefreshFeature : SelectionAwareSessionObserver, LifecycleAwareFeature, OnChildScrollUpCallback, OnRefreshListener (source)

Feature implementation to add pull to refresh functionality to browsers.

Parameters

swipeRefreshLayout - Reference to SwipeRefreshLayout that has an EngineView as its child.

Constructors

Name Summary
<init> SwipeRefreshFeature(sessionManager: SessionManager, reloadUrlUseCase: ReloadUrlUseCase, swipeRefreshLayout: SwipeRefreshLayout, sessionId: String? = null)
Feature implementation to add pull to refresh functionality to browsers.

Inherited Properties

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

Functions

Name Summary
canChildScrollUp fun canChildScrollUp(parent: SwipeRefreshLayout, child: <ERROR CLASS>?): Boolean
Callback that checks whether it is possible for the child view to scroll up. If the child view cannot scroll up and the scroll event is not handled by the webpage it means we need to trigger the pull down to refresh functionality.
onLoadingStateChanged fun onLoadingStateChanged(session: Session, loading: Boolean): Unit
Called when the current session starts or stops refreshing.
onRefresh fun onRefresh(): Unit
Called when a swipe gesture triggers a refresh.
start fun start(): Unit
Start feature: Starts adding pull to refresh behavior for the active session.

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.
onSessionSelected open fun onSessionSelected(session: Session): Unit
The selection has changed and the given session is now the selected session.
stop open fun stop(): Unit
Stops the observer.

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.