summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Bird <sbird@cyngn.com>2016-03-02 10:12:29 -0800
committerStephen Bird <sbird@cyngn.com>2016-04-08 10:21:11 -0700
commit86d7d78aa9926ea646dcef0f4555c4f590c99aa9 (patch)
treeccba7e8b419319ffab6a75ce8ff3aebc1a6fbdee
parentdde67a8ddcea0a0e2f4a247d308464d8dea848a6 (diff)
downloadandroid_packages_apps_Dialer-86d7d78aa9926ea646dcef0f4555c4f590c99aa9.tar.gz
android_packages_apps_Dialer-86d7d78aa9926ea646dcef0f4555c4f590c99aa9.tar.bz2
android_packages_apps_Dialer-86d7d78aa9926ea646dcef0f4555c4f590c99aa9.zip
Fix crash where overflow does not exist
In some situations, the overflow menu is not yet setup or needs to be reconfigured when the call method has changed. Change-Id: I15fd8318bd9c3685ae2855d00b6216a138d92eb3
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index de51d9bc1..fac77ff9c 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -464,9 +464,7 @@ public class DialpadFragment extends Fragment
} else {
CreditBarHelper.clearCallRateInformation(mDialpadView.getRateContainer(), cbvl);
}
- mOverflowMenuButton.setVisibility(isDigitsEmpty() ||
- (mCurrentCallMethodInfo != null && mCurrentCallMethodInfo.mIsInCallProvider) ?
- View.INVISIBLE : View.VISIBLE);
+ updateOptionsMenu();
}
public void setCurrentCallMethod(CallMethodInfo callMethodInfo) {
@@ -758,19 +756,16 @@ public class DialpadFragment extends Fragment
stopWatch.stopAndLog(TAG, 50);
- // Populate the overflow menu in onResume instead of onCreate, so that if the SMS activity
- // is disabled while Dialer is paused, the "Send a text message" option can be correctly
- // removed when resumed.
- mOverflowMenuButton = mDialpadView.getOverflowMenuButton();
- mOverflowPopupMenu = buildOptionsMenu(mOverflowMenuButton);
- mOverflowMenuButton.setOnTouchListener(mOverflowPopupMenu.getDragToOpenListener());
- mOverflowMenuButton.setOnClickListener(this);
-
// If a call method does not exist currently, get it from our dialer activity;
if (mCurrentCallMethodInfo == null) {
onCallMethodChanged(activity.getCurrentCallMethod());
}
+ // Populate the overflow menu in onResume instead of onCreate, so that if the SMS activity
+ // is disabled while Dialer is paused, the "Send a text message" option can be correctly
+ // removed when resumed.
+ updateOptionsMenu();
+
if (mFirstLaunch) {
// The onHiddenChanged callback does not get called the first time the fragment is
// attached, so call it ourselves here.
@@ -781,6 +776,21 @@ public class DialpadFragment extends Fragment
Trace.endSection();
}
+ private void updateOptionsMenu() {
+ if (mOverflowMenuButton == null) {
+ mOverflowMenuButton = mDialpadView.getOverflowMenuButton();
+ if (mOverflowMenuButton == null) {
+ return;
+ }
+ mOverflowPopupMenu = buildOptionsMenu(mOverflowMenuButton);
+ mOverflowMenuButton.setOnTouchListener(mOverflowPopupMenu.getDragToOpenListener());
+ mOverflowMenuButton.setOnClickListener(this);
+ }
+ mOverflowMenuButton.setVisibility(isDigitsEmpty() ||
+ (mCurrentCallMethodInfo != null && mCurrentCallMethodInfo.mIsInCallProvider) ?
+ View.INVISIBLE : View.VISIBLE);
+ }
+
@Override
public void onPause() {
super.onPause();