When using a TouchInterceptor with PopupWindow, how to determine what View was touched?

72 views Asked by At
  pw.setTouchInterceptor(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
                        main.dispatchTouchEvent(event);
                        pw.dismiss();
                        return true;
                    }

                    return false;
                }
            });

pw is the PopupWindow.

I'm using a touchInterceptor to detect clicks outside of a popupWindow to handle them appropriately. That's all working fine. My issue is when the button that launched the popupwindow is clicked again, the popupWindow is dismissed and then comes back. I'd like to maintain the functionality I have now, to still use buttons not in the popupwindow even when the popupWindow is showing, but ignore clicks from one specific button. I've tried everything I can think of to determine if the view I get from onTouch is the view I want to ingore.

0

There are 0 answers