Changes to ContactCommon to support drag and drop

Change-Id: I6bbed9527a3f3cf0583a3f9ddf2bb6438f5a5eb1
diff --git a/src/com/android/contacts/common/ContactTileLoaderFactory.java b/src/com/android/contacts/common/ContactTileLoaderFactory.java
index 19eac76..c930102 100644
--- a/src/com/android/contacts/common/ContactTileLoaderFactory.java
+++ b/src/com/android/contacts/common/ContactTileLoaderFactory.java
@@ -40,6 +40,12 @@
     public final static int PHONE_NUMBER = 5;
     public final static int PHONE_NUMBER_TYPE = 6;
     public final static int PHONE_NUMBER_LABEL = 7;
+    public final static int PINNED = 8;
+    // The _ID field returned for frequent items actually contains data._id instead of
+    // contacts._id because the query is performed on the data table. In order to obtain the
+    // contact id for frequent items (in order to pin/hide frequent contacts), we thus have
+    // to use Phone.contact_id instead.
+    public final static int CONTACT_ID_FOR_FREQUENT = 9;
 
     private static final String[] COLUMNS = new String[] {
         Contacts._ID, // ..........................................0
@@ -65,7 +71,9 @@
         Contacts.LOOKUP_KEY, // ...................................4
         Phone.NUMBER, // ..........................................5
         Phone.TYPE, // ............................................6
-        Phone.LABEL // ............................................7
+        Phone.LABEL, // ...........................................7
+        Contacts.PINNED, // .......................................8
+        Phone.CONTACT_ID //........................................9
     };
 
     private static final String STARRED_ORDER = Contacts.DISPLAY_NAME+" COLLATE NOCASE ASC";
diff --git a/src/com/android/contacts/common/list/ContactEntry.java b/src/com/android/contacts/common/list/ContactEntry.java
index 095bf54..188459d 100644
--- a/src/com/android/contacts/common/list/ContactEntry.java
+++ b/src/com/android/contacts/common/list/ContactEntry.java
@@ -18,11 +18,12 @@
 
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
+import android.provider.ContactsContract.PinnedPositions;
 
 /**
  * Class to hold contact information
  */
-public class ContactEntry {
+public class ContactEntry implements Comparable<ContactEntry> {
     public String name;
     public String status;
     public String phoneLabel;
@@ -30,4 +31,14 @@
     public Uri photoUri;
     public Uri lookupKey;
     public Drawable presenceIcon;
+    public long id;
+    public int pinned = PinnedPositions.UNPINNED;
+
+    /*
+     * This is implemented to allow sorting pinned contacts within the Dialer
+     */
+    @Override
+    public int compareTo(ContactEntry another) {
+        return this.pinned - another.pinned;
+    }
 }
\ No newline at end of file