public void testAddOnComputeInternalInsetsListener() { final ListView lv1 = (ListView) mActivity.findViewById(R.id.listview1); mViewTreeObserver = lv1.getViewTreeObserver(); MockOnComputeInternalInsetsListener listener = new MockOnComputeInternalInsetsListener(); mViewTreeObserver.addOnComputeInternalInsetsListener(listener); }
/** * Make the touchable area of this popup be the area specified by mTouchableRegion. This should * be called after the popup window has been dismissed (dismiss/hide) and is probably being * re-shown with a new content root view. */ private void setTouchableSurfaceInsetsComputer() { ViewTreeObserver viewTreeObserver = mPopupWindow.getContentView().getRootView().getViewTreeObserver(); viewTreeObserver.removeOnComputeInternalInsetsListener(mInsetsComputer); viewTreeObserver.addOnComputeInternalInsetsListener(mInsetsComputer); }