Make Home contacts shortcut bring up the quick contact window.
Change-Id: I9cb20b9c7d77dc29a08019554f746089665403f5
diff --git a/res/anim/quickcontact.xml b/res/anim/quickcontact.xml
index 6fd1a27..5dd5a16 100644
--- a/res/anim/quickcontact.xml
+++ b/res/anim/quickcontact.xml
@@ -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" />
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index 5613794..ca1a469 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -388,7 +388,7 @@
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 @@
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 @@
}
/**
- * 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 @@
return;
}
- if (Thread.currentThread().interrupted()) {
+ if (Thread.interrupted()) {
// shutdown has been called.
return;
}
@@ -2208,7 +2217,7 @@
mBitmapCache.put(mPhotoId, new SoftReference<Bitmap>(photo));
- if (Thread.currentThread().interrupted()) {
+ if (Thread.interrupted()) {
// shutdown has been called.
return;
}
diff --git a/src/com/android/contacts/ui/QuickContactWindow.java b/src/com/android/contacts/ui/QuickContactWindow.java
index e787987..132b18c 100644
--- a/src/com/android/contacts/ui/QuickContactWindow.java
+++ b/src/com/android/contacts/ui/QuickContactWindow.java
@@ -28,7 +28,6 @@
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.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 @@
* 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 @@
// 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);
}
@@ -579,11 +576,6 @@
}
/** 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);
if (view instanceof ImageView) {
@@ -620,7 +612,7 @@
* 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 @@
* queries, keyed internally on MIME-type.
*/
private static class ResolveCache {
- private Context mContext;
private PackageManager mPackageManager;
/**
@@ -917,7 +908,6 @@
private HashMap<String, Entry> mCache = new HashMap<String, Entry>();
public ResolveCache(Context context) {
- mContext = context;
mPackageManager = context.getPackageManager();
}
@@ -1092,7 +1082,6 @@
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 @@
// 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);