OSDN Git Service

AI 143193: am: CL 142955 Send all contact method details for "Create barcode" intent.
authorJeffrey Sharkey <>
Sat, 28 Mar 2009 00:19:18 +0000 (17:19 -0700)
committerThe Android Open Source Project <initial-contribution@android.com>
Sat, 28 Mar 2009 00:19:18 +0000 (17:19 -0700)
  This was regression from PF when we removed the list separator items when viewing contact.
  Original author: jsharkey
  Merged from: //branches/cupcake/...

Automated import of CL 143193

src/com/android/contacts/ViewContactActivity.java

index 571e2e4..28a82b4 100644 (file)
@@ -413,20 +413,23 @@ public class ViewContactActivity extends ListActivity
                     Bundle bundle = new Bundle();
                     String name = mCursor.getString(CONTACT_NAME_COLUMN);
                     if (!TextUtils.isEmpty(name)) {
+                        // Correctly handle when section headers are hidden
+                        int sepAdjust = SHOW_SEPARATORS ? 1 : 0;
+                        
                         bundle.putString(Contacts.Intents.Insert.NAME, name);
                         // The 0th ViewEntry in each ArrayList below is a separator item
-                        int entriesToAdd = Math.min(mPhoneEntries.size() - 1, PHONE_KEYS.length);
+                        int entriesToAdd = Math.min(mPhoneEntries.size() - sepAdjust, PHONE_KEYS.length);
                         for (int x = 0; x < entriesToAdd; x++) {
-                            ViewEntry entry = mPhoneEntries.get(x + 1);
+                            ViewEntry entry = mPhoneEntries.get(x + sepAdjust);
                             bundle.putString(PHONE_KEYS[x], entry.data);
                         }
-                        entriesToAdd = Math.min(mEmailEntries.size() - 1, EMAIL_KEYS.length);
+                        entriesToAdd = Math.min(mEmailEntries.size() - sepAdjust, EMAIL_KEYS.length);
                         for (int x = 0; x < entriesToAdd; x++) {
-                            ViewEntry entry = mEmailEntries.get(x + 1);
+                            ViewEntry entry = mEmailEntries.get(x + sepAdjust);
                             bundle.putString(EMAIL_KEYS[x], entry.data);
                         }
-                        if (mPostalEntries.size() >= 2) {
-                            ViewEntry entry = mPostalEntries.get(1);
+                        if (mPostalEntries.size() >= 1 + sepAdjust) {
+                            ViewEntry entry = mPostalEntries.get(sepAdjust);
                             bundle.putString(Contacts.Intents.Insert.POSTAL, entry.data);
                         }
                         intent.putExtra("ENCODE_DATA", bundle);