Skip to content

Repository files navigation

Navigation

Relatively simple tool for navigation in a lot of kotlin platforms:

JVM Android Js ARM x64 Linux x64

KDocs Tutorials

It is strongly recommended to open tutorial after completing reading of this readme to understand how to use library

Artifacts

There are several types of artifacts:

  • Core - only base functionality: nodes, chains, navigation repositories, etc.
  • Compose - Core + Compose wrappers for navigation node
  • MVVM - Core + MVVM wrappers:

Android Fragment hosts

When using the core or MVVM AppCompatActivity.initNavigation extension on a plain Activity, call dev.inmo.navigation.core.prepareNavigationRestore before super.onCreate on every creation:

override fun onCreate(savedInstanceState: Bundle?) {
    prepareNavigationRestore()
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    initNavigation(/* your existing navigation configuration */)
}

This preparation removes only restored NodeFragment instances before their lifecycle callbacks run; navigation rebuilds and binds them from its configuration repository. Other Fragments and a custom FragmentFactory keep their normal restoration behavior. NavigationMVVMSingleActivity already performs the preparation, so its subclasses do not need an additional call.

Existing plain Activity hosts must add this preparation call. Calling initNavigation after super.onCreate alone is too late to prepare restored Fragments. Accessing an unbound node or config now throws an informative IllegalStateException immediately instead of waiting indefinitely.

Installation

Maven Central

Gradle

implementation "dev.inmo:navigation.mvvm:$navigation_version"

Maven

<dependency>
  <groupId>dev.inmo</groupId>
  <artifactId>navigation.mvvm</artifactId>
  <version>${navigation_version}</version>
</dependency>