use of com.android.dialer.app.DialtactsActivity in project android_packages_apps_Dialer by LineageOS.
the class DialpadFragment method onResume.
@Override
public void onResume() {
LogUtil.d("DialpadFragment.onResume", "");
Trace.beginSection(TAG + " onResume");
super.onResume();
Resources res = getResources();
int iconId = R.drawable.quantum_ic_call_vd_theme_24;
if (MotorolaUtils.isWifiCallingAvailable(getContext())) {
iconId = R.drawable.ic_wifi_calling;
}
mFloatingActionButtonController.changeIcon(res.getDrawable(iconId, null), res.getString(R.string.description_dial_button));
final DialtactsActivity activity = (DialtactsActivity) getActivity();
mDialpadQueryListener = activity;
final StopWatch stopWatch = StopWatch.start("Dialpad.onResume");
// Query the last dialed number. Do it first because hitting
// the DB is 'slow'. This call is asynchronous.
queryLastOutgoingCall();
stopWatch.lap("qloc");
final ContentResolver contentResolver = activity.getContentResolver();
// retrieve the DTMF tone play back setting.
mDTMFToneEnabled = Settings.System.getInt(contentResolver, Settings.System.DTMF_TONE_WHEN_DIALING, 1) == 1;
stopWatch.lap("dtwd");
stopWatch.lap("hptc");
mPressedDialpadKeys.clear();
configureScreenFromIntent(getActivity());
stopWatch.lap("fdin");
if (!isPhoneInUse()) {
// A sanity-check: the "dialpad chooser" UI should not be visible if the phone is idle.
showDialpadChooser(false);
}
stopWatch.lap("hnt");
updateDeleteButtonEnabledState();
stopWatch.lap("bes");
stopWatch.stopAndLog(TAG, 50);
// Populate the overflow menu in onResume instead of onCreate, so that if the SMS activity
// is disabled while Dialer is paused, the "Send a text message" option can be correctly
// removed when resumed.
mOverflowMenuButton = mDialpadView.getOverflowMenuButton();
mOverflowPopupMenu = buildOptionsMenu(mOverflowMenuButton);
mOverflowMenuButton.setOnTouchListener(mOverflowPopupMenu.getDragToOpenListener());
mOverflowMenuButton.setOnClickListener(this);
mOverflowMenuButton.setVisibility(isDigitsEmpty() ? View.INVISIBLE : View.VISIBLE);
if (mFirstLaunch) {
// The onHiddenChanged callback does not get called the first time the fragment is
// attached, so call it ourselves here.
onHiddenChanged(false);
}
mFirstLaunch = false;
Trace.endSection();
}
use of com.android.dialer.app.DialtactsActivity in project android_packages_apps_Dialer by LineageOS.
the class DialpadFragment method configureScreenFromIntent.
/**
* Checks the given Intent and changes dialpad's UI state. For example, if the Intent requires the
* screen to enter "Add Call" mode, this method will show correct UI for the mode.
*/
private void configureScreenFromIntent(Activity parent) {
// If we were not invoked with a DIAL intent,
if (!(parent instanceof DialtactsActivity)) {
setStartedFromNewIntent(false);
return;
}
// See if we were invoked with a DIAL intent. If we were, fill in the appropriate
// digits in the dialer field.
Intent intent = parent.getIntent();
if (!isLayoutReady()) {
// This happens typically when parent's Activity#onNewIntent() is called while
// Fragment#onCreateView() isn't called yet, and thus we cannot configure Views at
// this point. onViewCreate() should call this method after preparing layouts, so
// just ignore this call now.
LogUtil.i("DialpadFragment.configureScreenFromIntent", "Screen configuration is requested before onCreateView() is called. Ignored");
return;
}
boolean needToShowDialpadChooser = false;
// Be sure *not* to show the dialpad chooser if this is an
// explicit "Add call" action, though.
final boolean isAddCallMode = isAddCallMode(intent);
if (!isAddCallMode) {
// Don't show the chooser when called via onNewIntent() and phone number is present.
// i.e. User clicks a telephone link from gmail for example.
// In this case, we want to show the dialpad with the phone number.
final boolean digitsFilled = fillDigitsIfNecessary(intent);
if (!(mStartedFromNewIntent && digitsFilled)) {
final String action = intent.getAction();
if (Intent.ACTION_DIAL.equals(action) || Intent.ACTION_VIEW.equals(action) || Intent.ACTION_MAIN.equals(action)) {
// make the user confirm what they really want to do.
if (isPhoneInUse()) {
needToShowDialpadChooser = true;
}
}
}
}
showDialpadChooser(needToShowDialpadChooser);
setStartedFromNewIntent(false);
}
use of com.android.dialer.app.DialtactsActivity in project android_packages_apps_Dialer by LineageOS.
the class DialpadFragment method onHiddenChanged.
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
final DialtactsActivity activity = (DialtactsActivity) getActivity();
if (activity == null || getView() == null) {
return;
}
final DialpadView dialpadView = (DialpadView) getView().findViewById(R.id.dialpad_view);
if (!hidden && !isDialpadChooserVisible()) {
if (mAnimate) {
dialpadView.animateShow();
}
mFloatingActionButtonController.setVisible(false);
mFloatingActionButtonController.scaleIn(mAnimate ? mDialpadSlideInDuration : 0);
activity.onDialpadShown();
mDigits.requestFocus();
}
if (hidden) {
if (mAnimate) {
mFloatingActionButtonController.scaleOut();
} else {
mFloatingActionButtonController.setVisible(false);
}
}
}
Aggregations