Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DraggableFlowWindow.dismiss() StackOverflow. #2

Open
lhr2528 opened this issue Jul 28, 2018 · 2 comments
Open

DraggableFlowWindow.dismiss() StackOverflow. #2

lhr2528 opened this issue Jul 28, 2018 · 2 comments

Comments

@lhr2528
Copy link

lhr2528 commented Jul 28, 2018

The singleton class DraggableFloatWindow 's dismiss() method is recursive.
Suggest to replace DraggableFloatWindow.java line 63 mWindowManager.dismiss(); with "mWindowManager.removeView(mDraggableFloatView); to hide the floating window.

Let me know if we can have a pull request to fix this.

Thank you.

@YoungBill
Copy link
Owner

So sorry, I just saw this issue, thank you for your reminder, I found the dismiss method, forgot to implement, I think it can be implemented according to what you said, I will add the dismiss button in GetFloatWindowFreePositionActivity, then you can implement it in Submit, thank you

@happyHou
Copy link

/**
 * attach floatView to window
 */
private  void attachFloatViewToWindow() {
    showState =true;
    if (mDraggableFloatView == null)
        throw new IllegalStateException("DraggableFloatView can not be null");
    if (mParams == null)
        throw new IllegalStateException("WindowManager.LayoutParams can not be null");
    try {
        mWindowManager.updateViewLayout(mDraggableFloatView, mParams);
    } catch (IllegalArgumentException e) {
        Log.e(TAG, e.getMessage());
        //if floatView not attached to window,addView
        mWindowManager.addView(mDraggableFloatView, mParams);
    }
}

/**
 * detach floatView from window
 */
private  void detachFloatViewFromWindow() {
    // TODO: 18-7-30 @lhr2528 you can fix issue 2 here
    if (showState) {
        mWindowManager.removeView(mDraggableFloatView);
        showState =false;
    }
}

public boolean isShowing(){
    return showState;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants