OSDN Git Service

[Issue 2174171] Fixing Join Contact UI title.
authorDmitri Plotnikov <dplotnikov@google.com>
Thu, 8 Oct 2009 00:07:03 +0000 (17:07 -0700)
committerDmitri Plotnikov <dplotnikov@google.com>
Thu, 8 Oct 2009 01:10:16 +0000 (18:10 -0700)
The title should read: "Select the contact you want to join with John Doe"

Change-Id: Iec1f41ce97e251635048f91020410cc1981cffbb

res/layout-finger/contacts_list_content_join.xml
src/com/android/contacts/ContactsListActivity.java

index 95f9c20..b59c1b7 100644 (file)
@@ -47,6 +47,8 @@
                 android:layout_height="wrap_content"
                 android:text="@string/titleJoinContactDataWith"
                 android:textAppearance="?android:attr/textAppearanceMedium"
+                android:shadowColor="#BB000000"
+                android:shadowRadius="2.75"
             />
             <TextView
                 android:id="@+id/join_contact_blurb"
index c1fba67..c549c9d 100644 (file)
@@ -166,15 +166,16 @@ public class ContactsListActivity extends ListActivity implements
      */
     public static final String EXTRA_AGGREGATE_ID =
             "com.android.contacts.action.AGGREGATE_ID";
+
     /**
      * Used with {@link #JOIN_AGGREGATE} to give it the name of the aggregation target.
      * <p>
      * Type: STRING
      */
+    @Deprecated
     public static final String EXTRA_AGGREGATE_NAME =
             "com.android.contacts.action.AGGREGATE_NAME";
 
-
     public static final String AUTHORITIES_FILTER_KEY = "authorities";
 
     /** Mask for picker mode */
@@ -592,12 +593,9 @@ public class ContactsListActivity extends ListActivity implements
         if (mMode == MODE_JOIN_CONTACT) {
             setContentView(R.layout.contacts_list_content_join);
             TextView blurbView = (TextView)findViewById(R.id.join_contact_blurb);
-            String contactName = intent.getStringExtra(EXTRA_AGGREGATE_NAME);
-            if (contactName == null) {
-                contactName = "";
-            }
 
-            String blurb = getString(R.string.blurbJoinContactDataWith, contactName);
+            String blurb = getString(R.string.blurbJoinContactDataWith,
+                    getContactDisplayName(mQueryAggregateId));
             blurbView.setText(blurb);
             mJoinModeShowAllContacts = true;
         } else {
@@ -657,6 +655,28 @@ public class ContactsListActivity extends ListActivity implements
 //        }
     }
 
+    private String getContactDisplayName(long contactId) {
+        String contactName = null;
+        Cursor c = getContentResolver().query(
+                ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId),
+                new String[] {Contacts.DISPLAY_NAME}, null, null, null);
+        try {
+            if (c != null && c.moveToFirst()) {
+                contactName = c.getString(0);
+            }
+        } finally {
+            if (c != null) {
+                c.close();
+            }
+        }
+
+        if (contactName == null) {
+            contactName = "";
+        }
+
+        return contactName;
+    }
+
     private int[] mLocation = new int[2];
     private Rect mRect = new Rect();