use of com.android.dialer.list.SearchFragment in project android_packages_apps_Dialer by MoKee.
the class DialtactsActivity method onAttachFragment.
@Override
public void onAttachFragment(Fragment 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);
}
}
use of com.android.dialer.list.SearchFragment in project android_packages_apps_Dialer by MoKee.
the class DialtactsActivity method enterSearchUi.
/**
* Shows the search fragment
*/
private void enterSearchUi(boolean smartDialSearch, String query, boolean animate) {
if (mStateSaved || getFragmentManager().isDestroyed()) {
// constructive here.
return;
}
if (DEBUG) {
Log.d(TAG, "Entering search UI - smart dial " + smartDialSearch);
}
final FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (mInDialpadSearch && mSmartDialSearchFragment != null) {
transaction.remove(mSmartDialSearchFragment);
} else if (mInRegularSearch && mRegularSearchFragment != null) {
transaction.remove(mRegularSearchFragment);
}
final String tag;
if (smartDialSearch) {
tag = TAG_SMARTDIAL_SEARCH_FRAGMENT;
} else {
tag = TAG_REGULAR_SEARCH_FRAGMENT;
}
mInDialpadSearch = smartDialSearch;
mInRegularSearch = !smartDialSearch;
mFloatingActionButtonController.scaleOut();
SearchFragment fragment = (SearchFragment) getFragmentManager().findFragmentByTag(tag);
if (animate) {
transaction.setCustomAnimations(android.R.animator.fade_in, 0);
} else {
transaction.setTransition(FragmentTransaction.TRANSIT_NONE);
}
if (fragment == null) {
if (smartDialSearch) {
fragment = new SmartDialSearchFragment();
} else {
fragment = ObjectFactory.newRegularSearchFragment();
fragment.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// Show the FAB when the user touches the lists fragment and the soft
// keyboard is hidden.
hideDialpadFragment(true, false);
showFabInSearchUi();
return false;
}
});
}
transaction.add(R.id.dialtacts_frame, fragment, tag);
} else {
transaction.show(fragment);
}
// DialtactsActivity will provide the options menu
fragment.setHasOptionsMenu(false);
fragment.setShowEmptyListForNullQuery(true);
if (!smartDialSearch) {
fragment.setQueryString(query, false);
}
transaction.commit();
if (animate) {
mListsFragment.getView().animate().alpha(0).withLayer();
}
mListsFragment.setUserVisibleHint(false);
if (smartDialSearch) {
Logger.logScreenView(ScreenEvent.SMART_DIAL_SEARCH, this);
} else {
Logger.logScreenView(ScreenEvent.REGULAR_SEARCH, this);
}
}
Aggregations