From 7f78e9a692d7d7ca1f1204421adce91545a880f8 Mon Sep 17 00:00:00 2001 From: yueg Date: Tue, 12 Sep 2017 11:10:45 -0700 Subject: Log swiping and clicking for switching tabs. If it's a swipe, onPageScrolled() is called several times before onPageScrollStateChanged(SCROLL_STATE_SETTLING) and onPageSelected(). If it's a click, only onPageScrollStateChanged(SCROLL_STATE_SETTLING) is called before onPageSelected(). And onPageScrollStateChanged(SCROLL_STATE_SETTLING) will not be called if user don't switch to a new tab. We use the difference to tell if user switching tabs by swiping or clicking. Test: DialtactsActivityTest PiperOrigin-RevId: 168403148 Change-Id: Iaaf84ab9c4955d0bc2c1e9857ba59fd37b3984af --- .../com/android/dialer/contactsfragment/ContactsAdapter.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'java/com/android/dialer/contactsfragment') diff --git a/java/com/android/dialer/contactsfragment/ContactsAdapter.java b/java/com/android/dialer/contactsfragment/ContactsAdapter.java index 13895313f..481574e0c 100644 --- a/java/com/android/dialer/contactsfragment/ContactsAdapter.java +++ b/java/com/android/dialer/contactsfragment/ContactsAdapter.java @@ -27,6 +27,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.android.dialer.common.Assert; +import com.android.dialer.common.LogUtil; import com.android.dialer.contactphoto.ContactPhotoManager; import com.android.dialer.contactsfragment.ContactsFragment.ClickAction; import com.android.dialer.contactsfragment.ContactsFragment.Header; @@ -66,6 +67,17 @@ final class ContactsAdapter extends RecyclerView.Adapter