diff options
author | Yorke Lee <yorkelee@google.com> | 2014-11-04 10:29:32 -0800 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-11-05 15:28:52 -0800 |
commit | 7ee5c422e36cf3d40cbd24bbb5b87754b4820d02 (patch) | |
tree | faba7aa255fc2dee3e09b440eefc8d5991ec68d1 /src/com/android/dialer/list/ListsFragment.java | |
parent | bd421b68ec17cd33ee3dd1d2613f5637299e57d9 (diff) |
Improve Dialer analytics
* Send screen view for first fragment loaded inside ListsFragment
* Send screen view for voicemail playback fragment
* Send screen view for currently active fragment when activity is restarted
* Don't send spurious screen views on rotation
* Send screen views for call log fragments in call log activity, and
differentiate between them with a tag
Bug: 18158037
Change-Id: I09fda53db33f6a6acc4a3b477de992aa94921c71
Diffstat (limited to 'src/com/android/dialer/list/ListsFragment.java')
-rw-r--r-- | src/com/android/dialer/list/ListsFragment.java | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/src/com/android/dialer/list/ListsFragment.java b/src/com/android/dialer/list/ListsFragment.java index 916c0346b..408d5b1f1 100644 --- a/src/com/android/dialer/list/ListsFragment.java +++ b/src/com/android/dialer/list/ListsFragment.java @@ -248,11 +248,6 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste } @Override - public void onStart() { - super.onStart(); - } - - @Override public void onResume() { super.onResume(); final SharedPreferences prefs = getActivity().getSharedPreferences( @@ -261,6 +256,9 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste mActionBar = getActivity().getActionBar(); fetchCalls(); mCallLogAdapter.setLoading(true); + if (getUserVisibleHint()) { + sendScreenViewForPosition(mViewPager.getCurrentItem()); + } } @Override @@ -359,17 +357,11 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste @Override public void onPageSelected(int position) { - if (position == TAB_INDEX_SPEED_DIAL && mSpeedDialFragment != null) { - AnalyticsUtil.sendScreenView(mSpeedDialFragment); - } else if (position == TAB_INDEX_RECENTS && mRecentsFragment != null) { - AnalyticsUtil.sendScreenView(mRecentsFragment); - } else if (position == TAB_INDEX_ALL_CONTACTS && mAllContactsFragment != null) { - AnalyticsUtil.sendScreenView(mAllContactsFragment); - } final int count = mOnPageChangeListeners.size(); for (int i = 0; i < count; i++) { mOnPageChangeListeners.get(i).onPageSelected(position); } + sendScreenViewForPosition(position); } @Override @@ -430,4 +422,29 @@ public class ListsFragment extends Fragment implements CallLogQueryHandler.Liste } return position; } + + public void sendScreenViewForCurrentPosition() { + sendScreenViewForPosition(mViewPager.getCurrentItem()); + } + + private void sendScreenViewForPosition(int position) { + if (!isResumed()) { + return; + } + String fragmentName; + switch (getRtlPosition(position)) { + case TAB_INDEX_SPEED_DIAL: + fragmentName = SpeedDialFragment.class.getSimpleName(); + break; + case TAB_INDEX_RECENTS: + fragmentName = CallLogFragment.class.getSimpleName(); + break; + case TAB_INDEX_ALL_CONTACTS: + fragmentName = AllContactsFragment.class.getSimpleName(); + break; + default: + return; + } + AnalyticsUtil.sendScreenView(fragmentName, getActivity(), null); + } } |