AcornActivity

In package com.nhaarman.acorn.android

class com.nhaarman.acorn.android.AcornActivity

A base Activity implementation to simplify Acorn usage.

If you can't or don't want to inherit from this class, you can use the AcornActivityDelegate class and route the necessary Activity function calls to it.

Constructors

constructor()

A base Activity implementation to simplify Acorn usage.

If you can't or don't want to inherit from this class, you can use the AcornActivityDelegate class and route the necessary Activity function calls to it.

Parameters:
  • No parameters

Methods

protected abstract fun provideNavigatorProvider(): NavigatorProvider

Returns the NavigatorProvider to use in this Activity.

NavigatorProvider instances should be shared across instances, so make sure you cache this instance outside of this Activity.

Parameters:
  • No parameters
protected open fun provideViewControllerFactory(): ViewControllerFactory

Returns the ViewControllerFactory that can provide ViewController instances for this Activity.

The instance returned here will be combined with a SceneViewControllerFactory to be able to use Scene instances as ViewController factories.

Returns NoopViewControllerFactory by default.

Parameters:
  • No parameters
protected open fun provideTransitionFactory(viewControllerFactory: ViewControllerFactory): SceneTransitionFactory

Returns the SceneTransitionFactory to create SceneTransition instances for this Activity. The resulting factory instance will be combined with a DefaultSceneTransitionFactory as fallback.

By default, this returns a NoopSceneTransitionFactory.

Parameters:
  • viewControllerFactory: ViewControllerFactory

    The ViewControllerFactory as returned by provideViewControllerFactory.

protected open fun provideActivityControllerFactory(): ActivityControllerFactory

Returns the ActivityControllerFactory that can provide ActivityController instances when using external Activities.

Parameters:
  • No parameters
protected open fun provideRootView(): ?

Returns the root ViewGroup that is used to inflate Scene views in.

This method will be called once by Acorn, so it is safe to create new instances here.

Override this method if you want to provide your own ViewGroup implementation. If the returned ViewGroup has no parent, it will be passed to a call to setContentView.

This method returns null by default, which will result in an empty ViewGroup being used as the content view.

Parameters:
  • No parameters
protected fun navigator(): Navigator

Returns the navigator used in this instance. Must only be called after onCreate has been called.

Parameters:
  • No parameters
open fun onCreate(savedInstanceState: ?)
Parameters:
  • savedInstanceState: ?
open fun onStart()
Parameters:
  • No parameters
open fun onActivityResult(requestCode: Int, resultCode: Int, data: ?)
Parameters:
  • requestCode: Int
  • resultCode: Int
  • data: ?
open fun onBackPressed()
Parameters:
  • No parameters
open fun onStop()
Parameters:
  • No parameters
open fun onDestroy()
Parameters:
  • No parameters
open fun onSaveInstanceState(outState: )
Parameters:
  • outState: