Loading src/com/android/dialer/calllog/CallLogAdapter.java +33 −6 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -470,7 +473,10 @@ public class CallLogAdapter extends GroupingListAdapter Calls.DURATION_TYPE_ACTIVE, subId, operator); } 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; Loading Loading @@ -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. Loading Loading @@ -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 } } src/com/android/dialer/calllog/CallLogAdapterHelper.java +13 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,9 @@ public class CallLogAdapterHelper implements ViewTreeObserver.OnPreDrawListener // Check if thread is finished, and if so return immediately. if (mDone) return; // only update contact info when scroll state is not fling. if (mBusy) continue; // Obtain next request, if any is available. // Keep synchronized section small. ContactInfoRequest req = null; Loading Loading @@ -201,6 +204,8 @@ public class CallLogAdapterHelper implements ViewTreeObserver.OnPreDrawListener /** Can be set to true by tests to disable processing of requests. */ private volatile boolean mRequestProcessingDisabled = false; private boolean mBusy; /** * List of requests to update contact details. * <p> Loading Loading @@ -228,6 +233,14 @@ public class CallLogAdapterHelper implements ViewTreeObserver.OnPreDrawListener } }; public void setBusy(boolean isBusy) { mBusy = isBusy; } public boolean isBusy(){ return mBusy; } /** * Enqueues a request to look up the contact details for the given phone number. * <p> Loading src/com/android/dialer/calllog/CallLogFragment.java +1 −0 Original line number Diff line number Diff line Loading @@ -312,6 +312,7 @@ public class CallLogFragment extends AnalyticsListFragment public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); getListView().setEmptyView(view.findViewById(R.id.empty_list_view)); getListView().setOnScrollListener(mAdapter); getListView().setItemsCanFocus(true); maybeAddFooterView(); Loading Loading
src/com/android/dialer/calllog/CallLogAdapter.java +33 −6 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -470,7 +473,10 @@ public class CallLogAdapter extends GroupingListAdapter Calls.DURATION_TYPE_ACTIVE, subId, operator); } 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; Loading Loading @@ -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. Loading Loading @@ -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 } }
src/com/android/dialer/calllog/CallLogAdapterHelper.java +13 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,9 @@ public class CallLogAdapterHelper implements ViewTreeObserver.OnPreDrawListener // Check if thread is finished, and if so return immediately. if (mDone) return; // only update contact info when scroll state is not fling. if (mBusy) continue; // Obtain next request, if any is available. // Keep synchronized section small. ContactInfoRequest req = null; Loading Loading @@ -201,6 +204,8 @@ public class CallLogAdapterHelper implements ViewTreeObserver.OnPreDrawListener /** Can be set to true by tests to disable processing of requests. */ private volatile boolean mRequestProcessingDisabled = false; private boolean mBusy; /** * List of requests to update contact details. * <p> Loading Loading @@ -228,6 +233,14 @@ public class CallLogAdapterHelper implements ViewTreeObserver.OnPreDrawListener } }; public void setBusy(boolean isBusy) { mBusy = isBusy; } public boolean isBusy(){ return mBusy; } /** * Enqueues a request to look up the contact details for the given phone number. * <p> Loading
src/com/android/dialer/calllog/CallLogFragment.java +1 −0 Original line number Diff line number Diff line Loading @@ -312,6 +312,7 @@ public class CallLogFragment extends AnalyticsListFragment public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); getListView().setEmptyView(view.findViewById(R.id.empty_list_view)); getListView().setOnScrollListener(mAdapter); getListView().setItemsCanFocus(true); maybeAddFooterView(); Loading