blob: 161571c1e50fba7d499cbb3ad29e0e72129b8599 [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;
Gary Mai69c182a2016-12-05 13:07:03 -080041import com.android.contacts.model.AccountTypeManager;
42import com.android.contacts.model.account.AccountType;
43import com.android.contacts.preference.ContactsPreferences;
44import com.android.contacts.util.ContactDisplayUtils;
Gary Mai0a49afa2016-12-05 15:53:58 -080045
Chiao Chenge0b2f1e2012-06-12 13:07:56 -070046import com.google.common.annotations.VisibleForTesting;
47import com.google.common.collect.Sets;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070048
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -070049import java.util.HashSet;
50
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070051/**
52 * An interaction invoked to delete a contact.
53 */
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080054public class ContactDeletionInteraction extends Fragment
55 implements LoaderCallbacks<Cursor>, OnDismissListener {
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070056
Jay Shrauner053f7232015-03-02 12:47:54 -080057 private static final String TAG = "ContactDeletionInteraction";
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080058 private static final String FRAGMENT_TAG = "deleteContact";
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070059
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080060 private static final String KEY_ACTIVE = "active";
Dmitri Plotnikovcc42b452011-01-20 11:44:44 -080061 private static final String KEY_CONTACT_URI = "contactUri";
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -080062 private static final String KEY_FINISH_WHEN_DONE = "finishWhenDone";
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080063 public static final String ARG_CONTACT_URI = "contactUri";
Brian Attwell8a6f4ad2014-06-06 21:54:53 -070064 public static final int RESULT_CODE_DELETED = 3;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070065
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080066 private static final String[] ENTITY_PROJECTION = new String[] {
67 Entity.RAW_CONTACT_ID, //0
68 Entity.ACCOUNT_TYPE, //1
Dave Santoro2b3f3c52011-07-26 17:35:42 -070069 Entity.DATA_SET, // 2
70 Entity.CONTACT_ID, // 3
71 Entity.LOOKUP_KEY, // 4
James Laskey4beed7e2016-09-15 13:52:19 -070072 Entity.DISPLAY_NAME, // 5
James Laskeye5a140a2016-10-18 15:43:42 -070073 Entity.DISPLAY_NAME_ALTERNATIVE, // 6
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070074 };
75
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -070076 private static final int COLUMN_INDEX_RAW_CONTACT_ID = 0;
77 private static final int COLUMN_INDEX_ACCOUNT_TYPE = 1;
Dave Santoro2b3f3c52011-07-26 17:35:42 -070078 private static final int COLUMN_INDEX_DATA_SET = 2;
79 private static final int COLUMN_INDEX_CONTACT_ID = 3;
80 private static final int COLUMN_INDEX_LOOKUP_KEY = 4;
James Laskey4beed7e2016-09-15 13:52:19 -070081 private static final int COLUMN_INDEX_DISPLAY_NAME = 5;
James Laskeye5a140a2016-10-18 15:43:42 -070082 private static final int COLUMN_INDEX_DISPLAY_NAME_ALT = 6;
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -070083
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080084 private boolean mActive;
85 private Uri mContactUri;
James Laskey4beed7e2016-09-15 13:52:19 -070086 private String mDisplayName;
James Laskeye5a140a2016-10-18 15:43:42 -070087 private String mDisplayNameAlt;
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -080088 private boolean mFinishActivityWhenDone;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -070089 private Context mContext;
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -080090 private AlertDialog mDialog;
91
Flavio Lerda34ce5e92011-06-06 15:25:17 +010092 /** This is a wrapper around the fragment's loader manager to be used only during testing. */
Brian Attwell09bfb912014-12-18 20:11:17 -080093 private TestLoaderManagerBase mTestLoaderManager;
Flavio Lerda34ce5e92011-06-06 15:25:17 +010094
95 @VisibleForTesting
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -080096 int mMessageId;
97
Flavio Lerda34ce5e92011-06-06 15:25:17 +010098 /**
99 * Starts the interaction.
100 *
101 * @param activity the activity within which to start the interaction
102 * @param contactUri the URI of the contact to delete
103 * @param finishActivityWhenDone whether to finish the activity upon completion of the
104 * interaction
105 * @return the newly created interaction
106 */
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800107 public static ContactDeletionInteraction start(
108 Activity activity, Uri contactUri, boolean finishActivityWhenDone) {
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100109 return startWithTestLoaderManager(activity, contactUri, finishActivityWhenDone, null);
110 }
111
112 /**
Brian Attwell09bfb912014-12-18 20:11:17 -0800113 * Starts the interaction and optionally set up a {@link TestLoaderManagerBase}.
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100114 *
115 * @param activity the activity within which to start the interaction
116 * @param contactUri the URI of the contact to delete
117 * @param finishActivityWhenDone whether to finish the activity upon completion of the
118 * interaction
Brian Attwell09bfb912014-12-18 20:11:17 -0800119 * @param testLoaderManager the {@link TestLoaderManagerBase} to use to load the data, may be null
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100120 * in which case the default {@link LoaderManager} is used
121 * @return the newly created interaction
122 */
123 @VisibleForTesting
124 static ContactDeletionInteraction startWithTestLoaderManager(
125 Activity activity, Uri contactUri, boolean finishActivityWhenDone,
Brian Attwell09bfb912014-12-18 20:11:17 -0800126 TestLoaderManagerBase testLoaderManager) {
Jay Shrauner5dcf5c32015-09-16 13:56:57 -0700127 if (contactUri == null || activity.isDestroyed()) {
Dmitri Plotnikovac0e18e2011-02-23 17:23:53 -0800128 return null;
129 }
130
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800131 FragmentManager fragmentManager = activity.getFragmentManager();
132 ContactDeletionInteraction fragment =
133 (ContactDeletionInteraction) fragmentManager.findFragmentByTag(FRAGMENT_TAG);
134 if (fragment == null) {
135 fragment = new ContactDeletionInteraction();
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100136 fragment.setTestLoaderManager(testLoaderManager);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800137 fragment.setContactUri(contactUri);
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800138 fragment.setFinishActivityWhenDone(finishActivityWhenDone);
Minh Pham4b25da72011-08-25 13:50:38 -0700139 fragmentManager.beginTransaction().add(fragment, FRAGMENT_TAG)
140 .commitAllowingStateLoss();
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800141 } else {
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100142 fragment.setTestLoaderManager(testLoaderManager);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800143 fragment.setContactUri(contactUri);
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800144 fragment.setFinishActivityWhenDone(finishActivityWhenDone);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800145 }
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800146 return fragment;
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800147 }
148
149 @Override
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100150 public LoaderManager getLoaderManager() {
151 // Return the TestLoaderManager if one is set up.
152 LoaderManager loaderManager = super.getLoaderManager();
153 if (mTestLoaderManager != null) {
154 // Set the delegate: this operation is idempotent, so let's just do it every time.
155 mTestLoaderManager.setDelegate(loaderManager);
156 return mTestLoaderManager;
157 } else {
158 return loaderManager;
159 }
160 }
161
162 /** Sets the TestLoaderManager that is used to wrap the actual LoaderManager in tests. */
Brian Attwell09bfb912014-12-18 20:11:17 -0800163 private void setTestLoaderManager(TestLoaderManagerBase mockLoaderManager) {
Flavio Lerda34ce5e92011-06-06 15:25:17 +0100164 mTestLoaderManager = mockLoaderManager;
165 }
166
167 @Override
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800168 public void onAttach(Activity activity) {
169 super.onAttach(activity);
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800170 mContext = activity;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700171 }
172
Dmitri Plotnikov0279fca2011-02-23 17:47:31 -0800173 @Override
174 public void onDestroyView() {
175 super.onDestroyView();
176 if (mDialog != null && mDialog.isShowing()) {
177 mDialog.setOnDismissListener(null);
178 mDialog.dismiss();
179 mDialog = null;
180 }
181 }
182
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800183 public void setContactUri(Uri contactUri) {
184 mContactUri = contactUri;
185 mActive = true;
186 if (isStarted()) {
187 Bundle args = new Bundle();
188 args.putParcelable(ARG_CONTACT_URI, mContactUri);
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800189 getLoaderManager().restartLoader(R.id.dialog_delete_contact_loader_id, args, this);
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700190 }
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700191 }
192
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800193 private void setFinishActivityWhenDone(boolean finishActivityWhenDone) {
194 this.mFinishActivityWhenDone = finishActivityWhenDone;
195
196 }
197
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800198 /* Visible for testing */
199 boolean isStarted() {
200 return isAdded();
201 }
202
203 @Override
204 public void onStart() {
205 if (mActive) {
206 Bundle args = new Bundle();
207 args.putParcelable(ARG_CONTACT_URI, mContactUri);
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800208 getLoaderManager().initLoader(R.id.dialog_delete_contact_loader_id, args, this);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800209 }
210 super.onStart();
211 }
212
213 @Override
Dmitri Plotnikov0279fca2011-02-23 17:47:31 -0800214 public void onStop() {
215 super.onStop();
216 if (mDialog != null) {
217 mDialog.hide();
218 }
219 }
220
221 @Override
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800222 public Loader<Cursor> onCreateLoader(int id, Bundle args) {
223 Uri contactUri = args.getParcelable(ARG_CONTACT_URI);
224 return new CursorLoader(mContext,
225 Uri.withAppendedPath(contactUri, Entity.CONTENT_DIRECTORY), ENTITY_PROJECTION,
226 null, null, null);
227 }
228
229 @Override
230 public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
231 if (mDialog != null) {
232 mDialog.dismiss();
233 mDialog = null;
234 }
235
236 if (!mActive) {
237 return;
238 }
239
Jay Shrauner053f7232015-03-02 12:47:54 -0800240 if (cursor == null || cursor.isClosed()) {
241 Log.e(TAG, "Failed to load contacts");
242 return;
243 }
244
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -0700245 long contactId = 0;
246 String lookupKey = null;
247
248 // This cursor may contain duplicate raw contacts, so we need to de-dupe them first
249 HashSet<Long> readOnlyRawContacts = Sets.newHashSet();
250 HashSet<Long> writableRawContacts = Sets.newHashSet();
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700251
Dmitri Plotnikova07fa5f2011-01-09 11:56:50 -0800252 AccountTypeManager accountTypes = AccountTypeManager.getInstance(getActivity());
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800253 cursor.moveToPosition(-1);
254 while (cursor.moveToNext()) {
255 final long rawContactId = cursor.getLong(COLUMN_INDEX_RAW_CONTACT_ID);
256 final String accountType = cursor.getString(COLUMN_INDEX_ACCOUNT_TYPE);
Dave Santoro2b3f3c52011-07-26 17:35:42 -0700257 final String dataSet = cursor.getString(COLUMN_INDEX_DATA_SET);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800258 contactId = cursor.getLong(COLUMN_INDEX_CONTACT_ID);
259 lookupKey = cursor.getString(COLUMN_INDEX_LOOKUP_KEY);
James Laskey4beed7e2016-09-15 13:52:19 -0700260 mDisplayName = cursor.getString(COLUMN_INDEX_DISPLAY_NAME);
James Laskeye5a140a2016-10-18 15:43:42 -0700261 mDisplayNameAlt = cursor.getString(COLUMN_INDEX_DISPLAY_NAME_ALT);
Dave Santoro2b3f3c52011-07-26 17:35:42 -0700262 AccountType type = accountTypes.getAccountType(accountType, dataSet);
Daniel Lehmann96e87fd2011-09-20 21:31:37 -0700263 boolean writable = type == null || type.areContactsWritable();
264 if (writable) {
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800265 writableRawContacts.add(rawContactId);
Daniel Lehmann96e87fd2011-09-20 21:31:37 -0700266 } else {
267 readOnlyRawContacts.add(rawContactId);
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700268 }
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700269 }
Jay Shraunere320c0b2015-03-05 12:45:18 -0800270 if (TextUtils.isEmpty(lookupKey)) {
271 Log.e(TAG, "Failed to find contact lookup key");
272 getActivity().finish();
273 return;
274 }
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700275
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -0700276 int readOnlyCount = readOnlyRawContacts.size();
277 int writableCount = writableRawContacts.size();
Tingting Wang168331d2015-10-30 12:00:57 -0700278 int positiveButtonId = android.R.string.ok;
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -0700279 if (readOnlyCount > 0 && writableCount > 0) {
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800280 mMessageId = R.string.readOnlyContactDeleteConfirmation;
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -0700281 } else if (readOnlyCount > 0 && writableCount == 0) {
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800282 mMessageId = R.string.readOnlyContactWarning;
Tingting Wang07bc6762015-10-30 15:19:38 -0700283 positiveButtonId = R.string.readOnlyContactWarning_positive_button;
Dmitri Plotnikov355d0f42010-11-03 17:13:51 -0700284 } else if (readOnlyCount == 0 && writableCount > 1) {
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800285 mMessageId = R.string.multipleContactDeleteConfirmation;
Tingting Wang168331d2015-10-30 12:00:57 -0700286 positiveButtonId = R.string.deleteConfirmation_positive_button;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700287 } else {
Dmitri Plotnikov43fd1e82011-01-09 11:29:39 -0800288 mMessageId = R.string.deleteConfirmation;
Tingting Wang168331d2015-10-30 12:00:57 -0700289 positiveButtonId = R.string.deleteConfirmation_positive_button;
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700290 }
291
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800292 final Uri contactUri = Contacts.getLookupUri(contactId, lookupKey);
Tingting Wang168331d2015-10-30 12:00:57 -0700293 showDialog(mMessageId, positiveButtonId, contactUri);
Daisuke Miyakawad7c148b2011-03-31 18:33:35 -0700294
295 // We don't want onLoadFinished() calls any more, which may come when the database is
296 // updating.
297 getLoaderManager().destroyLoader(R.id.dialog_delete_contact_loader_id);
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700298 }
299
Daisuke Miyakawad7c148b2011-03-31 18:33:35 -0700300 @Override
Dianne Hackborn4ef95cc2010-12-16 00:44:33 -0800301 public void onLoaderReset(Loader<Cursor> loader) {
302 }
Dmitri Plotnikov69f9e6f2011-01-03 15:47:24 -0800303
Tingting Wang168331d2015-10-30 12:00:57 -0700304 private void showDialog(int messageId, int positiveButtonId, final Uri contactUri) {
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800305 mDialog = new AlertDialog.Builder(getActivity())
Dmitri Plotnikov4292dfa2011-01-23 10:21:18 -0800306 .setIconAttribute(android.R.attr.alertDialogIcon)
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800307 .setMessage(messageId)
308 .setNegativeButton(android.R.string.cancel, null)
Tingting Wang168331d2015-10-30 12:00:57 -0700309 .setPositiveButton(positiveButtonId,
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800310 new DialogInterface.OnClickListener() {
311 @Override
312 public void onClick(DialogInterface dialog, int whichButton) {
313 doDeleteContact(contactUri);
314 }
315 }
316 )
317 .create();
318
319 mDialog.setOnDismissListener(this);
320 mDialog.show();
321 }
322
323 @Override
324 public void onDismiss(DialogInterface dialog) {
325 mActive = false;
326 mDialog = null;
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800327 }
328
329 @Override
330 public void onSaveInstanceState(Bundle outState) {
331 super.onSaveInstanceState(outState);
332 outState.putBoolean(KEY_ACTIVE, mActive);
Dmitri Plotnikovcc42b452011-01-20 11:44:44 -0800333 outState.putParcelable(KEY_CONTACT_URI, mContactUri);
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800334 outState.putBoolean(KEY_FINISH_WHEN_DONE, mFinishActivityWhenDone);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800335 }
336
337 @Override
338 public void onActivityCreated(Bundle savedInstanceState) {
339 super.onActivityCreated(savedInstanceState);
340 if (savedInstanceState != null) {
341 mActive = savedInstanceState.getBoolean(KEY_ACTIVE);
Dmitri Plotnikovcc42b452011-01-20 11:44:44 -0800342 mContactUri = savedInstanceState.getParcelable(KEY_CONTACT_URI);
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800343 mFinishActivityWhenDone = savedInstanceState.getBoolean(KEY_FINISH_WHEN_DONE);
Dmitri Plotnikov66bca8f2010-11-24 16:59:24 -0800344 }
345 }
346
347 protected void doDeleteContact(Uri contactUri) {
Dmitri Plotnikov7d8cabb2010-11-24 17:40:01 -0800348 mContext.startService(ContactSaveService.createDeleteContactIntent(mContext, contactUri));
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800349 if (isAdded() && mFinishActivityWhenDone) {
Brian Attwell8a6f4ad2014-06-06 21:54:53 -0700350 getActivity().setResult(RESULT_CODE_DELETED);
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800351 getActivity().finish();
James Laskey4beed7e2016-09-15 13:52:19 -0700352 final String deleteToastMessage;
James Laskeye5a140a2016-10-18 15:43:42 -0700353 final String name = ContactDisplayUtils.getPreferredDisplayName(mDisplayName,
354 mDisplayNameAlt, new ContactsPreferences(mContext));
355 if (TextUtils.isEmpty(name)) {
James Laskey4beed7e2016-09-15 13:52:19 -0700356 deleteToastMessage = getResources().getQuantityString(
357 R.plurals.contacts_deleted_toast, /* quantity */ 1);
358 } else {
359 deleteToastMessage = getResources().getString(
James Laskeye5a140a2016-10-18 15:43:42 -0700360 R.string.contacts_deleted_one_named_toast, name);
James Laskey4beed7e2016-09-15 13:52:19 -0700361 }
Wenyi Wang687d2182015-10-28 17:03:18 -0700362 Toast.makeText(mContext, deleteToastMessage, Toast.LENGTH_LONG).show();
Dmitri Plotnikovc9eda372011-02-23 08:58:13 -0800363 }
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700364 }
Dmitri Plotnikov9692f262010-06-29 18:53:11 -0700365}