summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/menu/dialtacts_options.xml3
-rw-r--r--res/values/strings.xml9
-rw-r--r--src/com/android/dialer/DialtactsActivity.java23
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;
}