<string name="menu_makeDefaultEmail">Make default email</string>
<!-- Menu item that splits an item from the contact detail into a separate aggregate -->
- <string name="menu_splitAggregate">Split</string>
+ <string name="menu_splitAggregate">Separate</string>
<!-- Dialog title for the list of constituent contacts in the split aggregate dialog. -->
<string name="splitAggregate_title">Split contact</string>
<!-- Toast shown after a contact has been split from an aggregate by a user action -->
- <string name="contactsSplitMessage">Contact split</string>
+ <string name="contactsSplitMessage">Contacts separated</string>
+
+ <!-- Title of the confirmation dialog for separating contacts into multiple instances -->
+ <string name="splitConfirmation_title">Separate Contact</string>
+
+ <!-- Confirmation dialog for separating contacts into multiple instances -->
+ <string name="splitConfirmation">Are you sure you want to separate this single contact
+ into multiple contacts: one for each set of contact information that was joined into it?
+ </string>
<!-- Menu item that joins an aggregate with another aggregate -->
<string name="menu_joinAggregate">Join</string>
import com.android.contacts.ContactsListActivity;
import com.android.contacts.ContactsUtils;
import com.android.contacts.R;
-import com.android.contacts.ScrollingTabWidget;
import com.android.contacts.model.ContactsSource;
import com.android.contacts.model.Editor;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.Editor.EditorListener;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.ui.widget.ContactEditorView;
-import com.android.contacts.ui.widget.PhotoEditorView;
import com.android.contacts.util.EmptyService;
import com.android.contacts.util.WeakAsyncTask;
-import com.android.internal.widget.ContactHeaderWidget;
import com.google.android.collect.Lists;
import android.accounts.Account;
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.edit, menu);
+
+
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ menu.findItem(R.id.menu_split).setVisible(mState != null && mState.size() > 1);
return true;
}
}
private boolean doSplitContactAction() {
- mState.splitRawContacts();
- return doSaveAction(SAVE_MODE_SPLIT);
+ if (!hasValidState()) return false;
+
+ showAndManageDialog(createSplitDialog());
+ return true;
+ }
+
+ private Dialog createSplitDialog() {
+ final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.splitConfirmation_title);
+ builder.setIcon(android.R.drawable.ic_dialog_alert);
+ builder.setMessage(R.string.splitConfirmation);
+ builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ // Split the contacts
+ mState.splitRawContacts();
+ doSaveAction(SAVE_MODE_SPLIT);
+ }
+ });
+ builder.setNegativeButton(android.R.string.cancel, null);
+ builder.setCancelable(false);
+ return builder.create();
}
private boolean doJoinContactAction() {