Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
StageGuard committed Feb 2, 2025
1 parent d9445d1 commit 6b2f1e0
Showing 1 changed file with 39 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,55 @@ private class TestLifecycle(private val owner: LifecycleOwner) : Lifecycle() {
when (state) {
State.INITIALIZED -> error("cannot move to INITIALIZED state")
State.CREATED -> when (_currentState.value) {
State.INITIALIZED -> { it.onCreate(owner) }
State.CREATED -> { }
State.STARTED -> { it.onStop(owner) }
State.RESUMED -> { it.onPause(owner); it.onStop(owner) }
State.INITIALIZED -> it.onCreate(owner)
State.CREATED -> {}
State.STARTED -> it.onStop(owner)
State.RESUMED -> {
it.onPause(owner)
it.onStop(owner)
}
State.DESTROYED -> error("state is DESTROYED and cannot move to others")
}
State.STARTED -> when (_currentState.value) {
State.INITIALIZED -> { it.onCreate(owner); it.onStart(owner) }
State.CREATED -> { it.onStart(owner) }
State.STARTED -> { }
State.RESUMED -> { it.onPause(owner) }
State.INITIALIZED -> {
it.onCreate(owner)
it.onStart(owner)
}

State.CREATED -> it.onStart(owner)
State.STARTED -> {}
State.RESUMED -> it.onPause(owner)
State.DESTROYED -> error("state is DESTROYED and cannot move to others")
}
State.RESUMED -> when (_currentState.value) {
State.INITIALIZED -> { it.onCreate(owner); it.onStart(owner); it.onResume(owner) }
State.CREATED -> { it.onStart(owner); it.onResume(owner) }
State.STARTED -> { it.onResume(owner) }
State.RESUMED -> { }
State.INITIALIZED -> {
it.onCreate(owner)
it.onStart(owner)
it.onResume(owner)
}

State.CREATED -> {
it.onStart(owner)
it.onResume(owner)
}

State.STARTED -> it.onResume(owner)
State.RESUMED -> {}
State.DESTROYED -> error("state is DESTROYED and cannot move to others")
}
State.DESTROYED -> when (_currentState.value) {
State.INITIALIZED -> { }
State.CREATED -> { it.onDestroy(owner) }
State.STARTED -> { it.onStop(owner); it.onDestroy(owner) }
State.RESUMED -> { it.onPause(owner); it.onStop(owner); it.onDestroy(owner) }
State.CREATED -> it.onDestroy(owner)
State.STARTED -> {
it.onStop(owner)
it.onDestroy(owner)
}

State.RESUMED -> {
it.onPause(owner)
it.onStop(owner)
it.onDestroy(owner)
}
State.DESTROYED -> error("state is DESTROYED and cannot move to others")
}
}
Expand Down

0 comments on commit 6b2f1e0

Please sign in to comment.