Java Code Examples for android.arch.lifecycle.Lifecycle

The following examples show how to use android.arch.lifecycle.Lifecycle. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: scene   Source File: UserVisibleHintGroupScene.java    License: Apache License 2.0 6 votes vote down vote up
public void setUserVisibleHint(boolean isVisibleToUser) {
    if (this.mUserVisibleHint == isVisibleToUser) {
        return;
    }
    mUserVisibleHint = isVisibleToUser;
    dispatchVisibleChanged();

    if (mUserVisibleHint) {
        if (mStart) {
            mUserVisibleLifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_START);
        }
        if (mResume) {
            mUserVisibleLifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_RESUME);
        }
    } else {
        if (mResume) {
            mUserVisibleLifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_PAUSE);
        }

        if (mStart) {
            mUserVisibleLifecycleOwner.handleLifecycleEvent(Lifecycle.Event.ON_STOP);
        }
    }
}
 
Example 2
Source Project: scene   Source File: NavigationScene.java    License: Apache License 2.0 6 votes vote down vote up
@MainThread
public void addOnBackPressedListener(@NonNull final LifecycleOwner lifecycleOwner, @NonNull final OnBackPressedListener onBackPressedListener) {
    ThreadUtility.checkUIThread();
    if (lifecycleOwner.getLifecycle().getCurrentState() == DESTROYED) {
        // ignore
        return;
    }
    this.mNavigationSceneManager.addOnBackPressedListener(lifecycleOwner, onBackPressedListener);
    lifecycleOwner.getLifecycle().addObserver(new LifecycleObserver() {
        @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
        void onDestroy() {
            lifecycleOwner.getLifecycle().removeObserver(this);
            mNavigationSceneManager.removeOnBackPressedListener(onBackPressedListener);
        }
    });
}
 
Example 3
Source Project: RxComponentLifecycle   Source File: RxLifecycle.java    License: Apache License 2.0 6 votes vote down vote up
public <T> Observable<T> onlyIfResumedOrStarted(final T value) {
    return Observable.just("")
            .flatMap(new Function<String, ObservableSource<T>>() {
                @Override
                public ObservableSource<T> apply(@NonNull String $) throws Exception {
                    final Lifecycle.State currentState = lifecycleRegistry.getCurrentState();
                    if (currentState.equals(Lifecycle.State.RESUMED) || currentState.equals(Lifecycle.State.STARTED)) {
                        return Observable.just(value);
                    } else {
                        return onResume()
                                .map(new Function<Lifecycle.Event, T>() {
                                    @Override
                                    public T apply(@NonNull Lifecycle.Event event) throws Exception {
                                        return value;
                                    }
                                });
                    }
                }
            });
}
 
Example 4
Source Project: RxComponentLifecycle   Source File: RxLifecycle.java    License: Apache License 2.0 5 votes vote down vote up
public Observable<Lifecycle.Event> onPause() {
    return onEvent().filter(new Predicate<Lifecycle.Event>() {
        @Override
        public boolean test(@NonNull Lifecycle.Event event) throws Exception {
            return ON_PAUSE.equals(event);
        }
    });
}
 
Example 5
Source Project: scene   Source File: NavigationSceneManager.java    License: Apache License 2.0 5 votes vote down vote up
public boolean interceptOnBackPressed() {
    List<NonNullPair<LifecycleOwner, OnBackPressedListener>> copy = new ArrayList<>(mOnBackPressedListenerList);
    for (int i = copy.size() - 1; i >= 0; i--) {
        NonNullPair<LifecycleOwner, OnBackPressedListener> pair = copy.get(i);
        if (pair.first.getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)
                && pair.second.onBackPressed()) {
            return true;
        }
    }
    return false;
}
 
Example 6
@Override
public void onActivityStarted(@NonNull Activity activity) {
    if (!mIsBackground) {
        setTopActivity(activity);
    }
    if (mConfigCount < 0) {
        ++mConfigCount;
    } else {
        ++mForegroundCount;
    }
    consumeActivityLifecycleCallbacks(activity, Lifecycle.Event.ON_START);
}
 
Example 7
Source Project: TypedTextView   Source File: TypedTextView.java    License: Apache License 2.0 5 votes vote down vote up
@OnLifecycleEvent( Lifecycle.Event.ON_STOP )
void onViewStopped()
{
    //stop typing as view is now in stopped state.
    removeCallbacks();

    //pause playing keystrokes
    pauseKeyStrokes();
}
 
Example 8
Source Project: android_9.0.0_r45   Source File: FragmentNavigatorTest.java    License: Apache License 2.0 5 votes vote down vote up
@UiThreadTest
@Test
public void testSingleTop() {
    FragmentNavigator fragmentNavigator = new FragmentNavigator(mEmptyActivity,
            mFragmentManager, R.id.container);
    FragmentNavigator.Destination destination = fragmentNavigator.createDestination();
    destination.setFragmentClass(EmptyFragment.class);

    // First push an initial Fragment
    fragmentNavigator.navigate(destination, null, null);

    // Now push the Fragment that we want to replace with a singleTop operation
    fragmentNavigator.navigate(destination, null, null);
    mFragmentManager.executePendingTransactions();
    Fragment fragment = mFragmentManager.findFragmentById(R.id.container);
    assertThat("Fragment should be added", fragment, is(notNullValue()));

    fragmentNavigator.navigate(destination, null,
            new NavOptions.Builder().setLaunchSingleTop(true).build());
    mFragmentManager.executePendingTransactions();
    Fragment replacementFragment = mFragmentManager.findFragmentById(R.id.container);
    assertThat("Replacement Fragment should be added", replacementFragment,
            is(notNullValue()));
    assertThat("Replacement Fragment should be the correct type", replacementFragment,
            is(CoreMatchers.<Fragment>instanceOf(EmptyFragment.class)));
    assertThat("Replacement should be a new instance", replacementFragment,
            is(not(equalTo(fragment))));
    assertThat("Old instance should be destroyed", fragment.getLifecycle().getCurrentState(),
            is(equalTo(Lifecycle.State.DESTROYED)));
}
 
Example 9
Source Project: RxComponentLifecycle   Source File: RxLifecycle.java    License: Apache License 2.0 5 votes vote down vote up
public Observable<Lifecycle.Event> onAny() {
    return onEvent().filter(new Predicate<Lifecycle.Event>() {
        @Override
        public boolean test(@NonNull Lifecycle.Event event) throws Exception {
            return ON_ANY.equals(event);
        }
    });
}
 
Example 10
Source Project: rxjava-RxLife   Source File: LifecycleScope.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onScopeEnd() {
    final Lifecycle lifecycle = this.lifecycle;
    if (lifecycle == null)
        throw new NullPointerException("lifecycle is null");
    lifecycle.removeObserver(this);
}
 
Example 11
Source Project: RxLifecycle   Source File: RxLifecycle.java    License: Apache License 2.0 5 votes vote down vote up
public void disposeOnStop(final Disposable disposable) {
    onStop()
            .subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Consumer<Lifecycle.Event>() {
                @Override
                public void accept(@NonNull Lifecycle.Event event) throws Exception {
                    disposable.dispose();
                }
            });
}
 
Example 12
Source Project: RxLifecycle   Source File: RxLifecycle.java    License: Apache License 2.0 5 votes vote down vote up
public Observable<Lifecycle.Event> onCreate() {
    return onEvent().filter(new Predicate<Lifecycle.Event>() {
        @Override
        public boolean test(@NonNull Lifecycle.Event event) throws Exception {
            return ON_CREATE.equals(event);
        }
    });
}
 
Example 13
Source Project: RxLifecycle   Source File: RxLifecycle.java    License: Apache License 2.0 5 votes vote down vote up
public void disposeOnDestroy(final Disposable disposable) {
    onDestroy()
            .subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Consumer<Lifecycle.Event>() {
                @Override
                public void accept(@NonNull Lifecycle.Event event) throws Exception {
                    disposable.dispose();
                }
            });
}
 
Example 14
Source Project: SocialSdkLibrary   Source File: LoginManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 开始登录分享,供外面调用
 *
 * @param act 发起登录的 activity
 * @param listener 分享监听
 * @param obj 登录参数
 */
private void preLogin(
        final Activity act,
        final @Target.LoginTarget int target,
        final LoginObj obj,
        final OnLoginStateListener listener) {

    if (act instanceof LifecycleOwner) {
        Lifecycle lifecycle = ((LifecycleOwner) act).getLifecycle();
        if (lifecycle != null) {
            lifecycle.addObserver(this);
        }
    }
    listener.onState(act, LoginResult.stateOf(Result.STATE_START));

    currentObj = obj;
    stateListener = listener;
    currentTarget = target;
    originActivity = new WeakReference<>(act);
    IPlatform platform = GlobalPlatform.newPlatformByTarget(act, target);
    GlobalPlatform.savePlatform(platform);

    if (target == Target.LOGIN_WX_SCAN) {
        wrapListener = new OnLoginListenerWrap(stateListener);
        GlobalPlatform.getCurrentPlatform().login(act, target, obj, wrapListener);
        return;
    }

    if (platform.getUIKitClazz() == null) {
        wrapListener = new OnLoginListenerWrap(stateListener);
        GlobalPlatform.getCurrentPlatform().login(act, target, obj, wrapListener);
    } else {
        Intent intent = new Intent(act, platform.getUIKitClazz());
        intent.putExtra(GlobalPlatform.KEY_ACTION_TYPE, GlobalPlatform.ACTION_TYPE_LOGIN);
        act.startActivity(intent);
        act.overridePendingTransition(0, 0);
    }
}
 
Example 15
Source Project: relight   Source File: Screen.java    License: Apache License 2.0 5 votes vote down vote up
public Screen(Context context, Lifecycle lifecycle, String text) {
    super(context, lifecycle);
    this.addChildren(
        new ToolbarWidget(context, lifecycle).backgroundResource(R.color.colorPrimary).marginBottom(16.0f),
        new ButtonWidget(context, lifecycle).id(ID_BW_PUSH_FIRST).text("push first").onClickListener(this),
        new ButtonWidget(context, lifecycle).id(ID_BW_PUSH_SECOND).text("push second").onClickListener(this),
        new ButtonWidget(context, lifecycle).id(ID_BW_POP).text("pop").onClickListener(this),
        new TextWidget(context, lifecycle).text(text).marginTop(50.0f)
    );
}
 
Example 16
Source Project: v9porn   Source File: UserPresenter.java    License: MIT License 5 votes vote down vote up
@Override
public void register(String username, String password1, String password2, String email, String captchaInput) {
    dataManager.userRegisterPorn9Video(username, password1, password2, email, captchaInput)
            .compose(RxSchedulersHelper.ioMainThread())
            .compose(provider.bindUntilEvent(Lifecycle.Event.ON_DESTROY))
            .subscribe(new CallBackWrapper<User>() {
                @Override
                public void onBegin(Disposable d) {
                    ifViewAttached(view -> view.showLoading(true));
                }

                @Override
                public void onSuccess(final User user) {
                    ifViewAttached(view -> {
                        user.copyProperties(dataManager.getUser());
                        view.showContent();
                        view.registerSuccess(user);
                    });
                }

                @Override
                public void onError(final String msg, int code) {
                    ifViewAttached(view -> {
                        view.showContent();
                        view.registerFailure(msg);
                    });
                }
            });
}
 
Example 17
Source Project: PainlessMusicPlayer   Source File: BasePresenter.java    License: Apache License 2.0 5 votes vote down vote up
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
public void onStop() {
    if (onStopDisposable != null) {
        synchronized (onStopDisposableLock) {
            if (onStopDisposable != null) {
                onStopDisposable.dispose();
                onStopDisposable = null;
            }
        }
    }
}
 
Example 18
Source Project: relight   Source File: ListDemoWidget.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected LinearWidget build(Context context, Lifecycle lifecycle) {
    return new LinearWidget(context, lifecycle,
        renderList(false),
        renderList(true)
    ).vertical();
}
 
Example 19
Source Project: v9porn   Source File: GoogleRecaptchaVerifyPresenter.java    License: MIT License 5 votes vote down vote up
@Override
public void verifyGoogleRecaptcha(String action, String r, String id, String recaptcha) {
    dataManager.verifyGoogleRecaptcha(action, r, id, recaptcha)
            .retryWhen(new RetryWhenProcess(RetryWhenProcess.PROCESS_TIME))
            .compose(RxSchedulersHelper.ioMainThread())
            .compose(provider.bindUntilEvent(Lifecycle.Event.ON_DESTROY))
            .subscribe(new CallBackWrapper<Response<ResponseBody>>() {

                @Override
                public void onBegin(Disposable d) {
                    ifViewAttached(GoogleRecaptchaVerifyView::startVerifyRecaptcha);
                }

                @Override
                public void onSuccess(Response<ResponseBody> responseBodyResponse) {
                    if (responseBodyResponse.isSuccessful()) {
                        Log.d(TAG, "验证成功了");
                        ifViewAttached(GoogleRecaptchaVerifyView::verifyRecaptchaSuccess);
                    } else {
                        Log.d(TAG, "验证失败了");
                        ifViewAttached(GoogleRecaptchaVerifyView::verifyRecaptchaFailure);
                    }
                }

                @Override
                public void onError(String msg, int code) {
                    Log.d(TAG, "访问网络失败");
                    ifViewAttached(GoogleRecaptchaVerifyView::verifyRecaptchaFailure);
                }
            });
}
 
Example 20
Source Project: v9porn   Source File: PlayPxgavActivityModule.java    License: MIT License 4 votes vote down vote up
@Provides
static LifecycleProvider<Lifecycle.Event> providerLifecycleProvider(AppCompatActivity mAppCompatActivity) {
    return AndroidLifecycle.createLifecycleProvider(mAppCompatActivity);
}
 
Example 21
Source Project: scene   Source File: UserVisibleLifecycleOwner.java    License: Apache License 2.0 4 votes vote down vote up
void handleLifecycleEvent(@NonNull Lifecycle.Event event) {
    initialize();
    mLifecycleRegistry.handleLifecycleEvent(event);
}
 
Example 22
Source Project: v9porn   Source File: SettingPresenter.java    License: MIT License 4 votes vote down vote up
@Inject
public SettingPresenter(LifecycleProvider<Lifecycle.Event> provider, DataManager dataManager) {
    super(provider);
    this.dataManager = dataManager;
}
 
Example 23
@Override
protected void onStop() {
    super.onStop();
    mRegistry.handleLifecycleEvent(Lifecycle.Event.ON_STOP);
}
 
Example 24
public void registerLifecycle(Lifecycle lifecycle) {
    lifecycle.addObserver(this);
}
 
Example 25
Source Project: PainlessMusicPlayer   Source File: HomePresenter.java    License: Apache License 2.0 4 votes vote down vote up
@OnLifecycleEvent(Lifecycle.Event.ON_START)
public void onStart() {
    disposeOnStop(playbackData.queuePositionObservable()
            .subscribe(this::onQueuePositionChanged));
}
 
Example 26
Source Project: v9porn   Source File: PictureViewerActivityModule.java    License: MIT License 4 votes vote down vote up
@Provides
static LifecycleProvider<Lifecycle.Event> providerLifecycleProvider(AppCompatActivity mAppCompatActivity) {
    return AndroidLifecycle.createLifecycleProvider(mAppCompatActivity);
}
 
Example 27
Source Project: v9porn   Source File: MvpBasePresenter.java    License: MIT License 4 votes vote down vote up
public MvpBasePresenter(LifecycleProvider<Lifecycle.Event> provider) {
    super(provider);
}
 
Example 28
Source Project: scene   Source File: UserVisibleHintGroupSceneTests.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void test() {
    TestScene testScene = new TestScene();
    Pair<SceneLifecycleManager<NavigationScene>, NavigationScene> pair = NavigationSourceUtility.createFromInitSceneLifecycleManager(testScene);

    SceneLifecycleManager sceneLifecycleManager = pair.first;
    NavigationScene navigationScene = pair.second;

    GroupSceneLifecycleTests.TestChildScene childScene = new GroupSceneLifecycleTests.TestChildScene();
    assertEquals(childScene.getState(), State.NONE);

    testScene.add(testScene.mId, childScene, "childScene");
    assertEquals(childScene.getState(), State.ACTIVITY_CREATED);

    sceneLifecycleManager.onStart();
    assertEquals(childScene.getState(), State.STARTED);
    assertTrue(testScene.isVisible());

    testScene.setUserVisibleHint(false);
    assertEquals(childScene.getState(), State.STARTED);
    assertFalse(testScene.isVisible());
    assertFalse(testScene.getUserVisibleHint());
    assertEquals(testScene.getLifecycle().getCurrentState(), Lifecycle.State.STARTED);
    assertEquals(testScene.getUserVisibleHintLifecycle().getCurrentState(), Lifecycle.State.CREATED);

    testScene.setUserVisibleHint(true);
    assertEquals(childScene.getState(), State.STARTED);
    assertTrue(testScene.isVisible());
    assertTrue(testScene.getUserVisibleHint());
    assertEquals(testScene.getLifecycle().getCurrentState(), Lifecycle.State.STARTED);
    assertEquals(testScene.getUserVisibleHintLifecycle().getCurrentState(), Lifecycle.State.STARTED);

    sceneLifecycleManager.onResume();
    assertEquals(childScene.getState(), State.RESUMED);
    assertTrue(testScene.isVisible());
    assertEquals(testScene.getLifecycle().getCurrentState(), Lifecycle.State.RESUMED);
    assertEquals(testScene.getUserVisibleHintLifecycle().getCurrentState(), Lifecycle.State.RESUMED);

    testScene.setUserVisibleHint(false);
    assertEquals(childScene.getState(), State.RESUMED);
    assertFalse(testScene.isVisible());
    assertFalse(testScene.getUserVisibleHint());
    assertEquals(testScene.getLifecycle().getCurrentState(), Lifecycle.State.RESUMED);
    assertEquals(testScene.getUserVisibleHintLifecycle().getCurrentState(), Lifecycle.State.CREATED);

    testScene.setUserVisibleHint(true);
    assertEquals(childScene.getState(), State.RESUMED);
    assertTrue(testScene.isVisible());
    assertTrue(testScene.getUserVisibleHint());
    assertEquals(testScene.getLifecycle().getCurrentState(), Lifecycle.State.RESUMED);
    assertEquals(testScene.getUserVisibleHintLifecycle().getCurrentState(), Lifecycle.State.RESUMED);

    sceneLifecycleManager.onPause();
    assertEquals(childScene.getState(), State.STARTED);
    assertTrue(testScene.isVisible());

    testScene.setUserVisibleHint(false);
    assertEquals(childScene.getState(), State.STARTED);
    assertFalse(testScene.isVisible());
    assertFalse(testScene.getUserVisibleHint());
    assertEquals(testScene.getLifecycle().getCurrentState(), Lifecycle.State.STARTED);
    assertEquals(testScene.getUserVisibleHintLifecycle().getCurrentState(), Lifecycle.State.CREATED);

    testScene.setUserVisibleHint(true);
    assertEquals(childScene.getState(), State.STARTED);
    assertTrue(testScene.isVisible());
    assertTrue(testScene.getUserVisibleHint());
    assertEquals(testScene.getLifecycle().getCurrentState(), Lifecycle.State.STARTED);
    assertEquals(testScene.getUserVisibleHintLifecycle().getCurrentState(), Lifecycle.State.STARTED);

    sceneLifecycleManager.onStop();
    assertEquals(childScene.getState(), State.ACTIVITY_CREATED);

    testScene.setUserVisibleHint(false);
    assertEquals(childScene.getState(), State.ACTIVITY_CREATED);
    assertFalse(testScene.isVisible());
    assertFalse(testScene.getUserVisibleHint());
    assertEquals(testScene.getLifecycle().getCurrentState(), Lifecycle.State.CREATED);
    assertEquals(testScene.getUserVisibleHintLifecycle().getCurrentState(), Lifecycle.State.CREATED);

    testScene.setUserVisibleHint(true);
    assertEquals(childScene.getState(), State.ACTIVITY_CREATED);
    assertFalse(testScene.isVisible());
    assertTrue(testScene.getUserVisibleHint());

    sceneLifecycleManager.onDestroyView();
    assertEquals(childScene.getState(), State.NONE);

    testScene.setUserVisibleHint(false);
    assertEquals(childScene.getState(), State.NONE);
    assertFalse(testScene.isVisible());
    assertFalse(testScene.getUserVisibleHint());

    testScene.setUserVisibleHint(true);
    assertEquals(childScene.getState(), State.NONE);
    assertFalse(testScene.isVisible());
    assertTrue(testScene.getUserVisibleHint());
}
 
Example 29
Source Project: v9porn   Source File: ProxySettingActivityModule.java    License: MIT License 4 votes vote down vote up
@Provides
static LifecycleProvider<Lifecycle.Event> providerLifecycleProvider(AppCompatActivity mAppCompatActivity) {
    return AndroidLifecycle.createLifecycleProvider(mAppCompatActivity);
}
 
Example 30
Source Project: scene   Source File: GroupSceneLifecycleTests.java    License: Apache License 2.0 4 votes vote down vote up
private static void checkSceneState(Scene scene, State state, boolean addedBeforeCreateViewOrAfterDestroy) {
    switch (state) {
        case NONE:
            assertEquals(scene.getState(), State.NONE);
            assertFalse(scene.isVisible());
            assertNull(scene.getView());
            assertNull(scene.getParentScene());
            assertNull(scene.getNavigationScene());
            assertNull(scene.getActivity());
            assertNull(scene.getApplicationContext());
            assertNotNull(scene.getLifecycle());

            if (addedBeforeCreateViewOrAfterDestroy) {
                assertSame(scene.getLifecycle().getCurrentState(), Lifecycle.State.INITIALIZED);
            } else {
                assertSame(scene.getLifecycle().getCurrentState(), Lifecycle.State.DESTROYED);
            }
            break;
        case VIEW_CREATED:
            assertEquals(scene.getState(), State.VIEW_CREATED);
            assertFalse(scene.isVisible());
            assertNotNull(scene.getView());
            assertSame(scene.getView().getContext().getSystemService(Scene.SCENE_SERVICE), scene);
            assertNotNull(scene.getActivity());
            assertNotNull(scene.getParentScene());
            assertNotNull(scene.getNavigationScene());
            assertNotNull(scene.getActivity());
            assertNotNull(scene.getApplicationContext());
            assertNotNull(scene.getSceneContext());
            assertNotNull(scene.getLifecycle());
            assertNotNull(scene.getResources());
            assertNotNull(scene.getScope());
            assertNotNull(scene.getLayoutInflater());
            assertNotNull(scene.getViewModelStore());
            assertEquals(scene.getLifecycle().getCurrentState(), Lifecycle.State.INITIALIZED);
            break;
        case ACTIVITY_CREATED:
            assertEquals(scene.getState(), State.ACTIVITY_CREATED);
            assertFalse(scene.isVisible());
            assertNotNull(scene.getView());
            assertSame(scene.getView().getContext().getSystemService(Scene.SCENE_SERVICE), scene);
            assertEquals(ViewUtility.findSceneByView(scene.getView()), scene);
            assertNotNull(scene.getParentScene());
            assertNotNull(scene.getNavigationScene());
            assertNotNull(scene.getActivity());
            assertNotNull(scene.getApplicationContext());
            assertNotNull(scene.getSceneContext());
            assertNotNull(scene.getLifecycle());
            assertNotNull(scene.getResources());
            assertNotNull(scene.getScope());
            assertNotNull(scene.getLayoutInflater());
            assertNotNull(scene.getViewModelStore());
            assertEquals(scene.getLifecycle().getCurrentState(), Lifecycle.State.CREATED);
            break;
        case STARTED:
            assertEquals(scene.getState(), State.STARTED);
            assertTrue(scene.isVisible());
            assertNotNull(scene.getView());
            assertSame(scene.getView().getContext().getSystemService(Scene.SCENE_SERVICE), scene);
            assertEquals(ViewUtility.findSceneByView(scene.getView()), scene);
            assertNotNull(scene.getParentScene());
            assertNotNull(scene.getNavigationScene());
            assertNotNull(scene.getActivity());
            assertNotNull(scene.getApplicationContext());
            assertNotNull(scene.getSceneContext());
            assertNotNull(scene.getLifecycle());
            assertNotNull(scene.getResources());
            assertNotNull(scene.getScope());
            assertNotNull(scene.getLayoutInflater());
            assertNotNull(scene.getViewModelStore());
            assertEquals(scene.getLifecycle().getCurrentState(), Lifecycle.State.STARTED);
            break;
        case RESUMED:
            assertEquals(scene.getState(), State.RESUMED);
            assertTrue(scene.isVisible());
            assertNotNull(scene.getView());
            assertSame(scene.getView().getContext().getSystemService(Scene.SCENE_SERVICE), scene);
            assertEquals(ViewUtility.findSceneByView(scene.getView()), scene);
            assertNotNull(scene.getParentScene());
            assertNotNull(scene.getNavigationScene());
            assertNotNull(scene.getActivity());
            assertNotNull(scene.getApplicationContext());
            assertNotNull(scene.getSceneContext());
            assertNotNull(scene.getLifecycle());
            assertNotNull(scene.getResources());
            assertNotNull(scene.getScope());
            assertNotNull(scene.getLayoutInflater());
            assertNotNull(scene.getViewModelStore());
            assertEquals(scene.getLifecycle().getCurrentState(), Lifecycle.State.RESUMED);
            break;
    }
}