summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-09-25 16:17:06 -0700
committerYorke Lee <yorkelee@google.com>2013-09-25 16:17:06 -0700
commit36c5413800ecd06d4d93a9e5333078fc7fbcf1d6 (patch)
tree1b7daf0820c80e44a6d9978011cffd835ac767ee
parent3b8086e02bd3855f867da1b062d008b62add553e (diff)
Add drag to open functionality to Dialer overflow menu
Bug: 10904260 Change-Id: I18fef2f553ab2598c87972ed887b0221108957f8
-rw-r--r--src/com/android/dialer/DialtactsActivity.java29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 05c9e2c2a..a9855901f 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -141,6 +141,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
private View mMenuButton;
private View mCallHistoryButton;
private View mDialpadButton;
+ private PopupMenu mOverflowMenu;
// Padding view used to shift the fragments up when the dialpad is shown.
private View mBottomPaddingView;
@@ -182,6 +183,20 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
}
};
+ private class OverflowPopupMenu extends PopupMenu {
+ public OverflowPopupMenu(Context context, View anchor) {
+ super(context, anchor);
+ }
+
+ @Override
+ public void show() {
+ final Menu menu = getMenu();
+ final MenuItem clearFrequents = menu.findItem(R.id.menu_clear_frequents);
+ clearFrequents.setVisible(mPhoneFavoriteFragment.hasFrequents());
+ super.show();
+ }
+ }
+
/**
* Listener used when one of phone numbers in search UI is selected. This will initiate a
* phone call using the phone number.
@@ -409,13 +424,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
public void onClick(View view) {
switch (view.getId()) {
case R.id.overflow_menu: {
- final PopupMenu popupMenu = new PopupMenu(DialtactsActivity.this, view);
- final Menu menu = popupMenu.getMenu();
- popupMenu.inflate(R.menu.dialtacts_options);
- final MenuItem clearFrequents = menu.findItem(R.id.menu_clear_frequents);
- clearFrequents.setVisible(mPhoneFavoriteFragment.hasFrequents());
- popupMenu.setOnMenuItemClickListener(this);
- popupMenu.show();
+ mOverflowMenu.show();
break;
}
case R.id.dialpad_button:
@@ -591,6 +600,12 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
mMenuButton = findViewById(R.id.overflow_menu);
if (mMenuButton != null) {
mMenuButton.setOnClickListener(this);
+
+ mOverflowMenu = new OverflowPopupMenu(DialtactsActivity.this, mMenuButton);
+ final Menu menu = mOverflowMenu.getMenu();
+ mOverflowMenu.inflate(R.menu.dialtacts_options);
+ mOverflowMenu.setOnMenuItemClickListener(this);
+ mMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener());
}
mCallHistoryButton = findViewById(R.id.call_history_button);