summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/DialtactsActivity.java4
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java21
2 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index f5a2d3ed5..6144bb5af 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -609,6 +609,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
@Override
public void passSimUpdate(int simId) {
mCurrentSimCard = simId;
+ if (mIsDialpadShown) {
+ mDialpadFragment.setSimCard(simId);
+ }
}
@Override
@@ -641,6 +644,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
}
mIsDialpadShown = true;
mDialpadFragment.setAnimate(animate);
+ mDialpadFragment.setSimCard(mCurrentSimCard);
final FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.show(mDialpadFragment);
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;
@@ -99,6 +100,16 @@ public class DialpadFragment extends Fragment
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
* need to have a particular kind of slick animation puts the "dial" button in the parent.
@@ -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);
}