AbstractNavigatorProvider

In package com.nhaarman.acorn.android.navigation

class com.nhaarman.acorn.android.navigation.AbstractNavigatorProvider

A NavigatorProvider that caches its created Navigator for as long as it isn't destroyed.

This instance uses a 30-minute timeout to determine whether to restore any saved Navigator state. This means that if the saved state is older than 30 minutes, the state is dropped and a fresh instance is created.

Constructors

constructor()

A NavigatorProvider that caches its created Navigator for as long as it isn't destroyed.

This instance uses a 30-minute timeout to determine whether to restore any saved Navigator state. This means that if the saved state is older than 30 minutes, the state is dropped and a fresh instance is created.

Parameters:
  • No parameters

Methods

open fun navigatorFor(savedState: NavigatorState?): N

Returns the Navigator instance to work with. If one needs to be created, given savedState can be used to restore any state, if applicable.

Parameters:
  • savedState: NavigatorState?

    If not null, the saved state for the Navigator as returned by saveNavigatorState.

open fun newInstance(savedState: NavigatorState?): Navigator

Unlike navigatorFor, this function should always return a new Navigator instance.

Parameters:
  • savedState: NavigatorState?

    If not null, the saved state for the Navigator as returned by saveNavigatorState.

protected abstract fun createNavigator(savedState: NavigatorState?): N
Parameters:
open fun saveNavigatorState(): NavigatorState?

Returns the saved state for the Navigator as returned by navigatorFor. Implementations can add extra data to the resulting state to suit their needs.

Parameters:
  • No parameters