summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-09-22 19:30:24 -0700
committerYorke Lee <yorkelee@google.com>2014-09-22 19:30:24 -0700
commit0a3c7a196fe7fa0622b59b62e46ba10cbfe2968a (patch)
tree3204d4df2c58825338a3e995d19dd636759e70d0
parentf2d3bd5d0fc9fd8e28f440fce7489691e0aee46b (diff)
Add null check when auto-scrolling listView
Bug: 17609944 Change-Id: Icb14a0539ee3e57ddfc8e237e440b4563fccabf5
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 2f0ee5370..e5c3c58a5 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -601,7 +601,7 @@ public class CallLogFragment extends AnalyticsListFragment
view.getLocalVisibleRect(localVisibleRect);
final int scrollingNeeded = localVisibleRect.top > 0 ? -localVisibleRect.top
: view.getMeasuredHeight() - localVisibleRect.height();
-
+ final ListView listView = getListView();
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
private int mCurrentScroll = 0;
@@ -618,9 +618,11 @@ public class CallLogFragment extends AnalyticsListFragment
view.requestLayout();
if (isExpand) {
- int scrollBy = (int) (value * scrollingNeeded) - mCurrentScroll;
- getListView().smoothScrollBy(scrollBy, /* duration = */ 0);
- mCurrentScroll += scrollBy;
+ if (listView != null) {
+ int scrollBy = (int) (value * scrollingNeeded) - mCurrentScroll;
+ listView.smoothScrollBy(scrollBy, /* duration = */ 0);
+ mCurrentScroll += scrollBy;
+ }
}
}
});