use of com.android.dialer.dialpadview.DialpadView in project android_packages_apps_Dialer by LineageOS.
the class DialpadFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
Trace.beginSection(TAG + " onCreateView");
Trace.beginSection(TAG + " inflate view");
final View fragmentView = inflater.inflate(R.layout.dialpad_fragment, container, false);
Trace.endSection();
Trace.beginSection(TAG + " buildLayer");
fragmentView.buildLayer();
Trace.endSection();
Trace.beginSection(TAG + " setup views");
mDialpadView = (DialpadView) fragmentView.findViewById(R.id.dialpad_view);
mDialpadView.setCanDigitsBeEdited(true);
mDigits = mDialpadView.getDigits();
mDigits.setKeyListener(UnicodeDialerKeyListener.INSTANCE);
mDigits.setOnClickListener(this);
mDigits.setOnKeyListener(this);
mDigits.setOnLongClickListener(this);
mDigits.addTextChangedListener(this);
mDigits.setElegantTextHeight(false);
PhoneNumberFormattingTextWatcher watcher = new PhoneNumberFormattingTextWatcher(GeoUtil.getCurrentCountryIso(getActivity()));
mDigits.addTextChangedListener(watcher);
// Check for the presence of the keypad
View oneButton = fragmentView.findViewById(R.id.one);
if (oneButton != null) {
configureKeypadListeners(fragmentView);
}
mDelete = mDialpadView.getDeleteButton();
if (mDelete != null) {
mDelete.setOnClickListener(this);
mDelete.setOnLongClickListener(this);
}
mSpacer = fragmentView.findViewById(R.id.spacer);
mSpacer.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (isDigitsEmpty()) {
if (getActivity() != null) {
return ((HostInterface) getActivity()).onDialpadSpacerTouchWithEmptyQuery();
}
return true;
}
return false;
}
});
mDigits.setCursorVisible(false);
// Set up the "dialpad chooser" UI; see showDialpadChooser().
mDialpadChooser = (ListView) fragmentView.findViewById(R.id.dialpadChooser);
mDialpadChooser.setOnItemClickListener(this);
FloatingActionButton floatingActionButton = (FloatingActionButton) fragmentView.findViewById(R.id.dialpad_floating_action_button);
floatingActionButton.setOnClickListener(this);
mFloatingActionButtonController = new FloatingActionButtonController(getActivity(), floatingActionButton);
Trace.endSection();
Trace.endSection();
return fragmentView;
}
use of com.android.dialer.dialpadview.DialpadView in project android_packages_apps_Dialer by LineageOS.
the class DialpadFragment method animateShowDialpad.
/**
* Starts the slide up animation for the Dialpad keys when the Dialpad is revealed.
*/
public void animateShowDialpad() {
final DialpadView dialpadView = (DialpadView) getView().findViewById(R.id.dialpad_view);
dialpadView.animateShow();
}
use of com.android.dialer.dialpadview.DialpadView in project android_packages_apps_Dialer by LineageOS.
the class DialpadFragment method onCreateView.
// TODO Adds hardware keyboard listener
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View parent = inflater.inflate(R.layout.incall_dialpad_fragment, container, false);
mDialpadView = (DialpadView) parent.findViewById(R.id.dialpad_view);
mDialpadView.setCanDigitsBeEdited(false);
mDialpadView.setBackgroundResource(R.color.incall_dialpad_background);
mDtmfDialerField = (EditText) parent.findViewById(R.id.digits);
if (mDtmfDialerField != null) {
mDialerKeyListener = new DTMFKeyListener();
mDtmfDialerField.setKeyListener(mDialerKeyListener);
// remove the long-press context menus that support
// the edit (copy / paste / select) functions.
mDtmfDialerField.setLongClickable(false);
mDtmfDialerField.setElegantTextHeight(false);
configureKeypadListeners();
}
View backButton = mDialpadView.findViewById(R.id.dialpad_back);
backButton.setVisibility(View.VISIBLE);
backButton.setOnClickListener(this);
return parent;
}
use of com.android.dialer.dialpadview.DialpadView 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