Fragmentation icon indicating copy to clipboard operation
Fragmentation copied to clipboard

enqueueDispatchVisible方法里的queueIdle回调不走

Open xupengku123 opened this issue 1 year ago • 0 comments

我看了一下原作者的代码

private void enqueueDispatchVisible() {
        taskDispatchSupportVisible = new Runnable() {
            @Override
            public void run() {
                taskDispatchSupportVisible = null;
                dispatchSupportVisible(true);
            }
        };
        getHandler().post(taskDispatchSupportVisible);
    }

这里是直接post了一条任务 你的这个方法是这样的

private void enqueueDispatchVisible() {

       mIdleDispatchSupportVisible = new MessageQueue.IdleHandler() {
           @Override
           public boolean queueIdle() {
               dispatchSupportVisible(true);
               mIdleDispatchSupportVisible = null;
               return false;
           }
       };
    Looper.myQueue().addIdleHandler(mIdleDispatchSupportVisible);

}

是用空闲任务去调用dispatchSupportVisible,但是有时候不走回调导致我的fragment生命周期的onSupportVisible不执行,请问我要怎么处理

xupengku123 avatar May 19 '23 08:05 xupengku123