summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-05-08 20:24:53 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-08 20:24:53 +0000
commitde8a45060102946ed6bb6a473ecd691ccd451220 (patch)
tree309d50bcba74d4d38f6a9cca02bf4286c0887ffa
parentfd96de5e7db3a6649a488b2cee0b5609cfcea7ff (diff)
parent03982754da3fc42d62beac6b003a0e3d9a3eb480 (diff)
am 03982754: Move overflow menu and remove add contact button.
* commit '03982754da3fc42d62beac6b003a0e3d9a3eb480': Move overflow menu and remove add contact button.
-rw-r--r--res/menu/dialpad_options.xml5
-rw-r--r--res/values/strings.xml1
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java31
3 files changed, 19 insertions, 18 deletions
diff --git a/res/menu/dialpad_options.xml b/res/menu/dialpad_options.xml
index 27a9b8aca..c6b5dda80 100644
--- a/res/menu/dialpad_options.xml
+++ b/res/menu/dialpad_options.xml
@@ -15,6 +15,11 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
+ android:id="@+id/menu_add_contact"
+ android:title="@string/add_contact"
+ android:showAsAction="withText"
+ android:orderInCategory="1" />
+ <item
android:id="@+id/menu_2s_pause"
android:title="@string/add_2sec_pause"
android:showAsAction="withText"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 19a4ffac1..6abeb553a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -322,6 +322,7 @@
<string name="menu_show_all_calls">Show all calls</string>
<!-- Menu items for dialpad options as part of Pause and Wait ftr -->
+ <string name="add_contact">Add contact</string>
<string name="add_2sec_pause">Add 2-sec pause</string>
<string name="add_wait">Add wait</string>
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;