From 4c92456688e34683c2879d89b6011b741b33a379 Mon Sep 17 00:00:00 2001 From: Nancy Chen Date: Wed, 11 Jun 2014 15:31:16 -0700 Subject: Add select sim dialog for dialpad menu Also handles passing sim card information set in dialer menu to the dialpad fragment. Bug: 15473965 Change-Id: I075bf727402ba315c035eb741c563aafe67d60f6 --- src/com/android/dialer/dialpad/DialpadFragment.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/com/android/dialer/dialpad/DialpadFragment.java') diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 134c2a7f4..bb5880295 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -71,6 +71,7 @@ import android.widget.TextView; import com.android.contacts.common.CallUtil; import com.android.contacts.common.GeoUtil; +import com.android.contacts.common.dialog.SelectSIMDialogFragment; import com.android.contacts.common.dialpad.DialpadKeyButton; import com.android.contacts.common.dialpad.DialpadView; import com.android.contacts.common.util.PhoneNumberFormatter; @@ -98,6 +99,16 @@ public class DialpadFragment extends Fragment DialpadKeyButton.OnPressedListener { private static final String TAG = DialpadFragment.class.getSimpleName(); + /** + * Constant to indicate there is only a single service provider available + */ + private static final int NO_MULTI_SIM = -1; + + /** + * Information about the currently selected SIM card. + */ + private int mCurrentSimCard = NO_MULTI_SIM; + /** * This interface allows the DialpadFragment to tell its hosting Activity when and when not * to display the "dial" button. While this is logically part of the DialpadFragment, the @@ -850,7 +861,9 @@ public class DialpadFragment extends Fragment @Override public void show() { final Menu menu = getMenu(); + final MenuItem selectSim = menu.findItem(R.id.menu_select_sim); final MenuItem sendMessage = menu.findItem(R.id.menu_send_message); + selectSim.setVisible(mCurrentSimCard != NO_MULTI_SIM); sendMessage.setVisible(mSmsPackageComponentName != null); boolean enable = !isDigitsEmpty(); @@ -1435,6 +1448,10 @@ public class DialpadFragment extends Fragment smsIntent.setComponent(mSmsPackageComponentName); DialerUtils.startActivityWithErrorToast(getActivity(), smsIntent); } + case R.id.menu_select_sim: + SelectSIMDialogFragment.show(getFragmentManager(), mCurrentSimCard); + return true; + default: return false; } @@ -1604,6 +1621,10 @@ public class DialpadFragment extends Fragment return mAnimate; } + public void setSimCard(int simId) { + mCurrentSimCard = simId; + } + public void setYFraction(float yFraction) { ((DialpadSlidingLinearLayout) getView()).setYFraction(yFraction); } -- cgit v1.2.3