Fixed
Status Update
Comments
su...@gmail.com <su...@gmail.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit cb3b96b2858feed4b2289b7281aff9d1b7831aba
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Wed Mar 03 23:36:49 2021
[GH] [FragmentStrictMode] Detect calls to Fragment#setUserVisibleHint
## Proposed Changes
- Detect calls to `Fragment#setUserVisibleHint`
## Testing
Test: See `FragmentStrictModeTest#detectSetUserVisibleHint`
## Issues Fixed
Fixes: 153738974
This is an imported pull request fromhttps://github.com/androidx/androidx/pull/136 .
Resolves #136
Github-Pr-Head-Sha: 0e253b7d7f9fc6e5cfe850a339605865c7f38384
GitOrigin-RevId: 5695bed064b7d0d34bf92ae57627fc0a2a709ae6
Change-Id: I17aaf805a09827c5ffeb888ded3fbb99560c49f3
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/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentStrictMode.java
A fragment/fragment/src/main/java/androidx/fragment/app/strictmode/SetUserVisibleHintViolation.java
https://android-review.googlesource.com/1616690
Branch: androidx-main
commit cb3b96b2858feed4b2289b7281aff9d1b7831aba
Author: Simon Schiller <simonschiller@users.noreply.github.com>
Date: Wed Mar 03 23:36:49 2021
[GH] [FragmentStrictMode] Detect calls to Fragment#setUserVisibleHint
## Proposed Changes
- Detect calls to `Fragment#setUserVisibleHint`
## Testing
Test: See `FragmentStrictModeTest#detectSetUserVisibleHint`
## Issues Fixed
Fixes: 153738974
This is an imported pull request from
Resolves #136
Github-Pr-Head-Sha: 0e253b7d7f9fc6e5cfe850a339605865c7f38384
GitOrigin-RevId: 5695bed064b7d0d34bf92ae57627fc0a2a709ae6
Change-Id: I17aaf805a09827c5ffeb888ded3fbb99560c49f3
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/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/strictmode/FragmentStrictMode.java
A fragment/fragment/src/main/java/androidx/fragment/app/strictmode/SetUserVisibleHintViolation.java
su...@gmail.com <su...@gmail.com> #3
Hey, any help on how can I proceed forward.?
il...@google.com <il...@google.com> #4
Re #2,3 - We've just published our
Fragment have some existing lint checks in their fragment-lint
project, so some of the steps are already taken care of for you (and the existing Lint checks are a good place to look for code examples and testing strategies).
Thanks for offering to help!
jb...@google.com <jb...@google.com> #6
Thank you for the pull request! This has been added internally and will be a part of the next Fragment alpha release.
a....@gmail.com <a....@gmail.com> #7
I know the ticket is closed but ..
if you call getLayoutInflater from onCreate method (not onCreateDialog) you may have a crash.
because getLayoutInflator goes to onGetLayoutInflater and then it can go to onCreateDialog (even though the entry point is onCreate dialog)
if you call getLayoutInflater from onCreate method (not onCreateDialog) you may have a crash.
because getLayoutInflator goes to onGetLayoutInflater and then it can go to onCreateDialog (even though the entry point is onCreate dialog)
Description
When using a method from
DialogFragment
, if you want to get aLayoutInflater
, you should always call thegetLayoutInflater()
Fragment
.Using can return a
LayoutInflater.from(Context)
LayoutInflater
that does not have the correct theme.It would be nice if there was a lint rule, that caught all calls to
LayoutInflater.from(Context)
and suggested to usegetLayoutInflater()
instead.