Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 57ca221882695bd6a52549f4d9ea3b812e6fe87c
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Mon Mar 22 16:09:30 2021
[GH] [FragmentStrictMode] Detect <fragment> tag usage
## Proposed Changes
- Detect `<fragment>` tag usage inside XML layouts
## Testing
Test: See `FragmentStrictModeTest#detectFragmentTagUsage`
## Issues Fixed
Fixes: 153738235
This is an imported pull request fromhttps://github.com/androidx/androidx/pull/141 .
Resolves #141
Github-Pr-Head-Sha: 4ea052596e4341b9f11bcf335e2bc38045a91f19
GitOrigin-RevId: 62e7487aa4874eef6bb556490e193717cf937251
Change-Id: Iae48578e85e4e4897f806d7ade2e2a660adf9479
M fragment/fragment/api/public_plus_experimental_current.txt
M fragment/fragment/api/restricted_current.txt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentLayoutInflaterFactory.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentStrictMode.java
A fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentTagUsageViolation.java
https://android-review.googlesource.com/1649748
Branch: androidx-main
commit 57ca221882695bd6a52549f4d9ea3b812e6fe87c
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Mon Mar 22 16:09:30 2021
[GH] [FragmentStrictMode] Detect <fragment> tag usage
## Proposed Changes
- Detect `<fragment>` tag usage inside XML layouts
## Testing
Test: See `FragmentStrictModeTest#detectFragmentTagUsage`
## Issues Fixed
Fixes: 153738235
This is an imported pull request from
Resolves #141
Github-Pr-Head-Sha: 4ea052596e4341b9f11bcf335e2bc38045a91f19
GitOrigin-RevId: 62e7487aa4874eef6bb556490e193717cf937251
Change-Id: Iae48578e85e4e4897f806d7ade2e2a660adf9479
M fragment/fragment/api/public_plus_experimental_current.txt
M fragment/fragment/api/restricted_current.txt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/strictmode/FragmentStrictModeTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentLayoutInflaterFactory.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentStrictMode.java
A fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentTagUsageViolation.java
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit b72c198ba05378b4fe1e739c8992f850312742dd
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Apr 14 16:56:41 2021
Look at DialogFragment inflated layout before the dialog's
When using something like a BottomSheetDialog, because it reuses ids for
its child view, the dialog's view will be consider as the container
instead of the actual inflated container. To fix this, we should just
look at the inflated layout first.
RelNote: "You can now add fragment to `BottomSheetDialogFragment`s and
they will have a properly nested view hierarchy."
Test: DialogFragmentTest
Bug: 180021387
Change-Id: Ie62791677cb8771f22b19bdce5985426c669fba0
M fragment/fragment/src/androidTest/java/androidx/fragment/app/DialogFragmentTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/DialogFragment.java
https://android-review.googlesource.com/1676082
Branch: androidx-main
commit b72c198ba05378b4fe1e739c8992f850312742dd
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Apr 14 16:56:41 2021
Look at DialogFragment inflated layout before the dialog's
When using something like a BottomSheetDialog, because it reuses ids for
its child view, the dialog's view will be consider as the container
instead of the actual inflated container. To fix this, we should just
look at the inflated layout first.
RelNote: "You can now add fragment to `BottomSheetDialogFragment`s and
they will have a properly nested view hierarchy."
Test: DialogFragmentTest
Bug: 180021387
Change-Id: Ie62791677cb8771f22b19bdce5985426c669fba0
M fragment/fragment/src/androidTest/java/androidx/fragment/app/DialogFragmentTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/DialogFragment.java
jb...@google.com <jb...@google.com> #4
This has been fixed internally and will be available in the Fragment 1.3.3
release.
Description
Component used: Fragment Version used: 1.3.0 Devices/Android versions reproduced on: Any
Occurs when we use BottomSheetDialogFragment after updating androidx.fragment:fragment from 1.2.5 to 1.3.0.
Steps to reproduce:
container
container
Expected: A child fragment is added into our container specified in the layout. Actual result: A child fragment added into the container used for CoordinatorLayout.Expected view hierarchy (1.2.5):
Actual view hierarchy (1.3.0):
It seems that it happens because in 1.3.0 a code for finding the right container to use for fragment transaction was changed. A new implementation for DialogFragment is looking for the container starting from the top of hierarchy (DecorView):
At the same time it's different for Fragment:
The only workaround we found is to use a different id for our container, anything but
container
. But this doesn't seem appropriate as we could have a ton of BottomSheets in the project and this kind of id clashing is resolved very well in ordinary fragments.