diff options
author | Andrew Lee <anwlee@google.com> | 2014-05-08 11:47:27 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2014-05-08 11:51:24 -0700 |
commit | 03982754da3fc42d62beac6b003a0e3d9a3eb480 (patch) | |
tree | 94107e872e1a42d855f9c8bc7be055cb64640265 /src/com/android/dialer/dialpad/DialpadFragment.java | |
parent | 2cbc4da9d59a9ac740b03645a34ff04b85564958 (diff) |
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
Diffstat (limited to 'src/com/android/dialer/dialpad/DialpadFragment.java')
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 31 |
1 files changed, 13 insertions, 18 deletions
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; |