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

Commit c9545cb2 authored by Walter Jang's avatar Walter Jang Committed by Android (Google) Code Review
Browse files

Merge "Handle group insert, view, and edit intents (1/2)" into ub-contactsdialer-f-dev

parents bafd2cc7 01c2f7f2
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -138,6 +138,12 @@
                <data android:mimeType="vnd.android.cursor.dir/contact" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.INSERT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/group" />
            </intent-filter>

            <meta-data android:name="android.app.searchable"
                android:resource="@xml/searchable"
            />
@@ -267,7 +273,20 @@

        <!-- Displays the members of a group in a list -->
        <activity android:name=".activities.GroupMembersActivity"
            android:theme="@style/PeopleActivityTheme"/>
            android:theme="@style/PeopleActivityTheme">

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/group" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.EDIT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/group" />
            </intent-filter>
        </activity>

        <activity
            android:name=".quickcontact.QuickContactActivity"
+1 −1
Original line number Diff line number Diff line
@@ -426,7 +426,7 @@ public abstract class ContactsDrawerActivity extends AppCompatContactsActivity i
        }
    }

    private void onCreateGroupMenuItemClicked() {
    protected void onCreateGroupMenuItemClicked() {
        // Select the account to create the group
        final Bundle extras = getIntent().getExtras();
        final Account account = extras == null ? null :
+12 −6
Original line number Diff line number Diff line
@@ -281,13 +281,19 @@ public class PeopleActivity extends ContactsDrawerActivity implements
            return false;
        }

        if (mRequest.getActionCode() == ContactsRequest.ACTION_VIEW_CONTACT) {
        switch (mRequest.getActionCode()) {
            case ContactsRequest.ACTION_VIEW_CONTACT: {
                final Intent intent = ImplicitIntentsUtil.composeQuickContactIntent(
                        mRequest.getContactUri(), QuickContactActivity.MODE_FULLY_EXPANDED);
                intent.putExtra(QuickContactActivity.EXTRA_PREVIOUS_SCREEN_TYPE, ScreenType.UNKNOWN);
                ImplicitIntentsUtil.startActivityInApp(this, intent);
                return false;
            }
            case ContactsRequest.ACTION_INSERT_GROUP: {
                onCreateGroupMenuItemClicked();
                return true;
            }
        }
        return true;
    }

+0 −18
Original line number Diff line number Diff line
@@ -49,9 +49,6 @@ import java.util.Set;
@NeededForTesting
public final class GroupUtil {

    private static final String LEGACY_CONTACTS_AUTHORITY = "contacts";
    private static final String LEGACY_CONTACTS_URI = "content://contacts/groups";

    // System IDs of FFC groups in Google accounts
    private static final Set<String> FFC_GROUPS =
            new HashSet(Arrays.asList("Friends", "Family", "Coworkers"));
@@ -142,21 +139,6 @@ public final class GroupUtil {
        return intent;
    }

    /**
     * Converts the given group Uri to the legacy format if the legacy authority was specified
     * in the given Uri.
     */
    // TODO(wjang):
    public static Uri maybeConvertToLegacyUri(Uri groupUri) {
        final String requestAuthority = groupUri.getAuthority();
        if (!LEGACY_CONTACTS_AUTHORITY.equals(requestAuthority)) {
            return groupUri;
        }
        final long groupId = ContentUris.parseId(groupUri);
        final Uri legacyContentUri = Uri.parse(LEGACY_CONTACTS_URI);
        return ContentUris.withAppendedId(legacyContentUri, groupId);
    }

    /**
     * Returns true if it's an empty and read-only group of a Google account and the system ID of
     * the group is one of "Friends", "Family" and "Coworkers".
+3 −1
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.contacts.list;

import android.accounts.Account;
import android.app.Activity;
import android.app.SearchManager;
import android.content.Intent;
@@ -131,6 +130,9 @@ public class ContactsIntentResolver {
            }
        } else if (Intent.ACTION_INSERT_OR_EDIT.equals(action)) {
            request.setActionCode(ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT);
        } else if (Intent.ACTION_INSERT.equals(action) &&
                Groups.CONTENT_TYPE.equals(intent.getType())) {
            request.setActionCode(ContactsRequest.ACTION_INSERT_GROUP);
        } else if (Intent.ACTION_SEARCH.equals(action)) {
            String query = intent.getStringExtra(SearchManager.QUERY);
            // If the {@link SearchManager.QUERY} is empty, then check if a phone number
Loading