March 13th, 2019
androidx.fragment:fragment-testing:1.1.0-alpha05 are released. The full list of commits included in this version can be found here.
@ContentViewannotation lookups are now cached (b/123709449)
setPrimaryNavigationFragment()with a Fragment attached to a different FragmentManager now throws an
IllegalStateExceptionrather than silently failing (aosp/904301)
FragmentActivityis now correctly marked with
- Fixed an issue where
onDismiss()could be called twice when using
February 7, 2019
androidx.fragment:fragment-ktx 1.1.0-alpha04, and
androidx.fragment:fragment-testing 1.1.0-alpha04 are released.
- Added support for the
@ContentViewclass annotation that allows you to indicate which layout XML file should be inflated as an alternative to overriding
onCreateView(). It is recommended to do view related work in
fragment-testingnow depends on
androidx.test:core-ktx1.1.0 stable (b/121209673)
- You can now use
FragmentScenarioto test Fragment hosted options menus (b/121126668)
- Added a
requireArguments()method which returns a
@NonNull Bundleor throws an
- Added a note that
getViewLifecycleOwnerLiveData()should not be overridden and will be made final in a future release. Please file a feature request if you are currently overriding this method. (aosp/880714)
- Added a note that
getViewModelStore()should not be overridden and will be made final in a future release. Please file a feature request if you are currently overriding this method. (aosp/880713)
- Fixed an issue with binary compatibility with previous releases of Fragments. (aosp/887877) (aosp/889834)
- Target fragments are correctly cleared out when you pass
- Fixed an issue where target Fragments were sometimes unavailable in or after
- DialogFragment’s onDismiss() is now called before
onDestroy(). (aosp/874133) (aosp/890734)
December 17, 2018
- Fragment now implements
BundleSavedStateRegistryOwnerand depends on the newly released SavedState library [aosp/824380]
by activityViewModelsKotlin property delegate has been added to retrieve ViewModels associated with the containing Activity [b/119050253]
by viewModelsKotlin property delegate has been expanded to take an optional lambda method for getting the
ViewModelStoreOwner, allowing you to pass in the parent Fragment or other custom
ViewModelStoreOwnerwith code such as
val viewModel: MyViewModel by viewModels(::requireParentFragment)[b/119050253]
FragmentScenarionow allows you to specify a theme such as
Theme.AppCompat[b/119054431]. This is a breaking change.
- Added a
requireView()method which returns a
@NonNull Viewor throws an
- Added a
requireParentFragment()method which returns a
@NonNull Fragmentor throws an
- Fixed IllegalStateException: Failure saving state b/120814739
- Fragments being restored from saved instance state will now always receive a non-null
- Removed Fragments no longer reuse their
Lifecycleobject if re-added [b/118880674]
December 3, 2018
- FragmentScenario’s Kotlin extensions now let you use a lambda for Fragment construction as an alternative to passing in a
- Fixed an IllegalStateException when using nested Fragments on the back stack (b/119256498)
- Fixed crash when using
- Fixed an issue where target Fragments were not accessible after the Fragment was removed (aosp/807634)
November 5, 2018
This is the first release of the
fragment-testing artifact and
FragmentScenario which is built on top of the
androidx.test:core APIs. See the Fragment testing documentation for more details.
- New FragmentScenario class for testing Fragments in isolation.
- You can now set a
FragmentManagerto control how new Fragment instances are instantiated.
- Added a new
by viewModels()Kotlin property delegate for retrieving ViewModels from a Fragment.
- Pending input events (such as clicks) are now canceled in a Fragment’s
- Significantly expanded the nullability annotations across the Fragment API surface.
- Fix an issue which caused Fragment operations to fail from within LiveData (b/77944637)
- Target Fragments cannot be accessed after a Fragment has been removed from the FragmentManager.
androidx.test:core:1.0.0-beta01instead of the correct