use of com.android.contacts.common.list.PhoneNumberPickerFragment.CursorReranker 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());
}
});
}
}
Aggregations