use of com.android.dialer.contactsfragment.ContactsFragment in project android_packages_apps_Dialer by LineageOS.
the class DialtactsPagerAdapter method getItem.
@Override
public Fragment getItem(int position) {
LogUtil.d("ViewPagerAdapter.getItem", "position: %d", position);
switch(getRtlPosition(position)) {
case TAB_INDEX_SPEED_DIAL:
if (useNewSpeedDialTab) {
if (speedDialFragment == null) {
speedDialFragment = SpeedDialFragment.newInstance();
}
return speedDialFragment;
} else {
if (oldSpeedDialFragment == null) {
oldSpeedDialFragment = new OldSpeedDialFragment();
}
return oldSpeedDialFragment;
}
case TAB_INDEX_HISTORY:
if (useNewCallLogTab) {
if (newCallLogFragment == null) {
newCallLogFragment = new NewCallLogFragment();
}
return newCallLogFragment;
} else {
if (callLogFragment == null) {
callLogFragment = new CallLogFragment(CallLogQueryHandler.CALL_TYPE_ALL);
}
return callLogFragment;
}
case TAB_INDEX_ALL_CONTACTS:
if (useNewContactsTab) {
if (contactsFragment == null) {
contactsFragment = new ContactsFragment();
}
return contactsFragment;
} else {
if (oldContactsFragment == null) {
oldContactsFragment = new AllContactsFragment();
}
return oldContactsFragment;
}
case TAB_INDEX_VOICEMAIL:
if (voicemailFragment == null) {
voicemailFragment = new VisualVoicemailCallLogFragment();
LogUtil.v("ViewPagerAdapter.getItem", "new VisualVoicemailCallLogFragment: %s", voicemailFragment);
}
return voicemailFragment;
default:
throw Assert.createIllegalStateFailException("No fragment at position " + position);
}
}
use of com.android.dialer.contactsfragment.ContactsFragment in project android_packages_apps_Dialer by LineageOS.
the class DialtactsPagerAdapter method instantiateItem.
@Override
public Fragment instantiateItem(ViewGroup container, int position) {
LogUtil.d("ViewPagerAdapter.instantiateItem", "position: %d", position);
// On rotation the FragmentManager handles rotation. Therefore getItem() isn't called.
// Copy the fragments that the FragmentManager finds so that we can store them in
// instance variables for later.
final Fragment fragment = (Fragment) super.instantiateItem(container, position);
if (fragment instanceof OldSpeedDialFragment) {
oldSpeedDialFragment = (OldSpeedDialFragment) fragment;
} else if (fragment instanceof SpeedDialFragment) {
speedDialFragment = (SpeedDialFragment) fragment;
} else if (fragment instanceof CallLogFragment && position == TAB_INDEX_HISTORY) {
callLogFragment = (CallLogFragment) fragment;
} else if (fragment instanceof NewCallLogFragment) {
newCallLogFragment = (NewCallLogFragment) fragment;
} else if (fragment instanceof ContactsFragment) {
contactsFragment = (ContactsFragment) fragment;
} else if (fragment instanceof AllContactsFragment) {
oldContactsFragment = (AllContactsFragment) fragment;
} else if (fragment instanceof CallLogFragment && position == TAB_INDEX_VOICEMAIL) {
voicemailFragment = (CallLogFragment) fragment;
LogUtil.v("ViewPagerAdapter.instantiateItem", voicemailFragment.toString());
}
fragments.set(position, fragment);
return fragment;
}
Aggregations