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

Commit 2bbeffbe authored by Romain Guy's avatar Romain Guy
Browse files

Make Home contacts shortcut bring up the quick contact window.

Change-Id: I9cb20b9c7d77dc29a08019554f746089665403f5
parent 376bb3be
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,4 +4,4 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="100%p"
    android:toXDelta="0"
    android:duration="400" />
    android:duration="325" />
+15 −6
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ public class ContactsListActivity extends ListActivity implements
    private static final String CLAUSE_ONLY_PHONES = Contacts.HAS_PHONE_NUMBER + "=1";

    /**
     * In the {@link #MODE_JOIN} determines whether we display a list item with the label
     * In the {@link #MODE_JOIN_CONTACT} determines whether we display a list item with the label
     * "Show all contacts" or actually show all contacts
     */
    private boolean mJoinModeShowAllContacts;
@@ -1308,7 +1308,16 @@ public class ContactsListActivity extends ListActivity implements
            Intent shortcutIntent;
            if (Intent.ACTION_VIEW.equals(mShortcutAction)) {
                // This is a simple shortcut to view a contact.
                shortcutIntent = new Intent(mShortcutAction, uri);
                shortcutIntent = new Intent(ContactsContract.QuickContact.ACTION_QUICK_CONTACT);
                shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                        Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    
                shortcutIntent.setData(uri);
                shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_MODE,
                        ContactsContract.QuickContact.MODE_LARGE);
                shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_EXCLUDE_MIMES,
                        (String[]) null);

                final Bitmap icon = loadContactPhoto(id, null);
                if (icon != null) {
                    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
@@ -1626,8 +1635,8 @@ public class ContactsListActivity extends ListActivity implements
    }

    /**
     * Return the selection arguments for a default query based on
     * {@link #mDisplayAll} and {@link #mDisplayOnlyPhones} flags.
     * Return the selection arguments for a default query based on the
     * {@link #mDisplayOnlyPhones} flag.
     */
    private String getContactSelection() {
        if (mDisplayOnlyPhones) {
@@ -2191,7 +2200,7 @@ public class ContactsListActivity extends ListActivity implements
                    return;
                }

                if (Thread.currentThread().interrupted()) {
                if (Thread.interrupted()) {
                    // shutdown has been called.
                    return;
                }
@@ -2208,7 +2217,7 @@ public class ContactsListActivity extends ListActivity implements

                mBitmapCache.put(mPhotoId, new SoftReference<Bitmap>(photo));

                if (Thread.currentThread().interrupted()) {
                if (Thread.interrupted()) {
                    // shutdown has been called.
                    return;
                }
+4 −16
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import com.android.contacts.util.NotifyingAsyncQueryHandler;
import com.android.internal.policy.PolicyManager;
import com.google.android.collect.Sets;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ContentUris;
import android.content.ContentValues;
@@ -56,7 +55,6 @@ import android.provider.ContactsContract.CommonDataKinds.Im;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds.Photo;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
@@ -192,13 +190,12 @@ public class QuickContactWindow implements Window.Callback,
     * the user has not selected a default app yet, and they will still be
     * presented with the system disambiguation dialog.
     */
    private static final HashSet<String> sPreferResolve = Sets.newHashSet(new String[] {
    private static final HashSet<String> sPreferResolve = Sets.newHashSet(
            "com.android.email",
            "com.android.calendar",
            "com.android.contacts",
            "com.android.mms",
            "com.android.phone",
    });
            "com.android.phone");

    private static final int TOKEN_DATA = 1;

@@ -285,7 +282,7 @@ public class QuickContactWindow implements Window.Callback,
            // Inflate actual header if we picked a stub
            final ViewStub stub = (ViewStub)header;
            header = stub.inflate();
        } else {
        } else if (header != null) {
            header.setVisibility(View.VISIBLE);
        }

@@ -578,11 +575,6 @@ public class QuickContactWindow implements Window.Callback,
        }
    }

    /** Assign this image to the view, if found in {@link #mHeader}. */
    private void setHeaderImage(int id, int resId) {
        setHeaderImage(id, mContext.getResources().getDrawable(resId));
    }

    /** Assign this image to the view, if found in {@link #mHeader}. */
    private void setHeaderImage(int id, Drawable drawable) {
        final View view = mHeader.findViewById(id);
@@ -620,7 +612,7 @@ public class QuickContactWindow implements Window.Callback,
     * Find the QuickContact-specific presence icon for showing in chiclets.
     */
    private Drawable getTrackPresenceIcon(int status) {
        int resId = -1;
        int resId;
        switch (status) {
            case StatusUpdates.AVAILABLE:
                resId = R.drawable.quickcontact_slider_presence_active;
@@ -902,7 +894,6 @@ public class QuickContactWindow implements Window.Callback,
     * queries, keyed internally on MIME-type.
     */
    private static class ResolveCache {
        private Context mContext;
        private PackageManager mPackageManager;

        /**
@@ -917,7 +908,6 @@ public class QuickContactWindow implements Window.Callback,
        private HashMap<String, Entry> mCache = new HashMap<String, Entry>();

        public ResolveCache(Context context) {
            mContext = context;
            mPackageManager = context.getPackageManager();
        }

@@ -1092,7 +1082,6 @@ public class QuickContactWindow implements Window.Callback,
        while (cursor.moveToNext()) {
            final long dataId = cursor.getLong(DataQuery._ID);
            final String accountType = cursor.getString(DataQuery.ACCOUNT_TYPE);
            final String resPackage = cursor.getString(DataQuery.RES_PACKAGE);
            final String mimeType = cursor.getString(DataQuery.MIMETYPE);

            // Handle any social status updates from this row
@@ -1353,7 +1342,6 @@ public class QuickContactWindow implements Window.Callback,

                    // Set action title based on summary value
                    final Action action = (Action)getItem(position);
                    final Drawable icon = mResolveCache.getIcon(action);

                    TextView text1 = (TextView)convertView.findViewById(android.R.id.text1);
                    TextView text2 = (TextView)convertView.findViewById(android.R.id.text2);