Detect 'home button pressed' event in android service displaying a UI (similar to facebook chatheads)

前端 未结 8 1277
暗喜
暗喜 2020-12-13 09:35

In facebook chatheads, that are part of the facebook messenger app, I noticed the following behavior: As far as I can see, the chat head itself and the opened chat screen ar

8条回答
  •  长情又很酷
    2020-12-13 10:14

    well after doing my own research about that issue, I've came with the following conclusions:

    Facebook "intercepting" the navigation buttons by providing the flag TYPE_SYSTEM_OVERLAY attribute. look on this post answer provided by @jawsware

    doing what he advices not to do - will lead to the "affect" of controling the navigation buttons

    using this flag provides focus on your overlay, and takes the focus from the activity behind.

    with the onFocusChangedListener view callback or the OnKey listener they reacts to it with closing the full screen mode of the overlay.

    that's also explains how they reacts to it from the 3 navigation buttons - home / back / recent tasks

提交回复
热议问题