summaryrefslogtreecommitdiffstats
path: root/src/com/android/dialer/calllog/CallLogAdapter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/dialer/calllog/CallLogAdapter.java')
-rwxr-xr-xsrc/com/android/dialer/calllog/CallLogAdapter.java39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index e501931eb..01b07b68f 100755
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -41,6 +41,8 @@ import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
+import android.widget.AbsListView;
+import android.widget.AbsListView.OnScrollListener;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@@ -71,7 +73,8 @@ import java.util.LinkedList;
* Adapter class to fill in data for the Call Log.
*/
public class CallLogAdapter extends GroupingListAdapter
- implements CallLogAdapterHelper.Callback, CallLogGroupBuilder.GroupCreator {
+ implements CallLogAdapterHelper.Callback, CallLogGroupBuilder.GroupCreator,
+ OnScrollListener {
private static final String TAG = CallLogAdapter.class.getSimpleName();
private static final int VOICEMAIL_TRANSCRIPTION_MAX_LINES = 10;
@@ -470,7 +473,10 @@ public class CallLogAdapter extends GroupingListAdapter
Calls.DURATION_TYPE_ACTIVE, subId, operator);
}
- mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details);
+ if (!mAdapterHelper.isBusy()) {
+ // Only update views when ListView's scroll state is not SCROLL_STATE_FLING.
+ mCallLogViewsHelper.setPhoneCallDetails(mContext, views, details);
+ }
int contactType = ContactPhotoManager.TYPE_DEFAULT;
@@ -536,10 +542,8 @@ public class CallLogAdapter extends GroupingListAdapter
* @return The day group for the call.
*/
private int getDayGroupForCall(long callId) {
- if (mDayGroups.containsKey(callId)) {
- return mDayGroups.get(callId);
- }
- return CallLogGroupBuilder.DAY_GROUP_NONE;
+ Integer result = mDayGroups.get(callId);
+ return result == null ? CallLogGroupBuilder.DAY_GROUP_NONE : result.intValue();
}
/**
* Determines if a call log row with the given Id is expanded.
@@ -1155,4 +1159,27 @@ public class CallLogAdapter extends GroupingListAdapter
DialerUtils.startActivityWithErrorToast(mContext, intent,
R.string.add_contact_not_available);
}
+
+ @Override
+ public void onScrollStateChanged(AbsListView view, int scrollState) {
+ switch (scrollState) {
+ case OnScrollListener.SCROLL_STATE_IDLE:
+ mAdapterHelper.setBusy(false);
+ dataSetChanged();
+ break;
+ case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
+ mAdapterHelper.setBusy(false);
+ break;
+ case OnScrollListener.SCROLL_STATE_FLING:
+ // Do not update views when scroll state is SCROLL_STATE_FLING
+ mAdapterHelper.setBusy(true);
+ break;
+ }
+ }
+
+ @Override
+ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
+ int totalItemCount) {
+ // no-op
+ }
}