diff options
author | Yorke Lee <yorkelee@google.com> | 2015-04-20 16:02:46 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-04-20 16:03:29 -0700 |
commit | 41ddbe19ea116ce45c1cd91d8c0584a16f13ba84 (patch) | |
tree | 6b5c9873513fedf2503e8a6f095cfcac33cce654 | |
parent | 577200257eb759075888eae000214f4c9f5cb035 (diff) |
Make sure to correctly remove onPreDrawListener
Bug: 20421404
Change-Id: Icc8b4a74ea17e969577dbaaa794b85a2e66ef8df
-rw-r--r-- | src/com/android/dialer/calllog/CallLogListItemViewHolder.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java index 4b208f14a..365290077 100644 --- a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java +++ b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java @@ -347,9 +347,11 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder { observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { - if (observer.isAlive()) { - observer.removeOnPreDrawListener(this); + ViewTreeObserver vto = observer; + if (!vto.isAlive()) { + vto = actionsView.getViewTreeObserver(); } + vto.removeOnPreDrawListener(this); // TODO: Animate, instead of immediately resizing. int currentHeight = primaryActionView.getHeight(); |