summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhab Awad <ihab@google.com>2014-03-20 22:56:16 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-20 22:56:16 +0000
commitf19c50fc0fde55699f7642317bdb44af6bd429af (patch)
treeff0bcaaffb8bf8826fa625fc3af96f058c259d1f
parentc1f2a2135162a48607a3e333b13b8e36e62732d9 (diff)
parentaace94afdd4308cb38f4cc2b0c0374fa7377fe09 (diff)
am aace94af: DO NOT MERGE. Fix problem where swiping upward in overflow menu did not display the correct options menu items.
* commit 'aace94afdd4308cb38f4cc2b0c0374fa7377fe09': DO NOT MERGE. Fix problem where swiping upward in overflow menu did not display the correct options menu items.
-rw-r--r--src/com/android/dialer/DialtactsActivity.java28
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java11
2 files changed, 25 insertions, 14 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index b54134e6b..5294deb20 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -152,6 +152,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
private View mDialpadButton;
private View mDialButton;
private PopupMenu mOverflowMenu;
+ private PopupMenu mDialpadOverflowMenu;
// Padding view used to shift the fragment frame up when the dialpad is shown so that
// the contents of the fragment frame continue to exist in a layout of the same height
@@ -353,6 +354,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
@Override
protected void onResume() {
super.onResume();
+ setupFakeActionBarItems();
if (mFirstLaunch) {
displayFragment(getIntent());
} else if (!phoneIsInUse() && mInCallDialpadUp) {
@@ -457,7 +459,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
switch (view.getId()) {
case R.id.overflow_menu: {
if (isDialpadShowing()) {
- mDialpadFragment.optionsMenuInvoked(view);
+ mDialpadOverflowMenu.show();
} else {
mOverflowMenu.show();
}
@@ -551,6 +553,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
ft.commit();
mDialButton.setVisibility(shouldShowOnscreenDialButton() ? View.VISIBLE : View.GONE);
mDialpadButton.setVisibility(View.GONE);
+ mMenuButton.setOnTouchListener(mDialpadOverflowMenu.getDragToOpenListener());
}
public void hideDialpadFragment(boolean animate, boolean clearDialpad) {
@@ -568,6 +571,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
ft.commit();
mDialButton.setVisibility(View.GONE);
mDialpadButton.setVisibility(View.VISIBLE);
+ mMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener());
}
private void prepareSearchView() {
@@ -670,16 +674,17 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
});
}
-
- public void setupFakeActionBarItems() {
+ private void setupFakeActionBarItems() {
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);
+ if (mOverflowMenu == null) {
+ mOverflowMenu = buildOptionsMenu(mMenuButton);
+ }
+ if (mDialpadOverflowMenu == null) {
+ mDialpadOverflowMenu = mDialpadFragment.buildOptionsMenu(mMenuButton);
+ }
+ // Initial state is with dialpad fragment not shown
mMenuButton.setOnTouchListener(mOverflowMenu.getDragToOpenListener());
}
@@ -698,6 +703,13 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
mDialpadButton.setOnClickListener(this);
}
+ private PopupMenu buildOptionsMenu(View invoker) {
+ PopupMenu menu = new OverflowPopupMenu(this, invoker);
+ menu.inflate(R.menu.dialtacts_options);
+ menu.setOnMenuItemClickListener(this);
+ return menu;
+ }
+
private void fixIntent(Intent intent) {
// This should be cleaned up: the call key used to send an Intent
// that just said to go to the recent calls list. It now sends this
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index a1844236d..d25ffefde 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -931,18 +931,17 @@ public class DialpadFragment extends Fragment
}
/**
- * Called by the containing Activity to tell this Fragment that the gesture to display the
- * "options" menu has been invoked.
+ * Called by the containing Activity to tell this Fragment to build an overflow options
+ * menu for display by the container when appropriate.
*
* @param invoker the View that invoked the options menu, to act as an anchor location.
*/
- public void optionsMenuInvoked(View invoker) {
+ public PopupMenu buildOptionsMenu(View invoker) {
final PopupMenu popupMenu = new PopupMenu(getActivity(), invoker);
- final Menu menu = popupMenu.getMenu();
popupMenu.inflate(R.menu.dialpad_options);
popupMenu.setOnMenuItemClickListener(this);
- setupMenuItems(menu);
- popupMenu.show();
+ setupMenuItems(popupMenu.getMenu());
+ return popupMenu;
}
/**