diff --git a/README.md b/README.md index 4ddc67f..090e5a1 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,48 @@ -# [Modo](https://ikarenkov.github.io/Modo) - state-based Jetpack Compose navigation +Here’s the improved version of your documentation text: + +# [Modo](https://ikarenkov.github.io/Modo) - State-Based Jetpack Compose Navigation [![Maven Central](https://img.shields.io/maven-central/v/com.github.terrakok/modo-compose)](https://repo1.maven.org/maven2/com/github/terrakok) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -Modo is a simple and convenient state-base navigation library for Jetpack Compose. +Modo is a simple and convenient state-based navigation library for Jetpack Compose. https://github.com/ikarenkov/Modo/assets/17216532/e2977736-bdda-44a9-83f3-379731ddfecc -## [Project website](https://ikarenkov.github.io/Modo) +## [Project Website](https://ikarenkov.github.io/Modo) Check out our website to get the most up-to-date information about the library: -* [**Modo overview**](https://ikarenkov.github.io/Modo/modooverview.html) -* [**Quick start guide**](https://ikarenkov.github.io/Modo/quickstartguide.html) -* [**Core concepts**](https://ikarenkov.github.io/Modo/core-concepts.html) -* [**How to integrate Modo in your app**](https://ikarenkov.github.io/Modo/how-to-integrate-modo-to-your-app.html) -* [**Features list**](https://ikarenkov.github.io/Modo/features.html) +* [**Modo Overview**](https://ikarenkov.github.io/Modo/modooverview.html) +* [**Quick Start Guide**](https://ikarenkov.github.io/Modo/quickstartguide.html) +* [**Core Concepts**](https://ikarenkov.github.io/Modo/core-concepts.html) +* [**How to Integrate Modo into Your App**](https://ikarenkov.github.io/Modo/how-to-integrate-modo-to-your-app.html) +* [**Features List**](https://ikarenkov.github.io/Modo/features.html) -## Navigation - is a graph +## Navigation is a Graph Each integration of Modo is a -rooted tree (wiki) that can be displayed: +rooted tree (wiki) that can be displayed as follows: modo graph -* Each node - is a Screen or ContainerScreen -* Leafs nodes - are Screens. -* Inner nodes - are ContainerScreens. They can contain other Screens or ContainerScreens in - their navigationState. -* Root node - is a RootScreen. You can have multiply roots in your app. See How to integrate Modo for details. +* Each node is a Screen or ContainerScreen. +* Leaf nodes are Screens. +* Inner nodes are ContainerScreens. They can contain other Screens or ContainerScreens in their + navigationState. +* The root node is a RootScreen. You can have multiple roots in your app. + See How to integrate Modo for details. -## State defines UI +## State Defines UI -* `NavigationState` defines UI - * Initial state is defined in constructor of `ContainerScreen` by `navModel: NavModel` - * To update state, use `dispatch(action: Action)` on `NavigationContainer`, or build-in extension functions +* `NavigationState` defines the UI: + * The initial state is defined in the constructor of `ContainerScreen` by `navModel: NavModel`. + * To update the state, use `dispatch(action: Action)` on `NavigationContainer`, or use the built-in extension functions for [StackScreen](modo-compose/src/main/java/com/github/terrakok/modo/stack/StackActions.kt) - and [MultiScreen](modo-compose/src/main/java/com/github/terrakok/modo/multiscreen/MultiScreenActions.kt) -* There are Screen and ContainerScreen - * ContainerScreen can contain and render child screens - * There are some build-in implementation of ContainerScreen like StackScreen and MultiScreen -* You can easily create custom `Action` by extending `Action` or `ReducerAction`, + and [MultiScreen](modo-compose/src/main/java/com/github/terrakok/modo/multiscreen/MultiScreenActions.kt). +* There are `Screen` and `ContainerScreen`: + * `ContainerScreen` can contain and render child screens. + * There are some built-in implementations of `ContainerScreen` like `StackScreen` and `MultiScreen`. +* You can easily create custom `Action` by extending `Action` or `ReducerAction`. # License diff --git a/Writerside/codeSnippets/SampleAction.kt b/Writerside/codeSnippets/SampleAction.kt index 01aee09..9ba3d3d 100644 --- a/Writerside/codeSnippets/SampleAction.kt +++ b/Writerside/codeSnippets/SampleAction.kt @@ -3,8 +3,40 @@ fun interface SampleAction : ReducerAction { override fun reduce(oldState: SampleState): SampleState = oldState.copy(screen3 = null) } + class CreateScreen : SampleAction { override fun reduce(oldState: SampleState): SampleState = oldState.copy(screen3 = NestedScreen(canBeRemoved = true)) } -} \ No newline at end of file +} + +sealed interface SampleAction : NavigationAction { + class Remove : SampleAction + class CreateScreen : SampleAction +} + +@Parcelize +internal class RemovableItemContainerScreen( + private val navModel: NavModel = NavModel( + RemovableItemContainerState( + NestedScreen(canBeRemoved = false), + NestedScreen(canBeRemoved = false), + NestedScreen(canBeRemoved = true), + NestedScreen(canBeRemoved = false), + ) + ) +) : ContainerScreen(navModel) { + + override val reducer: NavigationReducer = NavigationReducer { action, state -> + when (action) { + is RemovableItemContainerAction.Remove -> { + state.copy(screen3 = null) + } + is RemovableItemContainerAction.CreateScreen -> { + state.copy(screen3 = NestedScreen(canBeRemoved = true)) + } + } + + } + +} diff --git a/Writerside/modo-docs.tree b/Writerside/modo-docs.tree index b7210d0..8064bdd 100644 --- a/Writerside/modo-docs.tree +++ b/Writerside/modo-docs.tree @@ -3,7 +3,7 @@ - + diff --git a/Writerside/topics/Android-integrations.md b/Writerside/topics/Android-integrations.md index c65a483..98728dd 100644 --- a/Writerside/topics/Android-integrations.md +++ b/Writerside/topics/Android-integrations.md @@ -1,24 +1,24 @@ -# Android integrations +# Android Integrations -Modo provides android integrations of ViewModel and Lifecycle support by providing `LocalLifecycleOwner`, `LocalViewModelStoreOwner` -and `LocalSavedStateRegistryOwner`. So you can use functions like `viewModel` to obtain android `ViewModel`. +Modo provides Android integrations with ViewModel and Lifecycle support through `LocalLifecycleOwner`, `LocalViewModelStoreOwner`, +and `LocalSavedStateRegistryOwner`. This allows you to use functions like `viewModel` to obtain Android `ViewModel`. -> [Sample code](%github_code_url%sample/src/main/java/com/github/terrakok/modo/sample/screens/viewmodel/AndroidViewModelSampleScreen.kt) of usage -> android integration inside Modo Screen. +> [Sample code](%github_code_url%sample/src/main/java/com/github/terrakok/modo/sample/screens/viewmodel/AndroidViewModelSampleScreen.kt) demonstrating +> Android integration inside a Modo Screen. ## Lifecycle -Since Modo provides LifeCycle support, let's take a look what specific lifecycle event means in the case of Screen Lifecycle: +Since Modo provides Lifecycle support, let's take a look at what specific lifecycle events mean in the context of Screen Lifecycle: -* `Lifecycle.Event.ON_CREATE` - called once per a screen when screen is created. -* `Lifecycle.Event.ON_START` and `Lifecycle.Event.ON_RESUME` - dispatched when `Screen.Content` comes to composition by first time. -* `Lifecycle.Event.ON_PAUSE` and `Lifecycle.Event.ON_STOP` - dispatched when `Screen.Content` leaves composition. -* `Lifecycle.Event.ON_DESTROY` - called once per a `Screen` when it is removed from navigation graph. +* `Lifecycle.Event.ON_CREATE` - called once per screen when the screen is created. +* `Lifecycle.Event.ON_START` and `Lifecycle.Event.ON_RESUME` - dispatched when `Screen.Content` is composed for the first time. +* `Lifecycle.Event.ON_PAUSE` and `Lifecycle.Event.ON_STOP` - dispatched when `Screen.Content` leaves the composition. +* `Lifecycle.Event.ON_DESTROY` - called once per screen when it is removed from the navigation graph. -For correct handling `Lifecycle.Event` from your `Screen.Content` we recommend to use build-in [screen effects](Screen-effects.md). There is -convenient `LifecycleScreenEffect` that subscribes to Screen's Lifecycle. +For correctly handling `Lifecycle.Event` from your `Screen.Content`, we recommend using the built-in [screen effects](Screen-effects.md). +The `LifecycleScreenEffect` is a convenient way to subscribe to a screen's Lifecycle. -```Kotlin +```kotlin LifecycleScreenEffect { LifecycleEventObserver { _, event -> logcat { "Lifecycle event $event." } @@ -26,13 +26,13 @@ LifecycleScreenEffect { } ``` -> If you use `LaunchedEffect` or `DisposableEffect` to subscribe to the `Screen`'s Lifecycle, you won't receive `Lifecycle.Event.ON_DESTROY` because -> this event happens after leaving the composition. +> If you use `LaunchedEffect` or `DisposableEffect` to subscribe to the screen's Lifecycle, you won't receive `Lifecycle.Event.ON_DESTROY` because +> this event happens after the screen leaves the composition. { style="warning" } ## ViewModel -You can use functions provided by Jetpack Compose to get `ViewModel`. +You can use functions provided by Jetpack Compose to get a `ViewModel`. \ No newline at end of file diff --git a/Writerside/topics/Community-and-contribution.md b/Writerside/topics/Community-and-contribution.md index 043cd3a..55b4c46 100644 --- a/Writerside/topics/Community-and-contribution.md +++ b/Writerside/topics/Community-and-contribution.md @@ -1,34 +1,33 @@ -# Community and contribution +# Community and Contribution -Modo is a community-driven project, and we welcome your contributions! Currently it is developing primary by -me ([Igor Karenkov](https://github.com/ikarenkov)). We -believe in the power of collaboration and are excited to see how you can -help us make Modo even better. +Modo is a community-driven project, and we welcome your contributions! Currently, it is primarily developed by +me, [Igor Karenkov](https://github.com/ikarenkov). We believe in the power of collaboration and are excited to see how you can help us make Modo even +better. -> Modo was started as a POC of state-driven navigation for Fragments by [Konstantin Tskhovrebov](https://github.com/terrakok). Then the support of -> Jetpack Compose was added by [Alexey Ershov](https://github.com/alaershov) and finalized by [Igor Karenkov](%ikarenkov_github_url%) (me). I've been -> developing Modo for a while and used it in my personal and work projects, so we with [Konstantin Tskhovrebov](https://github.com/terrakok) decided -> to -> transfer this project to my personal GitHub. Currently, I'm the main maintainer of Modo. +> Modo was started as a proof of concept for state-driven navigation for Fragments by [Konstantin Tskhovrebov](https://github.com/terrakok). Later, +> support for Jetpack Compose was added by [Alexey Ershov](https://github.com/alaershov) and finalized by [Igor Karenkov](%ikarenkov_github_url%). I +> have been developing Modo for a while and have used it in my personal and work projects. Together +> with [Konstantin Tskhovrebov](https://github.com/terrakok), we decided to transfer this project to my personal GitHub. Currently, I am the main +> maintainer of Modo. { style="note" } -## Join the Conversation: +## Join the Conversation - [Telegram Group (RU)](https://t.me/Cicerone_RUS): Connect with other Modo users, ask questions, share your experiences, and discuss new features. This is a great place to get help, share your ideas, and stay up-to-date with the latest developments. -- If you are seeking for english-speaking community, please [write to me](https://t.me/karenkovigor) and emphasize that need. We are ready to create a +- If you are seeking an English-speaking community, please [write to me](https://t.me/karenkovigor) and emphasize your need. We are ready to create a new group for you. -## Contribute to Modo: +## Contribute to Modo [GitHub](%github_url%): We encourage you to contribute to Modo by: - Reporting issues: If you encounter any bugs or have suggestions for improvements, please [open an issue](%github_url%issues) on GitHub. - Submitting pull requests: If you have code contributions, such as bug fixes, new features, or documentation improvements, feel free to submit a pull request. -- Improving documentation: Help us make Modo easier to use by contributing to the documentation. Each page has an "Edit page" link on top of it. You - can improve existing documentation or write new guides and tutorials. +- Improving documentation: Help us make Modo easier to use by contributing to the documentation. Each page has an "Edit page" link at the top. You can + improve existing documentation or write new guides and tutorials. ## Why Contribute? diff --git a/Writerside/topics/Core-concepts.md b/Writerside/topics/Core-concepts.md index f64d649..1bafa57 100644 --- a/Writerside/topics/Core-concepts.md +++ b/Writerside/topics/Core-concepts.md @@ -1,7 +1,7 @@ -# Core concepts +# Core Concepts -Modo is a state-based navigation library for jetpack compose. It represents UI as a structure of `Screen`s and `ContainerScreen`s (which is an -implementation of `Screen`). +Modo is a state-based navigation library for Jetpack Compose. It represents the UI as a structure of `Screen`s and `ContainerScreen`s (which are +implementations of `Screen`). @@ -9,47 +9,48 @@ implementation of `Screen`). ## Screen -`Screen` is a basic unit of UI. It displays content defined in overridden `fun Content(modifier: Modifier)` +A `Screen` is the basic unit of the UI. It displays content defined in the overridden `fun Content(modifier: Modifier)`. ```kotlin ``` { src="SampleScreen.kt" include-lines="1-20"} -### Screen key +### Screen Key -Each screen is identified by `ScreenKey` - a unique key that represents the screen. -This key is widely used in internal implementation. It is required to be unique per a screen, even after process death. For this you must use -build-in `generateScreenKey` function. +Each screen is identified by a `ScreenKey` - a unique key representing the screen. This key is extensively used in internal implementation. It must be +unique for each screen, even after process death. To ensure this, use the built-in `generateScreenKey` function. ### Arguments { id="arguments"} -To pass arguments to the screen, declare it in the Screen's constructor: - -```Kotlin +To pass arguments to the screen, declare them in the Screen's constructor: + +```kotlin ``` { src="SampleScreen.kt" include-lines="2-5,7-8" } -### Saving and restoring +### Saving and Restoring -Each screen is `Parcelable`, that helps to save and restore it during lifecycle changes. Use -parcelable [gradle plugin](https://developer.android.com/kotlin/parcelize) and `@Parcelable` annotation to generate `Parcelable` +Each screen is `Parcelable`, which helps to save and restore it during lifecycle changes. Use the +parcelable [Gradle plugin](https://developer.android.com/kotlin/parcelize) and the `@Parcelize` annotation to generate the `Parcelable` implementation on the fly. -It's vital to use build-in function like `rememberRootScreen` to integrate Modo with your application. Read [](How-to-integrate-modo-to-your-app.md) -for details. +It's crucial to use built-in functions like `rememberRootScreen` to integrate Modo with your application. +Read [](How-to-integrate-modo-to-your-app.md) for details. -## ContainerScreen { id="container-screen" } +## ContainerScreen -`ContainerScreen`s are the type of screens that can contain other screens. It's a basic building block for complex navigation structures. -[`StackScreen`](StackScreen.md) and `MultiScreen` are build-in implementations of `ContainerScreen`. +{ id="container-screen" } + +`ContainerScreen`s are types of screens that can contain other screens. They are fundamental building blocks for complex navigation +structures. [`StackScreen`](StackScreen.md) and `MultiScreen` are built-in implementations of `ContainerScreen`. ![diagram_2.png](diagram_2.png){ height = 300 } -Each ContainerScreen is defined by 2 typed parameters: State and Action. +Each ContainerScreen is defined by two typed parameters: State and Action. -```Kotlin +```kotlin @Stable abstract class ContainerScreen>( private val navModel: NavModel @@ -61,7 +62,7 @@ abstract class ContainerScreen State

-NavigationState - class that can contains nested screens and other additional info. State can be updated by calling dispatch(action). +NavigationState - a class that can contain nested screens and other additional information. The state can be updated by calling dispatch(action).

@Parcelize @@ -70,54 +71,55 @@ data class SampleState( val screen2: Screen, val screen3: Screen?, ) : NavigationState { - // You need to return all nested screens in order to provide correct work. + // You need to return all nested screens to ensure correct functionality. override fun getChildScreens(): List = listOfNotNull(screen1, screen2, screen3) } + +Read the State Update section for more details. + Action

-NavigationAction - marker interface to distinguish actions for this container on specific State. You can also use -ReducerAction for defining actions with update function in-place: - +NavigationAction - a marker interface to distinguish actions for this container on a specific State. You can also use +ReducerAction to define actions with an in-place update function: +

- -Updating State -

-To update state of ContainerScreen you must use dispatch(action: Action). -There are 2 ways how to define you action: -

- -(Recommended) ReducerAction - allows to define update function in-place. - - - -Custom reducer + Action. You can provide a reducer in you ContainerScreen implementation. -TODO - +`NavModel` - a state storage responsible for state updates and triggering UI updates. Each ContainerScreen has a NavModel as a constructor parameter. -
+### Rendering Nested Screens + +To render nested screens inside a container screen, you **must** use the `InternalContent` function. This function provides all necessary +integrations, such as: + +* Correct usage of `rememberSaveable` inside nested screens by using `SaveableStateHolder`. +* Integration of `ScreenModel`, ensuring consistency for the same screen and clearing it when the `Screen` leaves the hierarchy. +* Android integration, including `Lifecycle` and `ViewModel` support. + +The built-in `StackScreen` and `MultiScreen` use `InternalContent` under the hood to ensure correct nested screen functionality. + +## State Update +To update the state of a `ContainerScreen`, use `dispatch(action: Action)`. +There are two ways to define your action: -`NavModel` - storage of state, that responsible for state updates and triggering updating UI. Each ContainerScreen has a NavModel as a constructor -parameter. +### ReducerAction (Recommended) -To render nested screens inside a container screen, you **must** use `InternalContent` function. This function provides all necessary integrations, -like: +ReducerAction allows defining the update function in-place. + -* Correct work of `rememberSaveable` inside nested screens by using `SaveableStateHolder` -* `ScreenModel`'s integration, that should be the same for the same screen and be cleared when `Screen` leaves the hierarchy -* Android integration, like `Lifecycle` and `ViewModel` support +### Custom Reducer + Action -Build-in `StackScreen` and `MultiScreen` uses `InternalContent` under the hood, to provide correct work of nested screens. +You can provide a reducer in your ContainerScreen implementation. + ## Root Screen -To integrate Modo into your application, you use one of the build-in functions from Modo file. It returns a `RootScreen`, that simply provides +To integrate Modo into your application, use one of the built-in functions from the Modo file. It returns a `RootScreen`, which provides a `SaveableStateHolder`. \ No newline at end of file diff --git a/Writerside/topics/Features.topic b/Writerside/topics/Features.topic index 9427fed..54d9485 100644 --- a/Writerside/topics/Features.topic +++ b/Writerside/topics/Features.topic @@ -6,9 +6,7 @@ title="Features" id="Features">

- The list of available features in Modo: -

@@ -19,20 +17,20 @@ - + + href="%github_code_url%modo-compose/src/main/java/com/github/terrakok/modo/stack/StackActions.kt#L94">built-in commands - + @@ -42,12 +40,12 @@ + Playground - + @@ -59,25 +57,19 @@ - + - - - + - + - - +
Sample
Stack navigationStack Navigation StackScreen, build-in commands SampleStack, sample of navigation actions
Multi screen navigationMulti-Screen Navigation MultiScreen, build-in + href="%github_code_url%modo-compose/src/main/java/com/github/terrakok/modo/multiscreen/MultiScreenActions.kt">built-in commands SampleMultiscreen DialogScreen Dialogs - playground
Arguments can be passed as constructor parameter of Screen.Arguments can be passed as a constructor parameter of Screen. MainScreen
SampleStack
Android lifecycle and view modelAndroid Lifecycle and ViewModel - ModoScreenAndroidAdapter - connect Modo with android-related features. + ModoScreenAndroidAdapter + connects Modo with Android-related features. - MainScreen - AndroidViewModelSampleScreen.kt + MainScreen, AndroidViewModelSampleScreen.kt
- Activity and fragment integration, process death handling - Activity and Fragment Integration, Process Death Handling - Modo - Modo ModoSampleActivity, ModoFragment.kt, ModoLegacyIntegrationActivity.kt @@ -86,20 +78,20 @@
You can use LaunchedScreenEffect and DisposableScreenEffect analogies for Screen, it's linked - to life time of a Screen. There is also LifecycleScreenEffect for easy observing lifecycle. See ScreenEffects for - details. + You can use LaunchedScreenEffect and DisposableScreenEffect analogs for Screen. These are + linked to the lifetime of a Screen. Additionally, LifecycleScreenEffect is available for easy lifecycle + observation. See ScreenEffects + for details. ScreenEffectsSampleScreen.kt
Pager and LazyList integrationPager and LazyList Integration You can create custom ContainerScreen and use internal Screen inside Vertical/HorizontalPager - and LazyRow/Column. It's vital to define key = {} lambda with InternalContent for correct - integration. For more details take a look to the samples. LazyRow/Column. It is vital to define key = {} lambda with InternalContent for correct + integration. For more details, refer to the samples. LazyListUtils StackInLazyColumnScreen.kt, @@ -108,4 +100,4 @@
- \ No newline at end of file + diff --git a/Writerside/topics/How-to-integrate-modo-to-your-app.md b/Writerside/topics/How-to-integrate-modo-to-your-app.md index d0207f2..c621090 100644 --- a/Writerside/topics/How-to-integrate-modo-to-your-app.md +++ b/Writerside/topics/How-to-integrate-modo-to-your-app.md @@ -1,29 +1,28 @@ -# How to integrate modo into your app +# How to Integrate Modo into Your App -This topic provides guide for available app integrations. It also describes explains some details of the implementation. +This guide provides instructions for integrating Modo into your app, along with details of the implementation. -To provide correctness of navigation, Modo requires usage of build-in functions for integration. -To integrate Modo to your app you have 2 approaches: +To ensure the correctness of navigation, Modo requires the use of built-in functions for integration. You have two approaches to integrate Modo into +your app: -* `rememberRootScreen` - convenient integration to `Activity` or `Fragment`. You call it inside `setContent` function. -* `Modo.getOrCreateRootScreen`, `Modo.save` and `Modo.onRootScreenFinished` - for manual integration. +* `rememberRootScreen` - a convenient integration for `Activity` or `Fragment`. Use it inside the `setContent` function. +* `Modo.getOrCreateRootScreen`, `Modo.save`, and `Modo.onRootScreenFinished` - for manual integration. -> `rememberRootScreen` and `Modo.getOrCreateRootScreen` return the same instance of `RootScreen` in the same process, so you can safely inject it -> into your DI -> container. +> `rememberRootScreen` and `Modo.getOrCreateRootScreen` return the same instance of `RootScreen` within the same process, so you can safely inject it +> into your DI container. { style="note" } -## Convenient integration to Activity and Fragment +## Convenient Integration for Activity and Fragment -`rememberRootScreen` is a convenient way to integrate Modo to your `Activity` or `Fragment`. It automatically handles saving and restoring -of `RootScreen` during `Activity` lifecycle and process death. +`rememberRootScreen` is an easy way to integrate Modo into your `Activity` or `Fragment`. It automatically handles the saving and restoring +of `RootScreen` during the `Activity` lifecycle and process death. -To use modo inside your Activity or Fragment you need: +To use Modo inside your Activity or Fragment, follow these steps: -1. Use `rememberRootScreen` inside `setContent` function and pass Screen that you want to render. You will have instance of the `RootScreen` for - further displaying. -2. Display content by calling `fun Content(modifier: Modifier)` on created instance of `RootScreen` +1. Use `rememberRootScreen` inside the `setContent` function and pass the screen you want to render. This will give you an instance of + the `RootScreen` for further display. +2. Display content by calling `fun Content(modifier: Modifier)` on the created instance of `RootScreen`. @@ -32,30 +31,28 @@ To use modo inside your Activity or Fragment you need: - For Fragments we create ComposeView and call setContent on it. So don't forget to use + For Fragments, create a ComposeView and call setContent on it. Remember to use setViewCompositionStrategy( ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed ) - for your ComposeView for Fragment. Documentation reference. + for your ComposeView in the Fragment. Documentation reference. -## Manual integration +## Manual Integration -If you want to have more control over Modo integration, you can use `Modo.getOrCreateRootScreen`, `Modo.save` and `Modo.onRootScreenFinished` -functions. Check-out +If you prefer more control over Modo integration, you can use `Modo.getOrCreateRootScreen`, `Modo.save`, and `Modo.onRootScreenFinished`. Check out the [ModoLegacyIntegrationActivity](%github_code_url%sample/src/main/java/com/github/terrakok/modo/sample/ModoLegacyIntegrationActivity.kt) in the sample project for an example. -- `Modo.getOrCreateRootScreen` - initializes `RootScreen` with provided screen's or returns the existing instance. -- `Modo.save` - saves the current state of `RootScreen` and other internal data (like `screenCounterKey`) to the bundle for further restore +- `Modo.getOrCreateRootScreen` - initializes `RootScreen` with the provided screen or returns the existing instance. +- `Modo.save` - saves the current state of `RootScreen` and other internal data (like `screenCounterKey`) to the bundle for future restoration in `Modo.getOrCreateRootScreen`. -- `Modo.onRootScreenFinished` - should be called when `RootScreen` is no longer needed, f.e. at the finish of the Activity or the Fragment. It removes - the instance of `RootScreen` from the - internal runtime-cache and clears the other internal resources. +- `Modo.onRootScreenFinished` - should be called when `RootScreen` is no longer needed, such as when the Activity or Fragment finishes. It removes the + instance of `RootScreen` from the internal runtime cache and clears other internal resources. @@ -64,4 +61,4 @@ sample project for an example. TBD - \ No newline at end of file + diff --git a/Writerside/topics/Modo-and-DI.md b/Writerside/topics/Modo-and-DI.md index 53bd6ab..83c0ad0 100644 --- a/Writerside/topics/Modo-and-DI.md +++ b/Writerside/topics/Modo-and-DI.md @@ -1,12 +1,11 @@ -# Modo and DI +# Modo and Dependency Injection (DI) -You can safely inject `Screen` into your DI container, but it must be removed from DI as soon as `Screen` is removed from hierarchy. You can use -build-in screen effects for this purpose. +You can safely inject `Screen` into your DI container, but it must be removed from DI as soon as the `Screen` is removed from the hierarchy. Built-in +screen effects can be used for this purpose. -Your DI scope can be identified by `screenKey`. Here is a sample of how you can use it -with : +Your DI scope can be identified by `screenKey`. Here is a sample of how you can use it with : -```Kotlin +```kotlin ``` { src="ToothpickIntegrationSample.kt" } diff --git a/Writerside/topics/ModoOverview.md b/Writerside/topics/ModoOverview.md index a073eae..da20fad 100644 --- a/Writerside/topics/ModoOverview.md +++ b/Writerside/topics/ModoOverview.md @@ -1,4 +1,6 @@ -# Modo overview +Here's the improved version of your documentation text: + +# Modo Overview [![Maven Central](https://img.shields.io/maven-central/v/com.github.terrakok/modo-compose)](https://repo1.maven.org/maven2/com/github/terrakok) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) @@ -8,39 +10,40 @@