Search in sources :

Example 1 with DialpadView

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;
}
Also used : FloatingActionButtonController(com.android.contacts.common.widget.FloatingActionButtonController) FloatingActionButton(android.support.design.widget.FloatingActionButton) PhoneNumberFormattingTextWatcher(android.telephony.PhoneNumberFormattingTextWatcher) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) DialpadView(com.android.dialer.dialpadview.DialpadView) TextView(android.widget.TextView) ListView(android.widget.ListView) MotionEvent(android.view.MotionEvent)

Example 2 with DialpadView

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();
}
Also used : DialpadView(com.android.dialer.dialpadview.DialpadView)

Example 3 with DialpadView

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;
}
Also used : DialpadView(com.android.dialer.dialpadview.DialpadView) TextView(android.widget.TextView) View(android.view.View)

Example 4 with DialpadView

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);
        }
    }
}
Also used : DialtactsActivity(com.android.dialer.app.DialtactsActivity) DialpadView(com.android.dialer.dialpadview.DialpadView)

Aggregations

DialpadView (com.android.dialer.dialpadview.DialpadView)4 View (android.view.View)2 TextView (android.widget.TextView)2 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 PhoneNumberFormattingTextWatcher (android.telephony.PhoneNumberFormattingTextWatcher)1 MotionEvent (android.view.MotionEvent)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 FloatingActionButtonController (com.android.contacts.common.widget.FloatingActionButtonController)1 DialtactsActivity (com.android.dialer.app.DialtactsActivity)1