Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 87f4c988b713e43deef88a0df6a31c507f11b4a8
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed May 27 11:20:32 2020
Use setMaxLifecycle for FragmentScenario moveToState
Current FragmentScenario uses ActivityScenario to for the moveToState
method. That means moving to STARTED does not work prior to API 23. This
also means that tests including DialogFragment cannot be moved to
CREATED, only ACTIVITY_CREATED.
This change uses setMaxLifecycle instead, so that FragmentScenario is
decoupled from ActivityScenario and there are no longer any restrictions
on moving to API 23 and DialogFragment's can be properly moved to
CREATED.
Test: ran tests on API 21 device and they passed
Bug: 156527405
Change-Id: I63d5facfcce9875acf06e39029686cb535cc3ea6
M fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioDialogFragmentTest.kt
M fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioTest.kt
M fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.java
https://android-review.googlesource.com/1318600
Branch: androidx-master-dev
commit 87f4c988b713e43deef88a0df6a31c507f11b4a8
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed May 27 11:20:32 2020
Use setMaxLifecycle for FragmentScenario moveToState
Current FragmentScenario uses ActivityScenario to for the moveToState
method. That means moving to STARTED does not work prior to API 23. This
also means that tests including DialogFragment cannot be moved to
CREATED, only ACTIVITY_CREATED.
This change uses setMaxLifecycle instead, so that FragmentScenario is
decoupled from ActivityScenario and there are no longer any restrictions
on moving to API 23 and DialogFragment's can be properly moved to
CREATED.
Test: ran tests on API 21 device and they passed
Bug: 156527405
Change-Id: I63d5facfcce9875acf06e39029686cb535cc3ea6
M fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioDialogFragmentTest.kt
M fragment/fragment-testing/src/androidTest/java/androidx/fragment/app/testing/FragmentScenarioTest.kt
M fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.java
il...@google.com <il...@google.com> #3
This has been fixed internally and will be available in Fragment 1.3.0-alpha07
.
Description
Component used: Fragment Version used: 1.3.0-alpha04
FragmentScenario's
moveToState()
calls through toActivityScenario
'smoveToState()
, which means it is not possible to move to theSTARTED
case prior to API 23 and strongly couples the Fragment to the underlying Activity's state.It would be nice if for its implementation of
FragmentScenario
could be entirely decoupled from changes in the Activity's state by usingsetMaxLifecycle()
moveToState()
.