diff options
author | Nancy Chen <nancychen@google.com> | 2014-06-11 15:31:16 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-06-16 13:29:32 -0700 |
commit | 4c92456688e34683c2879d89b6011b741b33a379 (patch) | |
tree | 0dfa74f60b6b7686f7c6f8370c096d127f5b1781 /src | |
parent | b4f613a346fe788007d61ba6bfd39622ae624ed6 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 4 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 21 |
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); } |