InstaMaterial icon indicating copy to clipboard operation
InstaMaterial copied to clipboard

hide FeedContextMenu when click outside of FeedContextMenu

Open xu6148152 opened this issue 9 years ago • 1 comments

xu6148152 avatar Mar 15 '15 11:03 xu6148152

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();
}

Farasy avatar Nov 20 '18 00:11 Farasy