Giter Club home page Giter Club logo

Comments (3)

smileToWxm avatar smileToWxm commented on July 22, 2024

找到解决方案了, 使用 dialogFragment、popupWindow的时候 在初始化 PanelSwitchHelper.Builder时需要添加 setWindowInsetsRootView(binding.panelSwitchLayout.getRootView()) 这句话。
原因是 PanelSwitchLayout在 注册 setOnApplyWindowInsetsListener的时候传入的rootView是
val rootView = windowInsetsRootView ?: window.decorView.rootView,而在最后 releaseKeyboardChangedListener 注销监听的时候 传入的却是 rootView(这个rootView是panelSwitchLayout本身)所以就会出现 虽然dialogFragment、popupWindow关闭了 但是监听还存在,这样回到 Activity层的时候 就会导致监听被拦截。
仅在Activity上使用不会出现这个问题,是因为 window.decorView.rootView 和 panelSwitchLayout.getRootView是同一个所以不会出现问题

from panelswitchhelper.

HeroZ-Dodge avatar HeroZ-Dodge commented on July 22, 2024

刚才review了下代码,原因应该是 Activity 和DialogFragment 在初始的时候,ViewCompat.setOnApplyWindowInsetsListener(view)传的这个view是同一个对象,导致Activity的监听被覆盖了,所以在dialogFragment初始的时候setWindowInsetsRootView,可以避免activity的监听被覆盖。

from panelswitchhelper.

HeroZ-Dodge avatar HeroZ-Dodge commented on July 22, 2024

最后在 ViewCompat.setOnApplyWindowInsetsListener(rootView, null) 释放监听的时候,这里不够严谨,应该改成

            val rootView = windowInsetsRootView ?: window.decorView.rootView
            ViewCompat.setOnApplyWindowInsetsListener(rootView, null)

会更合理些
感谢提出的反馈

from panelswitchhelper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.