Skip to content

Commit 7ba1f78

Browse files
committed
Removed all ViewTreeObserver.OnGlobalLayoutListener on dismiss to prevent NullPointerException #11
1 parent 82baa9e commit 7ba1f78

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/src/main/java/io/github/douglasjunior/androidSimpleTooltip/SimpleTooltip.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,14 @@ public void onDismiss() {
310310
if (mOnDismissListener != null)
311311
mOnDismissListener.onDismiss(this);
312312
mOnDismissListener = null;
313+
314+
SimpleTooltipUtils.removeOnGlobalLayoutListener(mPopupWindow.getContentView(), mLocationLayoutListener);
315+
SimpleTooltipUtils.removeOnGlobalLayoutListener(mPopupWindow.getContentView(), mArrowLayoutListener);
316+
SimpleTooltipUtils.removeOnGlobalLayoutListener(mPopupWindow.getContentView(), mShowLayoutListener);
317+
SimpleTooltipUtils.removeOnGlobalLayoutListener(mPopupWindow.getContentView(), mAnimationLayoutListener);
318+
SimpleTooltipUtils.removeOnGlobalLayoutListener(mPopupWindow.getContentView(), mAutoDismissLayoutListener);
319+
320+
mPopupWindow = null;
313321
}
314322

315323
private final View.OnTouchListener mPopupWindowTouchListener = new View.OnTouchListener() {

0 commit comments

Comments
 (0)