Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 687d2189 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Show "Link" item when applicable and show correct toast for deletion.

b/25165853 is about the "Link" item. And this CL also does the following
things:

1. show toast for deleting 1/multiple contacts from PeopleActivity.
2. show toast when deletion happens in QuickContact and contact editor.

Bug: 25165853
Change-Id: Ia8ecb6b4118ecff3bc3ba50ac98ffadf337db52c
parent 7ab14cbd
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -172,8 +172,11 @@
    <!-- Toast shown after two contacts have been linked by a user action. [CHAR LIMIT=NONE] -->
    <string name="contactsJoinedMessage">Contacts linked</string>

    <!-- Toast shown after contacts that the user has selected are deleted by a user action. [CHAR LIMIT=NONE] -->
    <string name="contacts_deleted_toast">Contacts deleted</string>
    <!-- Toast shown after contacts that the user has selected are deleted by a user action. [CHAR LIMIT=30] -->
    <plurals name="contacts_deleted_toast">
        <item quantity="one">Contact deleted</item>
        <item quantity="other">Contacts deleted</item>
    </plurals>

    <!-- Menu item that opens the Options activity for a given contact [CHAR LIMIT=15] -->
    <string name="menu_set_ring_tone">Set ringtone</string>
+9 −1
Original line number Diff line number Diff line
@@ -1012,7 +1012,15 @@ public class ContactSaveService extends IntentService {
            final Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId);
            getContentResolver().delete(contactUri, null, null);
        }
        showToast(R.string.contacts_deleted_toast);
        final String deleteToastMessage = getResources().getQuantityString(R.plurals
                .contacts_deleted_toast, contactIds.length);
        mMainHandler.post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(ContactSaveService.this, deleteToastMessage, Toast.LENGTH_LONG)
                        .show();
            }
        });
    }

    /**
+3 −2
Original line number Diff line number Diff line
@@ -1124,8 +1124,9 @@ public class PeopleActivity extends ContactsActivity implements
                && mAllFragment.getSelectedContactIds().size() != 0;
        makeMenuItemVisible(menu, R.id.menu_share, showSelectedContactOptions);
        makeMenuItemVisible(menu, R.id.menu_delete, showSelectedContactOptions);
        makeMenuItemVisible(menu, R.id.menu_join, showSelectedContactOptions);
        makeMenuItemEnabled(menu, R.id.menu_join, mAllFragment.getSelectedContactIds().size() > 1);
        final boolean showLinkContactsOptions = mActionBarAdapter.isSelectionMode()
                && mAllFragment.getSelectedContactIds().size() > 1;
        makeMenuItemVisible(menu, R.id.menu_join, showLinkContactsOptions);

        // Debug options need to be visible even in search mode.
        makeMenuItemVisible(menu, R.id.export_database, mEnableDebugMenuOptions);
+4 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Contacts.Entity;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;

import com.android.contacts.ContactSaveService;
import com.android.contacts.R;
@@ -333,6 +334,9 @@ public class ContactDeletionInteraction extends Fragment
        if (isAdded() && mFinishActivityWhenDone) {
            getActivity().setResult(RESULT_CODE_DELETED);
            getActivity().finish();
            final String deleteToastMessage = getResources().getQuantityString(R.plurals
                    .contacts_deleted_toast, /* quantity */ 1);
            Toast.makeText(mContext, deleteToastMessage, Toast.LENGTH_LONG).show();
        }
    }
}