use of com.android.dialer.dialpad.DialpadFragment 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.dialpad.DialpadFragment in project android_packages_apps_Dialer by MoKee.
the class DialtactsActivity method showDialpadFragment.
/**
* Initiates a fragment transaction to show the dialpad fragment. Animations and other visual
* updates are handled by a callback which is invoked after the dialpad fragment is shown.
* @see #onDialpadShown
*/
private void showDialpadFragment(boolean animate) {
if (mIsDialpadShown || mStateSaved) {
return;
}
mIsDialpadShown = true;
mListsFragment.setUserVisibleHint(false);
final FragmentTransaction ft = getFragmentManager().beginTransaction();
if (mDialpadFragment == null) {
mDialpadFragment = new DialpadFragment();
ft.add(R.id.dialtacts_container, mDialpadFragment, TAG_DIALPAD_FRAGMENT);
} else {
ft.show(mDialpadFragment);
}
mDialpadFragment.setAnimate(animate);
Logger.logScreenView(ScreenEvent.DIALPAD, this);
ft.commit();
if (animate) {
mFloatingActionButtonController.scaleOut();
} else {
mFloatingActionButtonController.setVisible(false);
maybeEnterSearchUi();
}
mActionBarController.onDialpadUp();
setConferenceDialButtonVisibility(animate);
mListsFragment.getView().animate().alpha(0).withLayer();
// adjust the title, so the user will know where we're at when the activity start/resumes.
setTitle(R.string.launcherDialpadActivityLabel);
}
use of com.android.dialer.dialpad.DialpadFragment in project android_packages_apps_Dialer by MoKee.
the class DialtactsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
Trace.beginSection(TAG + " onCreate");
super.onCreate(savedInstanceState);
mFirstLaunch = true;
final Resources resources = getResources();
mActionBarHeight = resources.getDimensionPixelSize(R.dimen.action_bar_height_large);
Trace.beginSection(TAG + " setContentView");
setContentView(R.layout.dialtacts_activity);
Trace.endSection();
getWindow().setBackgroundDrawable(null);
Trace.beginSection(TAG + " setup Views");
final ActionBar actionBar = getSupportActionBar();
actionBar.setCustomView(R.layout.search_edittext);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setBackgroundDrawable(null);
SearchEditTextLayout searchEditTextLayout = (SearchEditTextLayout) actionBar.getCustomView().findViewById(R.id.search_view_container);
searchEditTextLayout.setPreImeKeyListener(mSearchEditTextLayoutListener);
mActionBarController = new ActionBarController(this, searchEditTextLayout);
mSearchView = (EditText) searchEditTextLayout.findViewById(R.id.search_view);
mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener);
mVoiceSearchButton = searchEditTextLayout.findViewById(R.id.voice_search_button);
searchEditTextLayout.findViewById(R.id.search_magnifying_glass).setOnClickListener(mSearchViewOnClickListener);
searchEditTextLayout.findViewById(R.id.search_box_start_search).setOnClickListener(mSearchViewOnClickListener);
searchEditTextLayout.setOnClickListener(mSearchViewOnClickListener);
searchEditTextLayout.setCallback(new SearchEditTextLayout.Callback() {
@Override
public void onBackButtonClicked() {
onBackPressed();
}
@Override
public void onSearchViewClicked() {
// Hide FAB, as the keyboard is shown.
mFloatingActionButtonController.scaleOut();
}
});
mIsLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
mPreviouslySelectedTabIndex = ListsFragment.TAB_INDEX_SPEED_DIAL;
final View floatingActionButtonContainer = findViewById(R.id.floating_action_button_container);
mFloatingActionButton = (ImageButton) findViewById(R.id.floating_action_button);
mDialCallButton = findViewById(R.id.floating_action_button);
mFloatingActionButton.setOnClickListener(this);
if (!getResources().getBoolean(R.bool.config_hide_SIP_dial_icon)) {
mConferenceDialButton = (ImageButton) findViewById(R.id.dialConferenceButton);
mConferenceDialButton.setOnClickListener(this);
}
mFloatingActionButtonController = new FloatingActionButtonController(this, floatingActionButtonContainer, mFloatingActionButton);
ImageButton optionsMenuButton = (ImageButton) searchEditTextLayout.findViewById(R.id.dialtacts_options_menu_button);
optionsMenuButton.setOnClickListener(this);
mOverflowMenu = buildOptionsMenu(searchEditTextLayout);
optionsMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener());
// fragment manager is responsible for recreating it.
if (savedInstanceState == null) {
getFragmentManager().beginTransaction().add(R.id.dialtacts_frame, new ListsFragment(), TAG_FAVORITES_FRAGMENT).add(R.id.dialtacts_container, new DialpadFragment(), TAG_DIALPAD_FRAGMENT).commit();
} else {
mSearchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY);
mInRegularSearch = savedInstanceState.getBoolean(KEY_IN_REGULAR_SEARCH_UI);
mInDialpadSearch = savedInstanceState.getBoolean(KEY_IN_DIALPAD_SEARCH_UI);
mFirstLaunch = savedInstanceState.getBoolean(KEY_FIRST_LAUNCH);
mShowDialpadOnResume = savedInstanceState.getBoolean(KEY_IS_DIALPAD_SHOWN);
mActionBarController.restoreInstanceState(savedInstanceState);
}
final boolean isLayoutRtl = DialerUtils.isRtl();
if (mIsLandscape) {
mSlideIn = AnimationUtils.loadAnimation(this, isLayoutRtl ? R.anim.dialpad_slide_in_left : R.anim.dialpad_slide_in_right);
mSlideOut = AnimationUtils.loadAnimation(this, isLayoutRtl ? R.anim.dialpad_slide_out_left : R.anim.dialpad_slide_out_right);
} else {
mSlideIn = AnimationUtils.loadAnimation(this, R.anim.dialpad_slide_in_bottom);
mSlideOut = AnimationUtils.loadAnimation(this, R.anim.dialpad_slide_out_bottom);
}
mSlideIn.setInterpolator(AnimUtils.EASE_IN);
mSlideOut.setInterpolator(AnimUtils.EASE_OUT);
mSlideIn.setAnimationListener(mSlideInListener);
mSlideOut.setAnimationListener(mSlideOutListener);
mParentLayout = (CoordinatorLayout) findViewById(R.id.dialtacts_mainlayout);
mParentLayout.setOnDragListener(new LayoutOnDragListener());
floatingActionButtonContainer.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
final ViewTreeObserver observer = floatingActionButtonContainer.getViewTreeObserver();
if (!observer.isAlive()) {
return;
}
observer.removeOnGlobalLayoutListener(this);
int screenWidth = mParentLayout.getWidth();
mFloatingActionButtonController.setScreenWidth(screenWidth);
mFloatingActionButtonController.align(getFabAlignment(), false);
}
});
Trace.endSection();
Trace.beginSection(TAG + " initialize smart dialing");
mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(this);
boolean isPresenceEnabled = this.getResources().getBoolean(R.bool.config_regional_presence_enable);
if (isPresenceEnabled && !PresenceHelper.isBound()) {
PresenceHelper.bindService((Context) DialtactsActivity.this);
}
mWifiCallUtils = new WifiCallUtils();
if (resources.getBoolean(R.bool.config_regional_pup_no_available_network) && mFirstLaunch) {
mWifiCallUtils.addWifiCallReadyMarqueeMessage((Context) DialtactsActivity.this);
if (ActivityCompat.checkSelfPermission(DialtactsActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[] { Manifest.permission.ACCESS_COARSE_LOCATION }, PERMISSION_REQUEST_CODE_LOCATION);
} else {
mWifiCallUtils.showWifiCallNotification((Context) DialtactsActivity.this);
}
}
Trace.endSection();
Trace.endSection();
if (getResources().getBoolean(R.bool.config_regional_video_call_welcome_dialog)) {
if (CallUtil.isVideoEnabled(this)) {
showVideoCallWelcomeDialog();
}
}
}
Aggregations