Feature to listen on window focus events#25039
Conversation
analysis-bot
left a comment
There was a problem hiding this comment.
Code analysis results:
eslintfound some issues. Runyarn lint --fixto automatically fix problems.
522c8a2 to
0d7502f
Compare
| mWindowFocusEventListeners.add(listener); | ||
| } | ||
|
|
||
| public void removeWindowFocusChangeListener(WindowFocusChangeListener listener) { |
There was a problem hiding this comment.
removeWindowFocusChangeListener is never invoked
There was a problem hiding this comment.
That's right, I left it there in case I've missed a place where I should remove all listeners
|
can this be exposed as an onfocus and onblur event, to match web? |
|
@matthargett Do you mean to have two separate events? |
|
@krizzu yes, let's mirror web. |
|
@cpojer @matthargett yup, done! |
cpojer
left a comment
There was a problem hiding this comment.
Thanks! The events should be called focus and blur, without the on part though. Could you make that change?
cpojer
left a comment
There was a problem hiding this comment.
Oops, meant to request changes.
3c273f6 to
17c6cec
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
This pull request was successfully merged by @krizzu in d45818f. When will my fix make it into a release? | Upcoming Releases |
Summary: Addressed issue: facebook#24149 On Android, activity's lifecycle events are not triggered when the user pulls down the Status Bar (opening Notification Drawer). In order to know that, you need to override [onWindowFocusChanged method](https://developer.android.com/reference/android/app/Activity.html#onWindowFocusChanged(boolean)). ## Changelog [Android] [Added] - Adds a new listener for `onWindowFocusChanged` [JavaScript] [Added] - New event, `focusChanged`, to listen on focus gain/loss Pull Request resolved: facebook#25039 Differential Revision: D15644954 Pulled By: cpojer fbshipit-source-id: 823acffc4287bec4bf56e9f5ffcac65c01cf13d3
Summary
Addressed issue: #24149
On Android, activity's lifecycle events are not triggered when the user pulls down the Status Bar (opening Notification Drawer). In order to know that, you need to override onWindowFocusChanged method.
Changelog
[Android] [Added] - Adds a new listener for
onWindowFocusChanged[JavaScript] [Added] - New event,
focusChanged, to listen on focus gain/lossTest Plan