diff options
author | Yorke Lee <yorkelee@google.com> | 2014-04-22 17:20:00 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-04-23 17:21:38 -0700 |
commit | a5d5cdf2ed131289943033cfd775dd34ffd7ff45 (patch) | |
tree | efe9512afa45b5e1f802eadd511a73af555c88e3 | |
parent | d999b71452baebec789f6f58f1955d30e834826d (diff) |
Add floating dialpad action button
* Replace fake action bar at the bottom of the screen with a floating
action button which casts a shadow.
* Remove the now unused mDialpadOverflowMenu button in DialtactsActivity
* Modify dialpad layout to add a bottom row of buttons which provide
access to the add contact button and overflow menu
* Fix dialpad layout so the heights applied in XML are actually
respected - previously they were being ignored and each dialpad key
was being assigned the height of MATCH_PARENT
Bug: 13932988
Change-Id: I6e48c00c5ceeeffed142c3dd259e630d6daf8111
-rw-r--r-- | res/drawable-hdpi/ic_overflow_menu.png | bin | 0 -> 645 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_overflow_menu.png | bin | 0 -> 645 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/ic_overflow_menu.png | bin | 0 -> 801 bytes | |||
-rw-r--r-- | res/drawable-xxhdpi/ic_overflow_menu.png | bin | 0 -> 801 bytes | |||
-rw-r--r-- | res/layout/dialpad.xml | 67 | ||||
-rw-r--r-- | res/layout/dialpad_digits.xml | 1 | ||||
-rw-r--r-- | res/layout/dialpad_fragment.xml | 8 | ||||
-rw-r--r-- | res/layout/dialpad_key.xml | 2 | ||||
-rw-r--r-- | res/layout/dialtacts_activity.xml | 44 | ||||
-rw-r--r-- | res/menu/dialpad_options.xml | 5 | ||||
-rw-r--r-- | res/values/dimens.xml | 17 | ||||
-rw-r--r-- | res/values/strings.xml | 3 | ||||
-rw-r--r-- | res/values/styles.xml | 4 | ||||
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 57 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 43 |
15 files changed, 152 insertions, 99 deletions
diff --git a/res/drawable-hdpi/ic_overflow_menu.png b/res/drawable-hdpi/ic_overflow_menu.png Binary files differnew file mode 100644 index 000000000..017005710 --- /dev/null +++ b/res/drawable-hdpi/ic_overflow_menu.png diff --git a/res/drawable-mdpi/ic_overflow_menu.png b/res/drawable-mdpi/ic_overflow_menu.png Binary files differnew file mode 100644 index 000000000..017005710 --- /dev/null +++ b/res/drawable-mdpi/ic_overflow_menu.png diff --git a/res/drawable-xhdpi/ic_overflow_menu.png b/res/drawable-xhdpi/ic_overflow_menu.png Binary files differnew file mode 100644 index 000000000..777384102 --- /dev/null +++ b/res/drawable-xhdpi/ic_overflow_menu.png diff --git a/res/drawable-xxhdpi/ic_overflow_menu.png b/res/drawable-xxhdpi/ic_overflow_menu.png Binary files differnew file mode 100644 index 000000000..777384102 --- /dev/null +++ b/res/drawable-xxhdpi/ic_overflow_menu.png diff --git a/res/layout/dialpad.xml b/res/layout/dialpad.xml index c13f525be..df6f527e9 100644 --- a/res/layout/dialpad.xml +++ b/res/layout/dialpad.xml @@ -42,20 +42,36 @@ android:baselineAlignBottom="true" /> </LinearLayout> </com.android.dialer.dialpad.DialpadKeyButton> - <include layout="@layout/dialpad_key" android:id="@+id/two"/> - <include layout="@layout/dialpad_key" android:id="@+id/three"/> + <include layout="@layout/dialpad_key" + android:id="@+id/two" + style="@style/DialpadKeyButtonStyle" /> + <include layout="@layout/dialpad_key" + android:id="@+id/three" + style="@style/DialpadKeyButtonStyle" /> </TableRow> <TableRow> - <include layout="@layout/dialpad_key" android:id="@+id/four"/> - <include layout="@layout/dialpad_key" android:id="@+id/five"/> - <include layout="@layout/dialpad_key" android:id="@+id/six"/> + <include layout="@layout/dialpad_key" + android:id="@+id/four" + style="@style/DialpadKeyButtonStyle" /> + <include layout="@layout/dialpad_key" + android:id="@+id/five" + style="@style/DialpadKeyButtonStyle" /> + <include layout="@layout/dialpad_key" + android:id="@+id/six" + style="@style/DialpadKeyButtonStyle" /> </TableRow> <TableRow> - <include layout="@layout/dialpad_key" android:id="@+id/seven"/> - <include layout="@layout/dialpad_key" android:id="@+id/eight"/> - <include layout="@layout/dialpad_key" android:id="@+id/nine"/> + <include layout="@layout/dialpad_key" + android:id="@+id/seven" + style="@style/DialpadKeyButtonStyle" /> + <include layout="@layout/dialpad_key" + android:id="@+id/eight" + style="@style/DialpadKeyButtonStyle" /> + <include layout="@layout/dialpad_key" + android:id="@+id/nine" + style="@style/DialpadKeyButtonStyle" /> </TableRow> <TableRow> @@ -72,7 +88,9 @@ android:layout_width="@dimen/dialpad_key_letters_width" /> </LinearLayout> </com.android.dialer.dialpad.DialpadKeyButton> - <include layout="@layout/dialpad_key" android:id="@+id/zero"/> + <include layout="@layout/dialpad_key" + android:id="@+id/zero" + style="@style/DialpadKeyButtonStyle" /> <com.android.dialer.dialpad.DialpadKeyButton android:id="@+id/pound" style="@style/DialpadKeyButtonStyle"> @@ -87,4 +105,35 @@ </LinearLayout> </com.android.dialer.dialpad.DialpadKeyButton> </TableRow> + + <TableRow> + <FrameLayout + android:id="@+id/dialpad_add_contact" + android:contentDescription="@string/description_add_contact" + style="@style/DialpadBottomKeyButtonStyle" + android:visibility="invisible" + > + <ImageView + android:src="@drawable/ic_add_person_dk" + android:importantForAccessibility="no" + android:paddingRight="@dimen/dialpad_key_letters_width" + style="@style/DialpadKeyInternalLayoutStyle" + /> + </FrameLayout> + <Space + style="@style/DialpadBottomKeyButtonStyle" + /> + <FrameLayout + android:id="@+id/dialpad_overflow" + android:contentDescription="@string/description_dialpad_overflow" + style="@style/DialpadBottomKeyButtonStyle" + > + <ImageView + android:src="@drawable/ic_overflow_menu" + android:importantForAccessibility="no" + android:paddingRight="@dimen/dialpad_key_letters_width" + style="@style/DialpadKeyInternalLayoutStyle" + /> + </FrameLayout> + </TableRow> </TableLayout> diff --git a/res/layout/dialpad_digits.xml b/res/layout/dialpad_digits.xml index 21638f0c0..55fd27ed1 100644 --- a/res/layout/dialpad_digits.xml +++ b/res/layout/dialpad_digits.xml @@ -38,7 +38,6 @@ android:textSize="@dimen/dialpad_digits_text_size" android:freezesText="true" android:focusableInTouchMode="true" - android:editable="true" android:cursorVisible="false" android:textColor="@color/dialpad_digits_text_color" android:textCursorDrawable="@null" diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml index d285cc313..9d3c62043 100644 --- a/res/layout/dialpad_fragment.xml +++ b/res/layout/dialpad_fragment.xml @@ -32,13 +32,13 @@ android:background="@drawable/shadow_fade_up" /> <view class="com.android.dialer.dialpad.DialpadFragment$HoverIgnoringLinearLayout" android:id="@+id/top" - android:animateLayoutChanges="true" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_gravity="bottom" android:orientation="vertical" android:layoutDirection="ltr" - android:background="@color/background_dialpad"> + android:background="@color/background_dialpad" + android:clickable="true"> <Space android:layout_width="match_parent" @@ -47,13 +47,13 @@ <Space android:layout_width="match_parent" - android:layout_height="10dp" /> + android:layout_height="5dp" /> <include layout="@layout/dialpad_digits" /> <Space android:layout_width="match_parent" - android:layout_height="8dp" /> + android:layout_height="4dp" /> <include layout="@layout/dialpad" /> diff --git a/res/layout/dialpad_key.xml b/res/layout/dialpad_key.xml index 5bf858c43..abbe4f9cd 100644 --- a/res/layout/dialpad_key.xml +++ b/res/layout/dialpad_key.xml @@ -17,7 +17,7 @@ <!-- A layout representing a single key in the dialpad --> <com.android.dialer.dialpad.DialpadKeyButton xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/DialpadKeyButtonStyle"> + style="@style/DialpadKeyButtonStyle" > <LinearLayout style="@style/DialpadKeyInternalLayoutStyle"> diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml index 2513216fc..50049afa0 100644 --- a/res/layout/dialtacts_activity.xml +++ b/res/layout/dialtacts_activity.xml @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -<LinearLayout +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dialtacts_mainlayout" android:layout_width="match_parent" @@ -27,8 +27,7 @@ <RelativeLayout android:id="@+id/dialtacts_container" android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" + android:layout_height="match_parent" android:clipChildren="false"> <!-- The main contacts grid --> <FrameLayout @@ -117,45 +116,28 @@ </com.android.dialer.list.RemoveView> </FrameLayout> </RelativeLayout> - <!-- TODO: To be removed entirely and replaced with a floating action button --> <FrameLayout - android:layout_height="@dimen/fake_action_bar_height" - android:layout_width="match_parent" - android:id="@+id/fake_action_bar" - android:background="@color/actionbar_background_color"> - <ImageButton - android:id="@+id/call_history_button" - android:layout_width="@dimen/fake_menu_button_min_width" - android:layout_height="match_parent" - android:layout_gravity="bottom|start" - android:background="?android:attr/selectableItemBackground" - android:contentDescription="@string/action_menu_call_history_description" - android:src="@drawable/ic_menu_history_lt"/> + android:layout_height="@dimen/floating_action_button_height" + android:layout_width="@dimen/floating_action_button_width" + android:layout_marginBottom="@dimen/floating_action_button_margin_bottom" + android:id="@+id/floating_action_button" + android:background="@color/actionbar_background_color" + android:layout_centerHorizontal="true" + android:layout_alignParentBottom="true" > <ImageButton android:id="@+id/dialpad_button" - android:layout_width="@dimen/fake_menu_button_min_width" + android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_gravity="bottom|center" android:background="?android:attr/selectableItemBackground" android:contentDescription="@string/action_menu_dialpad_button" android:src="@drawable/ic_menu_dialpad_lt"/> <ImageButton android:id="@+id/dial_button" - android:layout_width="@dimen/fake_action_bar_height" - android:layout_height="@dimen/fake_action_bar_height" - android:layout_gravity="bottom|center" + android:layout_width="match_parent" + android:layout_height="match_parent" android:background="@drawable/btn_call" android:contentDescription="@string/description_dial_button" android:src="@drawable/ic_dial_action_call" android:visibility="gone" /> - <ImageButton - android:id="@+id/overflow_menu_button" - android:layout_width="@dimen/fake_menu_button_min_width" - android:layout_height="match_parent" - android:layout_gravity="bottom|end" - android:visibility="gone" - android:src="@drawable/ic_menu_overflow_lt" - android:contentDescription="@string/action_menu_overflow_description" - android:background="?android:attr/selectableItemBackground"/> </FrameLayout> -</LinearLayout> +</RelativeLayout> diff --git a/res/menu/dialpad_options.xml b/res/menu/dialpad_options.xml index 0727dd57c..27a9b8aca 100644 --- a/res/menu/dialpad_options.xml +++ b/res/menu/dialpad_options.xml @@ -15,11 +15,6 @@ --> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item - android:id="@+id/menu_add_contacts" - android:title="@string/recentCalls_addToContact" - 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/dimens.xml b/res/values/dimens.xml index 496eb433d..d9473617d 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -51,11 +51,13 @@ <dimen name="dialpad_key_numbers_width">30dp</dimen> <dimen name="dialpad_key_letters_width">50dp</dimen> <dimen name="dialpad_key_height">56dp</dimen> + <!-- The bottom row of the dialpad is slightly taller to account for the dial button --> + <dimen name="dialpad_bottom_key_height">70dp</dimen> <dimen name="dialpad_key_plus_size">18sp</dimen> <dimen name="dialpad_number_to_letters_padding">11dp</dimen> <dimen name="dialpad_horizontal_padding">5dp</dimen> - <dimen name="dialpad_digits_text_size">36sp</dimen> - <dimen name="dialpad_digits_height">47dp</dimen> + <dimen name="dialpad_digits_text_size">33sp</dimen> + <dimen name="dialpad_digits_height">55dp</dimen> <dimen name="dialpad_digits_padding">16dp</dimen> <dimen name="dialpad_digits_margin_bottom">0px</dimen> <dimen name="dialpad_center_margin">3dp</dimen> @@ -63,9 +65,14 @@ <!-- Match call_button_height to Phone's dimens/in_call_end_button_height --> <dimen name="call_button_height">74dp</dimen> - <dimen name="fake_action_bar_height">60dp</dimen> - <!-- Min width of fake menu buttons, which should be same as ActionBar's one --> - <dimen name="fake_menu_button_min_width">56dp</dimen> + <!-- Height of the floating action button --> + <dimen name="floating_action_button_height">60dp</dimen> + <!-- Width of the floating action button --> + <dimen name="floating_action_button_width">60dp</dimen> + <!-- Bottom margin of the floating action button --> + <dimen name="floating_action_button_margin_bottom">10dp</dimen> + <!-- Z translation of the floating action button --> + <dimen name="floating_action_button_translation_z">5dp</dimen> <!-- Favorites tile and recent call log padding --> <dimen name="contact_tile_divider_width">1dp</dimen> diff --git a/res/values/strings.xml b/res/values/strings.xml index bd9aefb2d..2575a0b1a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -427,6 +427,9 @@ --> <string name="description_add_contact">Add contact</string> + <!-- String describing the overflow menu button in the dialpad --> + <string name="description_dialpad_overflow">More options</string> + <!-- String describing the button to view the contact for the current number. Note: AccessibilityServices use this attribute to announce what the view represents. diff --git a/res/values/styles.xml b/res/values/styles.xml index 381ee3565..a0e8aebf1 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -144,6 +144,10 @@ <item name="android:focusable">true</item> </style> + <style name="DialpadBottomKeyButtonStyle" parent="DialpadKeyButtonStyle"> + <item name="android:layout_height">@dimen/dialpad_bottom_key_height</item> + </style> + <style name="DialpadKeyInternalLayoutStyle"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 3f490069c..5dabb930d 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -45,6 +45,7 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; +import android.view.View.OnClickListener; import android.view.View.OnLayoutChangeListener; import android.view.ViewGroup.LayoutParams; import android.view.ViewTreeObserver.OnGlobalLayoutListener; @@ -151,12 +152,10 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O */ private ListsFragment mListsFragment; - private View mFakeActionBar; + private View mFloatingActionButton; private View mMenuButton; - private View mCallHistoryButton; private View mDialpadButton; private View mDialButton; - private PopupMenu mDialpadOverflowMenu; private View mFragmentsFrame; @@ -329,16 +328,13 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mFragmentsFrame = findViewById(R.id.dialtacts_frame); - mFakeActionBar = findViewById(R.id.fake_action_bar); + mFloatingActionButton = findViewById(R.id.floating_action_button); + setupFloatingActionButton(mFloatingActionButton); - mCallHistoryButton = findViewById(R.id.call_history_button); - mCallHistoryButton.setOnClickListener(this); mDialButton = findViewById(R.id.dial_button); mDialButton.setOnClickListener(this); mDialpadButton = findViewById(R.id.dialpad_button); mDialpadButton.setOnClickListener(this); - mMenuButton = findViewById(R.id.overflow_menu_button); - mMenuButton.setOnClickListener(this); mRemoveViewContainer = (RemoveView) findViewById(R.id.remove_view_container); mSearchAndRemoveViewContainer = findViewById(R.id.search_and_remove_view_container); @@ -416,9 +412,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onClick(View view) { switch (view.getId()) { - case R.id.overflow_menu_button: - mDialpadOverflowMenu.show(); - break; case R.id.dialpad_button: // Reset the boolean flag that tracks whether the dialpad was up because // we were in call. Regardless of whether it was true before, we want to @@ -427,9 +420,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mInCallDialpadUp = false; showDialpadFragment(true); break; - case R.id.call_history_button: - showCallHistory(); - break; case R.id.dial_button: // Dial button was pressed; tell the Dialpad fragment mDialpadFragment.dialButtonPressed(); @@ -582,11 +572,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O public void onDialpadShown() { mDialButton.setVisibility(View.VISIBLE); mDialpadButton.setVisibility(View.GONE); - mMenuButton.setVisibility(View.VISIBLE); - if (mDialpadOverflowMenu == null) { - mDialpadOverflowMenu = mDialpadFragment.buildOptionsMenu(mMenuButton); - mMenuButton.setOnTouchListener(mDialpadOverflowMenu.getDragToOpenListener()); - } SearchFragment fragment = null; if (mInDialpadSearch) { @@ -612,7 +597,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O public void onDialpadHidden() { mDialButton.setVisibility(View.GONE); mDialpadButton.setVisibility(View.VISIBLE); - mMenuButton.setVisibility(View.GONE); SearchFragment fragment = null; if (mInDialpadSearch) { @@ -853,9 +837,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O // fragment manager correctly figure out whatever fragment was last displayed. return; } - if (mDialpadFragment != null) { - mDialpadOverflowMenu = mDialpadFragment.buildOptionsMenu(mMenuButton); - } mSearchView.setQuery(normalizedQuery, false); } } @@ -884,7 +865,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void setDialButtonContainerVisible(boolean visible) { - mFakeActionBar.setVisibility(visible ? View.VISIBLE : View.GONE); + mFloatingActionButton.setVisibility(visible ? View.VISIBLE : View.GONE); } private boolean phoneIsInUse() { @@ -907,6 +888,34 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O return resolveInfo != null && resolveInfo.size() > 0; } + private void setupFloatingActionButton(View view) { + // Once layout is complete and the floating action button has been assigned a width + // and height, assign the outline. + view.addOnLayoutChangeListener(new OnLayoutChangeListener() { + @Override + public void onLayoutChange(View v, + int left, + int top, + int right, + int bottom, + int oldLeft, + int oldTop, + int oldRight, + int oldBottom) { + final Outline outline = new Outline(); + final int minDimension = Math.min(right - left, bottom - top); + if (minDimension <= 0) { + return; + } + outline.setRoundRect(0, 0, right - left, bottom - top, minDimension / 2); + v.setOutline(outline); + v.setClipToOutline(true); + } + }); + view.setTranslationZ(getResources().getDimensionPixelSize( + R.dimen.floating_action_button_translation_z)); + } + @Override public void showCallHistory() { // Use explicit CallLogActivity intent instead of ACTION_VIEW + diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 703c27730..72abaa085 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -76,9 +76,11 @@ import com.android.dialer.NeededForReflection; import com.android.dialer.DialtactsActivity; import com.android.dialer.R; import com.android.dialer.SpecialCharSequenceMgr; +import com.android.dialer.util.DialerUtils; import com.android.internal.telephony.ITelephony; import com.android.phone.common.CallLogAsync; import com.android.phone.common.HapticFeedback; + import com.google.common.annotations.VisibleForTesting; import java.util.HashSet; @@ -199,6 +201,8 @@ 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; private final Object mToneGeneratorLock = new Object(); @@ -333,6 +337,9 @@ public class DialpadFragment extends Fragment if (isDigitsEmpty()) { mDigitsFilledByIntent = false; mDigits.setCursorVisible(false); + mAddContactButton.setVisibility(View.INVISIBLE); + } else { + mAddContactButton.setVisibility(View.VISIBLE); } if (mDialpadQueryListener != null) { @@ -612,8 +619,6 @@ public class DialpadFragment extends Fragment for (int i = 0; i < buttonIds.length; i++) { dialpadKey = (DialpadKeyButton) fragmentView.findViewById(buttonIds[i]); - dialpadKey.setLayoutParams(new TableRow.LayoutParams( - TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT)); dialpadKey.setOnPressedListener(this); numberView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_number); lettersView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_letters); @@ -637,6 +642,13 @@ public class DialpadFragment extends Fragment zero.setLongHoverContentDescription( resources.getText(R.string.description_image_button_plus)); + 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 @@ -768,22 +780,6 @@ public class DialpadFragment extends Fragment outState.putBoolean(PREF_DIGITS_FILLED_BY_INTENT, mDigitsFilledByIntent); } - private void setupMenuItems(Menu menu) { - final MenuItem addToContactMenuItem = menu.findItem(R.id.menu_add_contacts); - - // We show "add to contacts" menu only when the user is - // seeing usual dialpad and has typed at least one digit. - // We never show a menu if the "choose dialpad" UI is up. - if (dialpadChooserVisible() || isDigitsEmpty()) { - addToContactMenuItem.setVisible(false); - } else { - final CharSequence digits = mDigits.getText(); - // Put the current digits string into an intent - addToContactMenuItem.setIntent(DialtactsActivity.getAddNumberToContactIntent(digits)); - addToContactMenuItem.setVisible(true); - } - } - private void keyPressed(int keyCode) { if (getView().getTranslationY() != 0) { return; @@ -937,7 +933,6 @@ public class DialpadFragment extends Fragment final PopupMenu popupMenu = new PopupMenu(getActivity(), invoker); popupMenu.inflate(R.menu.dialpad_options); popupMenu.setOnMenuItemClickListener(this); - setupMenuItems(popupMenu.getMenu()); return popupMenu; } @@ -963,6 +958,16 @@ 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; + } default: { Log.wtf(TAG, "Unexpected onClick() event from: " + view); return; |