private AbsListView getCurrentListView() { final int position = mViewPager.getCurrentItem(); switch (getRtlPosition(position)) { case TAB_INDEX_SPEED_DIAL: return mSpeedDialFragment == null ? null : mSpeedDialFragment.getListView(); case TAB_INDEX_RECENTS: return mRecentsFragment == null ? null : mRecentsFragment.getListView(); case TAB_INDEX_ALL_CONTACTS: return mAllContactsFragment == null ? null : mAllContactsFragment.getListView(); } throw new IllegalStateException("No fragment at position " + position); }
@Override public void onPageSelected(int position) { if (position == TAB_INDEX_SPEED_DIAL && mSpeedDialFragment != null) { mSpeedDialFragment.sendScreenView(); } else if (position == TAB_INDEX_RECENTS && mRecentsFragment != null) { mRecentsFragment.sendScreenView(); } else if (position == TAB_INDEX_ALL_CONTACTS && mAllContactsFragment != null) { mAllContactsFragment.sendScreenView(); } final int count = mOnPageChangeListeners.size(); for (int i = 0; i < count; i++) { mOnPageChangeListeners.get(i).onPageSelected(position); } }