blob: 9b3d0f8b041a3e7b9f18d92d7927232cfc116418 [file] [log] [blame]
Dmitri Plotnikov9692f262010-06-29 18:53:11 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.contacts.interactions;
18
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070019import android.app.Activity;
20import android.app.AlertDialog;
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080021import android.app.Fragment;
22import android.app.FragmentManager;
Flavio Lerda34ce5e92011-06-06 15:25:17 +010023import android.app.LoaderManager;
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080024import android.app.LoaderManager.LoaderCallbacks;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070025import android.content.Context;
26import android.content.CursorLoader;
27import android.content.DialogInterface;
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080028import android.content.DialogInterface.OnDismissListener;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070029import android.content.Loader;
30import android.database.Cursor;
31import android.net.Uri;
32import android.os.Bundle;
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -070033import android.provider.ContactsContract.Contacts;
34import android.provider.ContactsContract.Contacts.Entity;
Jay Shraunere320c0b2015-03-05 12:45:18 -080035import android.text.TextUtils;
Jay Shrauner053f7232015-03-02 12:47:54 -080036import android.util.Log;
Wenyi Wang687d2182015-10-28 17:03:18 -070037import android.widget.Toast;
Chiao Chenge0b2f1e2012-06-12 13:07:56 -070038
39import com.android.contacts.ContactSaveService;
40import com.android.contacts.R;
Chiao Cheng0d5588d2012-11-26 15:34:14 -080041import com.android.contacts.common.model.AccountTypeManager;
Chiao Cheng428f0082012-11-13 18:38:56 -080042import com.android.contacts.common.model.account.AccountType;
James Laskeye5a140a2016-10-18 15:43:42 -070043import com.android.contacts.common.preference.ContactsPreferences;
44import com.android.contacts.common.util.ContactDisplayUtils;
Chiao Chenge0b2f1e2012-06-12 13:07:56 -070045import com.google.common.annotations.VisibleForTesting;
46import com.google.common.collect.Sets;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070047
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -070048import java.util.HashSet;
49
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070050/**
51 * An interaction invoked to delete a contact.
52 */
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080053public class ContactDeletionInteraction extends Fragment
54 implements LoaderCallbacks<Cursor>, OnDismissListener {
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070055
Jay Shrauner053f7232015-03-02 12:47:54 -080056 private static final String TAG = "ContactDeletionInteraction";
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080057 private static final String FRAGMENT_TAG = "deleteContact";
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070058
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080059 private static final String KEY_ACTIVE = "active";
Dmitri Plotnikovcc42b452011-01-20 11:44:44 -080060 private static final String KEY_CONTACT_URI = "contactUri";
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -080061 private static final String KEY_FINISH_WHEN_DONE = "finishWhenDone";
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080062 public static final String ARG_CONTACT_URI = "contactUri";
Brian Attwell8a6f4ad2014-06-06 21:54:53 -070063 public static final int RESULT_CODE_DELETED = 3;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070064
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080065 private static final String[] ENTITY_PROJECTION = new String[] {
66 Entity.RAW_CONTACT_ID, //0
67 Entity.ACCOUNT_TYPE, //1
Dave Santoro2b3f3c52011-07-26 17:35:42 -070068 Entity.DATA_SET, // 2
69 Entity.CONTACT_ID, // 3
70 Entity.LOOKUP_KEY, // 4
James Laskey4beed7e2016-09-15 13:52:19 -070071 Entity.DISPLAY_NAME, // 5
James Laskeye5a140a2016-10-18 15:43:42 -070072 Entity.DISPLAY_NAME_ALTERNATIVE, // 6
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070073 };
74
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -070075 private static final int COLUMN_INDEX_RAW_CONTACT_ID = 0;
76 private static final int COLUMN_INDEX_ACCOUNT_TYPE = 1;
Dave Santoro2b3f3c52011-07-26 17:35:42 -070077 private static final int COLUMN_INDEX_DATA_SET = 2;
78 private static final int COLUMN_INDEX_CONTACT_ID = 3;
79 private static final int COLUMN_INDEX_LOOKUP_KEY = 4;
James Laskey4beed7e2016-09-15 13:52:19 -070080 private static final int COLUMN_INDEX_DISPLAY_NAME = 5;
James Laskeye5a140a2016-10-18 15:43:42 -070081 private static final int COLUMN_INDEX_DISPLAY_NAME_ALT = 6;
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -070082
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080083 private boolean mActive;
84 private Uri mContactUri;
James Laskey4beed7e2016-09-15 13:52:19 -070085 private String mDisplayName;
James Laskeye5a140a2016-10-18 15:43:42 -070086 private String mDisplayNameAlt;
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -080087 private boolean mFinishActivityWhenDone;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070088 private Context mContext;
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080089 private AlertDialog mDialog;
90
Flavio Lerda34ce5e92011-06-06 15:25:17 +010091 /** This is a wrapper around the fragment's loader manager to be used only during testing. */
Brian Attwell09bfb912014-12-18 20:11:17 -080092 private TestLoaderManagerBase mTestLoaderManager;
Flavio Lerda34ce5e92011-06-06 15:25:17 +010093
94 @VisibleForTesting
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -080095 int mMessageId;
96
Flavio Lerda34ce5e92011-06-06 15:25:17 +010097 /**
98 * Starts the interaction.
99 *
100 * @param activity the activity within which to start the interaction
101 * @param contactUri the URI of the contact to delete
102 * @param finishActivityWhenDone whether to finish the activity upon completion of the
103 * interaction
104 * @return the newly created interaction
105 */
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800106 public static ContactDeletionInteraction start(
107 Activity activity, Uri contactUri, boolean finishActivityWhenDone) {
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100108 return startWithTestLoaderManager(activity, contactUri, finishActivityWhenDone, null);
109 }
110
111 /**
Brian Attwell09bfb912014-12-18 20:11:17 -0800112 * Starts the interaction and optionally set up a {@link TestLoaderManagerBase}.
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100113 *
114 * @param activity the activity within which to start the interaction
115 * @param contactUri the URI of the contact to delete
116 * @param finishActivityWhenDone whether to finish the activity upon completion of the
117 * interaction
Brian Attwell09bfb912014-12-18 20:11:17 -0800118 * @param testLoaderManager the {@link TestLoaderManagerBase} to use to load the data, may be null
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100119 * in which case the default {@link LoaderManager} is used
120 * @return the newly created interaction
121 */
122 @VisibleForTesting
123 static ContactDeletionInteraction startWithTestLoaderManager(
124 Activity activity, Uri contactUri, boolean finishActivityWhenDone,
Brian Attwell09bfb912014-12-18 20:11:17 -0800125 TestLoaderManagerBase testLoaderManager) {
Jay Shrauner5dcf5c32015-09-16 13:56:57 -0700126 if (contactUri == null || activity.isDestroyed()) {
Dmitri Plotnikovac0e18e2011-02-23 17:23:53 -0800127 return null;
128 }
129
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800130 FragmentManager fragmentManager = activity.getFragmentManager();
131 ContactDeletionInteraction fragment =
132 (ContactDeletionInteraction) fragmentManager.findFragmentByTag(FRAGMENT_TAG);
133 if (fragment == null) {
134 fragment = new ContactDeletionInteraction();
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100135 fragment.setTestLoaderManager(testLoaderManager);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800136 fragment.setContactUri(contactUri);
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800137 fragment.setFinishActivityWhenDone(finishActivityWhenDone);
Minh Pham4b25da72011-08-25 13:50:38 -0700138 fragmentManager.beginTransaction().add(fragment, FRAGMENT_TAG)
139 .commitAllowingStateLoss();
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800140 } else {
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100141 fragment.setTestLoaderManager(testLoaderManager);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800142 fragment.setContactUri(contactUri);
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800143 fragment.setFinishActivityWhenDone(finishActivityWhenDone);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800144 }
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800145 return fragment;
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800146 }
147
148 @Override
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100149 public LoaderManager getLoaderManager() {
150 // Return the TestLoaderManager if one is set up.
151 LoaderManager loaderManager = super.getLoaderManager();
152 if (mTestLoaderManager != null) {
153 // Set the delegate: this operation is idempotent, so let's just do it every time.
154 mTestLoaderManager.setDelegate(loaderManager);
155 return mTestLoaderManager;
156 } else {
157 return loaderManager;
158 }
159 }
160
161 /** Sets the TestLoaderManager that is used to wrap the actual LoaderManager in tests. */
Brian Attwell09bfb912014-12-18 20:11:17 -0800162 private void setTestLoaderManager(TestLoaderManagerBase mockLoaderManager) {
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100163 mTestLoaderManager = mockLoaderManager;
164 }
165
166 @Override
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800167 public void onAttach(Activity activity) {
168 super.onAttach(activity);
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800169 mContext = activity;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700170 }
171
Dmitri Plotnikov0279fca2011-02-23 17:47:31 -0800172 @Override
173 public void onDestroyView() {
174 super.onDestroyView();
175 if (mDialog != null && mDialog.isShowing()) {
176 mDialog.setOnDismissListener(null);
177 mDialog.dismiss();
178 mDialog = null;
179 }
180 }
181
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800182 public void setContactUri(Uri contactUri) {
183 mContactUri = contactUri;
184 mActive = true;
185 if (isStarted()) {
186 Bundle args = new Bundle();
187 args.putParcelable(ARG_CONTACT_URI, mContactUri);
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800188 getLoaderManager().restartLoader(R.id.dialog_delete_contact_loader_id, args, this);
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700189 }
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700190 }
191
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800192 private void setFinishActivityWhenDone(boolean finishActivityWhenDone) {
193 this.mFinishActivityWhenDone = finishActivityWhenDone;
194
195 }
196
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800197 /* Visible for testing */
198 boolean isStarted() {
199 return isAdded();
200 }
201
202 @Override
203 public void onStart() {
204 if (mActive) {
205 Bundle args = new Bundle();
206 args.putParcelable(ARG_CONTACT_URI, mContactUri);
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800207 getLoaderManager().initLoader(R.id.dialog_delete_contact_loader_id, args, this);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800208 }
209 super.onStart();
210 }
211
212 @Override
Dmitri Plotnikov0279fca2011-02-23 17:47:31 -0800213 public void onStop() {
214 super.onStop();
215 if (mDialog != null) {
216 mDialog.hide();
217 }
218 }
219
220 @Override
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800221 public Loader<Cursor> onCreateLoader(int id, Bundle args) {
222 Uri contactUri = args.getParcelable(ARG_CONTACT_URI);
223 return new CursorLoader(mContext,
224 Uri.withAppendedPath(contactUri, Entity.CONTENT_DIRECTORY), ENTITY_PROJECTION,
225 null, null, null);
226 }
227
228 @Override
229 public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
230 if (mDialog != null) {
231 mDialog.dismiss();
232 mDialog = null;
233 }
234
235 if (!mActive) {
236 return;
237 }
238
Jay Shrauner053f7232015-03-02 12:47:54 -0800239 if (cursor == null || cursor.isClosed()) {
240 Log.e(TAG, "Failed to load contacts");
241 return;
242 }
243
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -0700244 long contactId = 0;
245 String lookupKey = null;
246
247 // This cursor may contain duplicate raw contacts, so we need to de-dupe them first
248 HashSet<Long> readOnlyRawContacts = Sets.newHashSet();
249 HashSet<Long> writableRawContacts = Sets.newHashSet();
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700250
Dmitri Plotnikova07fa5f2011-01-09 11:56:50 -0800251 AccountTypeManager accountTypes = AccountTypeManager.getInstance(getActivity());
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800252 cursor.moveToPosition(-1);
253 while (cursor.moveToNext()) {
254 final long rawContactId = cursor.getLong(COLUMN_INDEX_RAW_CONTACT_ID);
255 final String accountType = cursor.getString(COLUMN_INDEX_ACCOUNT_TYPE);
Dave Santoro2b3f3c52011-07-26 17:35:42 -0700256 final String dataSet = cursor.getString(COLUMN_INDEX_DATA_SET);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800257 contactId = cursor.getLong(COLUMN_INDEX_CONTACT_ID);
258 lookupKey = cursor.getString(COLUMN_INDEX_LOOKUP_KEY);
James Laskey4beed7e2016-09-15 13:52:19 -0700259 mDisplayName = cursor.getString(COLUMN_INDEX_DISPLAY_NAME);
James Laskeye5a140a2016-10-18 15:43:42 -0700260 mDisplayNameAlt = cursor.getString(COLUMN_INDEX_DISPLAY_NAME_ALT);
Dave Santoro2b3f3c52011-07-26 17:35:42 -0700261 AccountType type = accountTypes.getAccountType(accountType, dataSet);
Daniel Lehmann96e87fd2011-09-20 21:31:37 -0700262 boolean writable = type == null || type.areContactsWritable();
263 if (writable) {
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800264 writableRawContacts.add(rawContactId);
Daniel Lehmann96e87fd2011-09-20 21:31:37 -0700265 } else {
266 readOnlyRawContacts.add(rawContactId);
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700267 }
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700268 }
Jay Shraunere320c0b2015-03-05 12:45:18 -0800269 if (TextUtils.isEmpty(lookupKey)) {
270 Log.e(TAG, "Failed to find contact lookup key");
271 getActivity().finish();
272 return;
273 }
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700274
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -0700275 int readOnlyCount = readOnlyRawContacts.size();
276 int writableCount = writableRawContacts.size();
Tingting Wang168331d2015-10-30 12:00:57 -0700277 int positiveButtonId = android.R.string.ok;
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -0700278 if (readOnlyCount > 0 && writableCount > 0) {
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800279 mMessageId = R.string.readOnlyContactDeleteConfirmation;
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -0700280 } else if (readOnlyCount > 0 && writableCount == 0) {
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800281 mMessageId = R.string.readOnlyContactWarning;
Tingting Wang07bc6762015-10-30 15:19:38 -0700282 positiveButtonId = R.string.readOnlyContactWarning_positive_button;
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -0700283 } else if (readOnlyCount == 0 && writableCount > 1) {
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800284 mMessageId = R.string.multipleContactDeleteConfirmation;
Tingting Wang168331d2015-10-30 12:00:57 -0700285 positiveButtonId = R.string.deleteConfirmation_positive_button;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700286 } else {
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800287 mMessageId = R.string.deleteConfirmation;
Tingting Wang168331d2015-10-30 12:00:57 -0700288 positiveButtonId = R.string.deleteConfirmation_positive_button;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700289 }
290
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800291 final Uri contactUri = Contacts.getLookupUri(contactId, lookupKey);
Tingting Wang168331d2015-10-30 12:00:57 -0700292 showDialog(mMessageId, positiveButtonId, contactUri);
Daisuke Miyakawad7c148b2011-03-31 18:33:35 -0700293
294 // We don't want onLoadFinished() calls any more, which may come when the database is
295 // updating.
296 getLoaderManager().destroyLoader(R.id.dialog_delete_contact_loader_id);
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700297 }
298
Daisuke Miyakawad7c148b2011-03-31 18:33:35 -0700299 @Override
Dianne Hackborn4ef95cc2010-12-16 00:44:33 -0800300 public void onLoaderReset(Loader<Cursor> loader) {
301 }
Dmitri Plotnikov69f9e6f2011-01-03 15:47:24 -0800302
Tingting Wang168331d2015-10-30 12:00:57 -0700303 private void showDialog(int messageId, int positiveButtonId, final Uri contactUri) {
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800304 mDialog = new AlertDialog.Builder(getActivity())
Dmitri Plotnikov4292dfa2011-01-23 10:21:18 -0800305 .setIconAttribute(android.R.attr.alertDialogIcon)
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800306 .setMessage(messageId)
307 .setNegativeButton(android.R.string.cancel, null)
Tingting Wang168331d2015-10-30 12:00:57 -0700308 .setPositiveButton(positiveButtonId,
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800309 new DialogInterface.OnClickListener() {
310 @Override
311 public void onClick(DialogInterface dialog, int whichButton) {
312 doDeleteContact(contactUri);
313 }
314 }
315 )
316 .create();
317
318 mDialog.setOnDismissListener(this);
319 mDialog.show();
320 }
321
322 @Override
323 public void onDismiss(DialogInterface dialog) {
324 mActive = false;
325 mDialog = null;
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800326 }
327
328 @Override
329 public void onSaveInstanceState(Bundle outState) {
330 super.onSaveInstanceState(outState);
331 outState.putBoolean(KEY_ACTIVE, mActive);
Dmitri Plotnikovcc42b452011-01-20 11:44:44 -0800332 outState.putParcelable(KEY_CONTACT_URI, mContactUri);
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800333 outState.putBoolean(KEY_FINISH_WHEN_DONE, mFinishActivityWhenDone);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800334 }
335
336 @Override
337 public void onActivityCreated(Bundle savedInstanceState) {
338 super.onActivityCreated(savedInstanceState);
339 if (savedInstanceState != null) {
340 mActive = savedInstanceState.getBoolean(KEY_ACTIVE);
Dmitri Plotnikovcc42b452011-01-20 11:44:44 -0800341 mContactUri = savedInstanceState.getParcelable(KEY_CONTACT_URI);
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800342 mFinishActivityWhenDone = savedInstanceState.getBoolean(KEY_FINISH_WHEN_DONE);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800343 }
344 }
345
346 protected void doDeleteContact(Uri contactUri) {
Dmitri Plotnikov7d8cabb2010-11-24 17:40:01 -0800347 mContext.startService(ContactSaveService.createDeleteContactIntent(mContext, contactUri));
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800348 if (isAdded() && mFinishActivityWhenDone) {
Brian Attwell8a6f4ad2014-06-06 21:54:53 -0700349 getActivity().setResult(RESULT_CODE_DELETED);
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800350 getActivity().finish();
James Laskey4beed7e2016-09-15 13:52:19 -0700351 final String deleteToastMessage;
James Laskeye5a140a2016-10-18 15:43:42 -0700352 final String name = ContactDisplayUtils.getPreferredDisplayName(mDisplayName,
353 mDisplayNameAlt, new ContactsPreferences(mContext));
354 if (TextUtils.isEmpty(name)) {
James Laskey4beed7e2016-09-15 13:52:19 -0700355 deleteToastMessage = getResources().getQuantityString(
356 R.plurals.contacts_deleted_toast, /* quantity */ 1);
357 } else {
358 deleteToastMessage = getResources().getString(
James Laskeye5a140a2016-10-18 15:43:42 -0700359 R.string.contacts_deleted_one_named_toast, name);
James Laskey4beed7e2016-09-15 13:52:19 -0700360 }
Wenyi Wang687d2182015-10-28 17:03:18 -0700361 Toast.makeText(mContext, deleteToastMessage, Toast.LENGTH_LONG).show();
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800362 }
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700363 }
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700364}