From 03982754da3fc42d62beac6b003a0e3d9a3eb480 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 8 May 2014 11:47:27 -0700 Subject: Move overflow menu and remove add contact button. Add contact is now included as an item on the overflow menu.. Bug: 14471388 Change-Id: I4078b6f2b653dca5e42fb6088659ca059046c85c --- .../android/dialer/dialpad/DialpadFragment.java | 31 +++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'src/com') diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index ba4ae7b36..a915dc11e 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -175,7 +175,6 @@ public class DialpadFragment extends Fragment /** Remembers if we need to clear digits field when the screen is completely gone. */ private boolean mClearDigitsOnStop; - private View mAddContactButton; private View mOverflowMenuButton; private View mDelete; private ToneGenerator mToneGenerator; @@ -310,9 +309,10 @@ public class DialpadFragment extends Fragment if (isDigitsEmpty()) { mDigitsFilledByIntent = false; mDigits.setCursorVisible(false); - mAddContactButton.setVisibility(View.INVISIBLE); + // Set to INVISIBLE instead of GONE so that text (eg. "Type number to add") is centered. + mOverflowMenuButton.setVisibility(View.INVISIBLE); } else if (mDialpadView.canDigitsBeEdited()){ - mAddContactButton.setVisibility(View.VISIBLE); + mOverflowMenuButton.setVisibility(View.VISIBLE); } if (mDialpadQueryListener != null) { @@ -414,6 +414,11 @@ public class DialpadFragment extends Fragment mDialpadChooser = (ListView) fragmentView.findViewById(R.id.dialpadChooser); mDialpadChooser.setOnItemClickListener(this); + mOverflowMenuButton = mDialpadView.getOverflowMenuButton(); + mOverflowMenuButton.setOnClickListener(this); + final PopupMenu overflowMenu = buildOptionsMenu(mOverflowMenuButton); + mOverflowMenuButton.setOnTouchListener(overflowMenu.getDragToOpenListener()); + return fragmentView; } @@ -584,14 +589,6 @@ public class DialpadFragment extends Fragment // Long-pressing zero button will enter '+' instead. final DialpadKeyButton zero = (DialpadKeyButton) fragmentView.findViewById(R.id.zero); zero.setOnLongClickListener(this); - - mAddContactButton = fragmentView.findViewById(R.id.dialpad_add_contact); - mAddContactButton.setOnClickListener(this); - - mOverflowMenuButton = fragmentView.findViewById(R.id.dialpad_overflow); - mOverflowMenuButton.setOnClickListener(this); - final PopupMenu overflowMenu = buildOptionsMenu(mOverflowMenuButton); - mOverflowMenuButton.setOnTouchListener(overflowMenu.getDragToOpenListener()); } @Override @@ -901,12 +898,6 @@ public class DialpadFragment extends Fragment } return; } - case R.id.dialpad_add_contact: { - final CharSequence digits = mDigits.getText(); - DialerUtils.startActivityWithErrorToast(getActivity(), - DialtactsActivity.getAddNumberToContactIntent(digits)); - return; - } case R.id.dialpad_overflow: { buildOptionsMenu(view).show(); break; @@ -1439,8 +1430,12 @@ public class DialpadFragment extends Fragment @Override public boolean onMenuItemClick(MenuItem item) { - // R.id.menu_add_contacts already has an add to contact intent populated by setupMenuItems switch (item.getItemId()) { + case R.id.menu_add_contact: + final CharSequence digits = mDigits.getText(); + DialerUtils.startActivityWithErrorToast(getActivity(), + DialtactsActivity.getAddNumberToContactIntent(digits)); + return true; case R.id.menu_2s_pause: updateDialString(PAUSE); return true; -- cgit v1.2.3