Search in sources :

Example 1 with PhoneNumberListAdapter

use of com.android.contacts.common.list.PhoneNumberListAdapter in project android_packages_apps_Dialer by LineageOS.

the class DialtactsActivity method onAttachFragment.

@Override
public void onAttachFragment(final Fragment fragment) {
    LogUtil.d("DialtactsActivity.onAttachFragment", "fragment: %s", fragment);
    if (fragment instanceof DialpadFragment) {
        mDialpadFragment = (DialpadFragment) fragment;
        if (!mIsDialpadShown && !mShowDialpadOnResume) {
            final FragmentTransaction transaction = getFragmentManager().beginTransaction();
            transaction.hide(mDialpadFragment);
            transaction.commit();
        }
    } else if (fragment instanceof SmartDialSearchFragment) {
        mSmartDialSearchFragment = (SmartDialSearchFragment) fragment;
        mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener(this);
        if (!TextUtils.isEmpty(mDialpadQuery)) {
            mSmartDialSearchFragment.setAddToContactNumber(mDialpadQuery);
        }
    } else if (fragment instanceof SearchFragment) {
        mRegularSearchFragment = (RegularSearchFragment) fragment;
        mRegularSearchFragment.setOnPhoneNumberPickerActionListener(this);
    } else if (fragment instanceof ListsFragment) {
        mListsFragment = (ListsFragment) fragment;
        mListsFragment.addOnPageChangeListener(this);
    } else if (fragment instanceof NewSearchFragment) {
        mNewSearchFragment = (NewSearchFragment) fragment;
    }
    if (fragment instanceof SearchFragment) {
        final SearchFragment searchFragment = (SearchFragment) fragment;
        searchFragment.setReranker(new CursorReranker() {

            @Override
            @MainThread
            public Cursor rerankCursor(Cursor data) {
                Assert.isMainThread();
                String queryString = searchFragment.getQueryString();
                return mP13nRanker.rankCursor(data, queryString == null ? 0 : queryString.length());
            }
        });
        searchFragment.addOnLoadFinishedListener(new OnLoadFinishedListener() {

            @Override
            public void onLoadFinished() {
                mP13nLogger.onSearchQuery(searchFragment.getQueryString(), (PhoneNumberListAdapter) searchFragment.getAdapter());
            }
        });
    }
}
Also used : PhoneNumberListAdapter(com.android.contacts.common.list.PhoneNumberListAdapter) DialpadFragment(com.android.dialer.app.dialpad.DialpadFragment) ListsFragment(com.android.dialer.app.list.ListsFragment) SmartDialSearchFragment(com.android.dialer.app.list.SmartDialSearchFragment) NewSearchFragment(com.android.dialer.searchfragment.list.NewSearchFragment) RegularSearchFragment(com.android.dialer.app.list.RegularSearchFragment) NewSearchFragment(com.android.dialer.searchfragment.list.NewSearchFragment) SearchFragment(com.android.dialer.app.list.SearchFragment) SmartDialSearchFragment(com.android.dialer.app.list.SmartDialSearchFragment) Cursor(android.database.Cursor) MainThread(android.support.annotation.MainThread) OnLoadFinishedListener(com.android.contacts.common.list.PhoneNumberPickerFragment.OnLoadFinishedListener) FragmentTransaction(android.app.FragmentTransaction) CursorReranker(com.android.contacts.common.list.PhoneNumberPickerFragment.CursorReranker)

Example 2 with PhoneNumberListAdapter

use of com.android.contacts.common.list.PhoneNumberListAdapter in project android_packages_apps_Dialer by LineageOS.

the class P13nLogging method get.

@NonNull
public static P13nLogger get(@NonNull Context context) {
    Assert.isNotNull(context);
    Assert.isMainThread();
    if (logger != null) {
        return logger;
    }
    Context application = context.getApplicationContext();
    if (application instanceof P13nLoggerFactory) {
        logger = ((P13nLoggerFactory) application).newP13nLogger(context);
    }
    if (logger == null) {
        logger = new P13nLogger() {

            @Override
            public void onSearchQuery(String query, PhoneNumberListAdapter adapter) {
            }

            @Override
            public void reset() {
            }
        };
    }
    return logger;
}
Also used : Context(android.content.Context) PhoneNumberListAdapter(com.android.contacts.common.list.PhoneNumberListAdapter) NonNull(android.support.annotation.NonNull)

Aggregations

PhoneNumberListAdapter (com.android.contacts.common.list.PhoneNumberListAdapter)2 FragmentTransaction (android.app.FragmentTransaction)1 Context (android.content.Context)1 Cursor (android.database.Cursor)1 MainThread (android.support.annotation.MainThread)1 NonNull (android.support.annotation.NonNull)1 CursorReranker (com.android.contacts.common.list.PhoneNumberPickerFragment.CursorReranker)1 OnLoadFinishedListener (com.android.contacts.common.list.PhoneNumberPickerFragment.OnLoadFinishedListener)1 DialpadFragment (com.android.dialer.app.dialpad.DialpadFragment)1 ListsFragment (com.android.dialer.app.list.ListsFragment)1 RegularSearchFragment (com.android.dialer.app.list.RegularSearchFragment)1 SearchFragment (com.android.dialer.app.list.SearchFragment)1 SmartDialSearchFragment (com.android.dialer.app.list.SmartDialSearchFragment)1 NewSearchFragment (com.android.dialer.searchfragment.list.NewSearchFragment)1