Java Code Examples for androidx.fragment.app.Fragment#onViewCreated()
The following examples show how to use
androidx.fragment.app.Fragment#onViewCreated() .
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 | 6 votes |
private void testBindUntilEvent(LifecycleProvider<FragmentEvent> provider) { Fragment fragment = (Fragment) provider; startFragment(fragment); TestObserver<Object> testObserver = observable.compose(provider.bindUntilEvent(STOP)).test(); fragment.onAttach(null); testObserver.assertNotComplete(); fragment.onCreate(null); testObserver.assertNotComplete(); fragment.onViewCreated(null, null); testObserver.assertNotComplete(); fragment.onStart(); testObserver.assertNotComplete(); fragment.onResume(); testObserver.assertNotComplete(); fragment.onPause(); testObserver.assertNotComplete(); fragment.onStop(); testObserver.assertComplete(); }
Example 2
Source File: RxSupportFragmentLifecycleTest.java From RxLifecycle with Apache License 2.0 | 6 votes |
private void testBindUntilEvent(LifecycleProvider<FragmentEvent> provider) { Fragment fragment = (Fragment) provider; startFragment(fragment); TestObserver<Object> testObserver = observable.compose(provider.bindUntilEvent(STOP)).test(); fragment.onAttach(null); testObserver.assertNotComplete(); fragment.onCreate(null); testObserver.assertNotComplete(); fragment.onViewCreated(null, null); testObserver.assertNotComplete(); fragment.onStart(); testObserver.assertNotComplete(); fragment.onResume(); testObserver.assertNotComplete(); fragment.onPause(); testObserver.assertNotComplete(); fragment.onStop(); testObserver.assertComplete(); }
Example 3
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 4
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 5
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 6
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(); }