Skip to content

hide FeedContextMenu when click outside of FeedContextMenu#8

Open
xu6148152 wants to merge 1 commit intofrogermcs:masterfrom
xu6148152:master
Open

hide FeedContextMenu when click outside of FeedContextMenu#8
xu6148152 wants to merge 1 commit intofrogermcs:masterfrom
xu6148152:master

Conversation

@xu6148152
Copy link
Copy Markdown

No description provided.

@Farasy
Copy link
Copy Markdown

Farasy commented Nov 20, 2018

For completeness:

public void hideContextMenu(MotionEvent ev) {
    if(contextMenuView == null)
        return;

    int[] contentLocation = new int[2];
    contextMenuView.getLocationOnScreen(contentLocation);
    Rect rect = new Rect(contentLocation[0],
            contentLocation[1],
            contentLocation[0] + contextMenuView.getWidth(),
            contentLocation[1] + contextMenuView.getHeight());

    if (!(rect.contains((int) ev.getX(), (int) ev.getY())))
        hideContextMenu();
}

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

Successfully merging this pull request may close these issues.

3 participants