Optimization

This commit is contained in:
M66B 2020-04-23 12:58:27 +02:00
parent c8efa741fa
commit 5067f4b1f5
1 changed files with 4 additions and 2 deletions

View File

@ -66,12 +66,14 @@ public class TwoStateOwner implements LifecycleOwner {
}
void start() {
if (!registry.getCurrentState().equals(Lifecycle.State.DESTROYED))
Lifecycle.State state = registry.getCurrentState();
if (!state.equals(Lifecycle.State.STARTED) && !state.equals(Lifecycle.State.DESTROYED))
setState(Lifecycle.State.STARTED);
}
void stop() {
if (!registry.getCurrentState().equals(Lifecycle.State.DESTROYED))
Lifecycle.State state = registry.getCurrentState();
if (!state.equals(Lifecycle.State.CREATED) && !state.equals(Lifecycle.State.DESTROYED))
setState(Lifecycle.State.CREATED);
}