From 8e0662990043a3b430a96d8e94b9d773f5a4deff Mon Sep 17 00:00:00 2001 From: Nancy Chen Date: Wed, 18 Jun 2014 17:16:10 -0700 Subject: Add reference to TelephonyManager, renaming, remove checkbox (1/2) Incorporating API calls to TelephonyManager.getSubscriptions. Added new SubscriptionManager class to wrap data about subscriptions for the purpose of passing between Dialer and its fragments. * This particular CL deals with the renaming of the menu strings and the * passing of data between the Dialer and its fragments. Bug: 15473965 Change-Id: Id52b925c618952bd77970c157fa63e665203b04c --- .../android/dialer/dialpad/DialpadFragment.java | 25 ++++++++-------------- 1 file changed, 9 insertions(+), 16 deletions(-) (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 bb5880295..e7ae7ccad 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -71,7 +71,8 @@ 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.SubscriptionManager; +import com.android.contacts.common.dialog.SelectSubscriptionDialogFragment; import com.android.contacts.common.dialpad.DialpadKeyButton; import com.android.contacts.common.dialpad.DialpadView; import com.android.contacts.common.util.PhoneNumberFormatter; @@ -99,15 +100,7 @@ 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; + private static SubscriptionManager mSubscriptionManager; /** * This interface allows the DialpadFragment to tell its hosting Activity when and when not @@ -861,9 +854,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 selectSubscription = menu.findItem(R.id.menu_select_subscription); final MenuItem sendMessage = menu.findItem(R.id.menu_send_message); - selectSim.setVisible(mCurrentSimCard != NO_MULTI_SIM); + selectSubscription.setVisible(mSubscriptionManager != null); sendMessage.setVisible(mSmsPackageComponentName != null); boolean enable = !isDigitsEmpty(); @@ -1448,8 +1441,8 @@ public class DialpadFragment extends Fragment smsIntent.setComponent(mSmsPackageComponentName); DialerUtils.startActivityWithErrorToast(getActivity(), smsIntent); } - case R.id.menu_select_sim: - SelectSIMDialogFragment.show(getFragmentManager(), mCurrentSimCard); + case R.id.menu_select_subscription: + SelectSubscriptionDialogFragment.show(getFragmentManager(), mSubscriptionManager); return true; default: @@ -1621,8 +1614,8 @@ public class DialpadFragment extends Fragment return mAnimate; } - public void setSimCard(int simId) { - mCurrentSimCard = simId; + public void setSubscriptionManager(SubscriptionManager subscriptionManager) { + mSubscriptionManager = subscriptionManager; } public void setYFraction(float yFraction) { -- cgit v1.2.3