diff options
author | Nancy Chen <nancychen@google.com> | 2014-06-10 18:30:28 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-06-12 15:57:14 -0700 |
commit | beededb3fb7b3fcc9fa87f2a3ea50cac7415c794 (patch) | |
tree | 4371008a8facc764762db0cb9319c9b8fdef8345 | |
parent | 7f72adf51f2fadb6f1a34f16f8e602c626d536d9 (diff) |
Add menu items for multi-sim support
The main overflow menu will display a "select SIM card" option
when more than one sim is available.
Bug: 15473965
Change-Id: I18175cec57158f0a8189979849f6ad761eff1aff
-rw-r--r-- | res/menu/dialtacts_options.xml | 3 | ||||
-rw-r--r-- | res/values/strings.xml | 9 | ||||
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 23 |
3 files changed, 32 insertions, 3 deletions
diff --git a/res/menu/dialtacts_options.xml b/res/menu/dialtacts_options.xml index 17f4d9fe1..d1c885409 100644 --- a/res/menu/dialtacts_options.xml +++ b/res/menu/dialtacts_options.xml @@ -20,6 +20,9 @@ android:icon="@drawable/ic_menu_history_lt" android:title="@string/action_menu_call_history_description" /> <item + android:id="@+id/menu_select_sim" + android:title="@string/menu_select_sim" /> + <item android:id="@+id/menu_import_export" android:title="@string/menu_import_export" /> <item diff --git a/res/values/strings.xml b/res/values/strings.xml index 481611463..98f90d2ae 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -321,18 +321,21 @@ <!-- Menu item used to show all calls in the call log. [CHAR LIMIT=30] --> <string name="menu_show_all_calls">Show all calls</string> - <!-- Menu items for dialpad options as part of Pause and Wait ftr --> + <!-- Menu items for dialpad options as part of Pause and Wait ftr [CHAR LIMIT=30] --> <string name="add_contact">Add contact</string> <string name="add_2sec_pause">Add 2-sec pause</string> <string name="add_wait">Add wait</string> + <!-- Menu item to select SIM card [CHAR LIMIT=30] --> + <string name="menu_select_sim">Select SIM card</string> + <!-- Menu item label for call settings [CHAR LIMIT=30] --> <string name="call_settings">Settings</string> - <!-- Menu item to create a new contact --> + <!-- Menu item to create a new contact [CHAR LIMIT=30] --> <string name="menu_newContact">New contact</string> - <!-- Menu item to display all contacts --> + <!-- Menu item to display all contacts [CHAR LIMIT=30] --> <string name="menu_allContacts">All contacts</string> <!-- Title bar for call detail screen --> diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 414569031..a9eb21779 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -66,6 +66,7 @@ import com.android.contacts.common.CallUtil; import com.android.contacts.common.activity.TransactionSafeActivity; import com.android.contacts.common.animation.AnimationListenerAdapter; import com.android.contacts.common.dialog.ClearFrequentsDialog; +import com.android.contacts.common.dialog.SelectSIMDialogFragment; import com.android.contacts.common.interactions.ImportExportDialogFragment; import com.android.contacts.common.list.OnPhoneNumberPickerActionListener; import com.android.contacts.common.util.ViewUtil; @@ -106,6 +107,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O OnDragDropListener, OnPhoneNumberPickerActionListener, PopupMenu.OnMenuItemClickListener, + SelectSIMDialogFragment.OnClickOkListener, ViewPager.OnPageChangeListener, ActionBarController.ActivityUi { private static final String TAG = "DialtactsActivity"; @@ -140,6 +142,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private static final int ACTIVITY_REQUEST_CODE_VOICE_SEARCH = 1; + /** + * Constant to indicate there is only one service provider available. + */ + private static final int NO_MULTI_SIM = -1; + private FrameLayout parentLayout; /** @@ -194,6 +201,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private boolean mIsLandscape; /** + * Information about the currently selected SIM card. + */ + private int mCurrentSimCard = NO_MULTI_SIM; + + /** * The position of the currently selected tab in the attached {@link ListsFragment}. */ private int mCurrentTabPosition = 0; @@ -594,11 +606,19 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O case R.id.menu_call_settings: handleMenuSettings(); return true; + case R.id.menu_select_sim: + SelectSIMDialogFragment.show(getFragmentManager(), mCurrentSimCard); + return true; } return false; } @Override + public void passSimUpdate(int simId) { + mCurrentSimCard = simId; + } + + @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == ACTIVITY_REQUEST_CODE_VOICE_SEARCH) { if (resultCode == RESULT_OK) { @@ -764,6 +784,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O private OptionsPopupMenu buildOptionsMenu(View invoker) { final OptionsPopupMenu popupMenu = new OptionsPopupMenu(this, invoker); popupMenu.inflate(R.menu.dialtacts_options); + final Menu menu = popupMenu.getMenu(); + final MenuItem selectSim = menu.findItem(R.id.menu_select_sim); + selectSim.setVisible(mCurrentSimCard != NO_MULTI_SIM); popupMenu.setOnMenuItemClickListener(this); return popupMenu; } |