Search in sources :

Example 1 with CallLogFragment

use of com.android.dialer.app.calllog.CallLogFragment 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);
    }
}
Also used : VisualVoicemailCallLogFragment(com.android.dialer.app.calllog.VisualVoicemailCallLogFragment) NewCallLogFragment(com.android.dialer.calllog.ui.NewCallLogFragment) VisualVoicemailCallLogFragment(com.android.dialer.app.calllog.VisualVoicemailCallLogFragment) CallLogFragment(com.android.dialer.app.calllog.CallLogFragment) NewCallLogFragment(com.android.dialer.calllog.ui.NewCallLogFragment) ContactsFragment(com.android.dialer.contactsfragment.ContactsFragment)

Example 2 with CallLogFragment

use of com.android.dialer.app.calllog.CallLogFragment in project android_packages_apps_Dialer by LineageOS.

the class ListsFragment method onResume.

@Override
public void onResume() {
    LogUtil.d("ListsFragment.onResume", null);
    Trace.beginSection(TAG + " onResume");
    super.onResume();
    mPaused = false;
    if (getUserVisibleHint()) {
        sendScreenViewForCurrentPosition();
    }
    // Fetch voicemail status to determine if we should show the voicemail tab.
    mCallLogQueryHandler = new CallLogQueryHandler(getActivity(), getActivity().getContentResolver(), this);
    mCallLogQueryHandler.fetchVoicemailStatus();
    mCallLogQueryHandler.fetchMissedCallsUnreadCount();
    Trace.endSection();
    mCurrentPage = mAdapter.getItem(mViewPager.getCurrentItem());
    if (mCurrentPage instanceof CallLogFragment) {
        ((CallLogFragment) mCurrentPage).onVisible();
    }
}
Also used : CallLogFragment(com.android.dialer.app.calllog.CallLogFragment) CallLogQueryHandler(com.android.dialer.database.CallLogQueryHandler)

Example 3 with CallLogFragment

use of com.android.dialer.app.calllog.CallLogFragment 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;
}
Also used : NewCallLogFragment(com.android.dialer.calllog.ui.NewCallLogFragment) SpeedDialFragment(com.android.dialer.speeddial.SpeedDialFragment) VisualVoicemailCallLogFragment(com.android.dialer.app.calllog.VisualVoicemailCallLogFragment) CallLogFragment(com.android.dialer.app.calllog.CallLogFragment) NewCallLogFragment(com.android.dialer.calllog.ui.NewCallLogFragment) Fragment(android.app.Fragment) ContactsFragment(com.android.dialer.contactsfragment.ContactsFragment) VisualVoicemailCallLogFragment(com.android.dialer.app.calllog.VisualVoicemailCallLogFragment) CallLogFragment(com.android.dialer.app.calllog.CallLogFragment) NewCallLogFragment(com.android.dialer.calllog.ui.NewCallLogFragment) SpeedDialFragment(com.android.dialer.speeddial.SpeedDialFragment) ContactsFragment(com.android.dialer.contactsfragment.ContactsFragment)

Aggregations

CallLogFragment (com.android.dialer.app.calllog.CallLogFragment)3 VisualVoicemailCallLogFragment (com.android.dialer.app.calllog.VisualVoicemailCallLogFragment)2 NewCallLogFragment (com.android.dialer.calllog.ui.NewCallLogFragment)2 ContactsFragment (com.android.dialer.contactsfragment.ContactsFragment)2 Fragment (android.app.Fragment)1 CallLogQueryHandler (com.android.dialer.database.CallLogQueryHandler)1 SpeedDialFragment (com.android.dialer.speeddial.SpeedDialFragment)1