Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash using tooltip in adapter #93

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,15 @@ void removeFromParent() {
mPopup.dismiss();
mPopup = null;
} else {
((ViewGroup) parent).removeView(TooltipViewImpl.this);
ViewGroup parentViewGroup = (ViewGroup) parent;

// If layout is requested we should delay removing the view to avoid parent
// onLayout crash
if (parentViewGroup.isLayoutRequested()) {
postRemoveFromParentNow(parentViewGroup);
} else {
removeFromParentNow(parentViewGroup);
}
}
if (null != mShowAnimation && mShowAnimation.isStarted()) {
mShowAnimation.cancel();
Expand All @@ -618,6 +626,19 @@ private void removeCallbacks() {
mHandler.removeCallbacks(activateRunnable);
}

private void postRemoveFromParentNow(final ViewGroup parent) {
post(new Runnable() {
@Override
public void run() {
removeFromParentNow(parent);
}
});
}

private void removeFromParentNow(ViewGroup parent) {
parent.removeView(TooltipViewImpl.this);
}

@Override
public void remove() {
log(TAG, INFO, "[%d] remove()", mToolTipId);
Expand Down