Java Code Examples for androidx.fragment.app.fragment#onDetach()
The following examples show how to use
androidx.fragment.app.fragment#onDetach() .
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 File: RxPreferenceFragmentLifecycleTest.java From RxLifecycle with Apache License 2.0 | 5 votes |
private void testLifecycle(LifecycleProvider<FragmentEvent> provider) { Fragment fragment = (Fragment) provider; startFragment(fragment); TestObserver<FragmentEvent> testObserver = provider.lifecycle().skip(1).test(); fragment.onAttach(null); fragment.onCreate(null); fragment.onViewCreated(null, null); fragment.onStart(); fragment.onResume(); fragment.onPause(); fragment.onStop(); fragment.onDestroyView(); fragment.onDestroy(); fragment.onDetach(); testObserver.assertValues( FragmentEvent.ATTACH, FragmentEvent.CREATE, FragmentEvent.CREATE_VIEW, FragmentEvent.START, FragmentEvent.RESUME, FragmentEvent.PAUSE, FragmentEvent.STOP, FragmentEvent.DESTROY_VIEW, FragmentEvent.DESTROY, FragmentEvent.DETACH ); }
Example 2
Source File: RxSupportFragmentLifecycleTest.java From RxLifecycle with Apache License 2.0 | 5 votes |
private void testLifecycle(LifecycleProvider<FragmentEvent> provider) { Fragment fragment = (Fragment) provider; startFragment(fragment); TestObserver<FragmentEvent> testObserver = provider.lifecycle().skip(1).test(); fragment.onAttach(null); fragment.onCreate(null); fragment.onViewCreated(null, null); fragment.onStart(); fragment.onResume(); fragment.onPause(); fragment.onStop(); fragment.onDestroyView(); fragment.onDestroy(); fragment.onDetach(); testObserver.assertValues( FragmentEvent.ATTACH, FragmentEvent.CREATE, FragmentEvent.CREATE_VIEW, FragmentEvent.START, FragmentEvent.RESUME, FragmentEvent.PAUSE, FragmentEvent.STOP, FragmentEvent.DESTROY_VIEW, FragmentEvent.DESTROY, FragmentEvent.DETACH ); }
Example 3
Source File: RxPreferenceFragmentLifecycleTest.java From RxLifecycle with Apache License 2.0 | 4 votes |
private void testBindToLifecycle(LifecycleProvider<FragmentEvent> provider) { Fragment fragment = (Fragment) provider; startFragment(fragment); fragment.onAttach(null); TestObserver<Object> attachObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onCreate(null); attachObserver.assertNotComplete(); TestObserver<Object> createObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onViewCreated(null, null); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); TestObserver<Object> createViewObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onStart(); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); createViewObserver.assertNotComplete(); TestObserver<Object> startObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onResume(); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); createViewObserver.assertNotComplete(); startObserver.assertNotComplete(); TestObserver<Object> resumeObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onPause(); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); createViewObserver.assertNotComplete(); startObserver.assertNotComplete(); resumeObserver.assertComplete(); TestObserver<Object> pauseObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onStop(); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); createViewObserver.assertNotComplete(); startObserver.assertComplete(); pauseObserver.assertComplete(); TestObserver<Object> stopObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onDestroyView(); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); createViewObserver.assertComplete(); stopObserver.assertComplete(); TestObserver<Object> destroyViewObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onDestroy(); attachObserver.assertNotComplete(); createObserver.assertComplete(); destroyViewObserver.assertComplete(); TestObserver<Object> destroyObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onDetach(); attachObserver.assertComplete(); destroyObserver.assertComplete(); }
Example 4
Source File: RxSupportFragmentLifecycleTest.java From RxLifecycle with Apache License 2.0 | 4 votes |
private void testBindToLifecycle(LifecycleProvider<FragmentEvent> provider) { Fragment fragment = (Fragment) provider; startFragment(fragment); fragment.onAttach(null); TestObserver<Object> attachObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onCreate(null); attachObserver.assertNotComplete(); TestObserver<Object> createObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onViewCreated(null, null); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); TestObserver<Object> createViewObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onStart(); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); createViewObserver.assertNotComplete(); TestObserver<Object> startObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onResume(); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); createViewObserver.assertNotComplete(); startObserver.assertNotComplete(); TestObserver<Object> resumeObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onPause(); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); createViewObserver.assertNotComplete(); startObserver.assertNotComplete(); resumeObserver.assertComplete(); TestObserver<Object> pauseObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onStop(); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); createViewObserver.assertNotComplete(); startObserver.assertComplete(); pauseObserver.assertComplete(); TestObserver<Object> stopObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onDestroyView(); attachObserver.assertNotComplete(); createObserver.assertNotComplete(); createViewObserver.assertComplete(); stopObserver.assertComplete(); TestObserver<Object> destroyViewObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onDestroy(); attachObserver.assertNotComplete(); createObserver.assertComplete(); destroyViewObserver.assertComplete(); TestObserver<Object> destroyObserver = observable.compose(provider.bindToLifecycle()).test(); fragment.onDetach(); attachObserver.assertComplete(); destroyObserver.assertComplete(); }