OSDN Git Service

Follow up changes from review of Ib2afc992.
authorJeff Hamilton <jham@android.com>
Wed, 7 Oct 2009 21:21:20 +0000 (16:21 -0500)
committerJeff Hamilton <jham@android.com>
Wed, 7 Oct 2009 21:21:20 +0000 (16:21 -0500)
- Fixed some minor issues in the editor comparator
- Fixed some issues with phone local contacts

Change-Id: Ibc1b1f7d23aa33f899eaa4c0a21fde59284b6f4a

res/layout/item_contact_editor.xml
src/com/android/contacts/ui/EditContactActivity.java
src/com/android/contacts/ui/widget/ContactEditorView.java

index 21da0aa..c40352d 100644 (file)
@@ -67,6 +67,7 @@
 
                 android:textSize="24sp"
                 android:textColor="?android:attr/textColorPrimary"
+                android:singleLine="true"
             />
 
             <TextView android:id="@+id/header_account_name"
@@ -78,6 +79,7 @@
 
                 android:textAppearance="?android:attr/textAppearanceSmall"
                 android:textColor="?android:attr/textColorPrimary"
+                android:singleLine="true"
             />
 
             <View
index 5d095c6..9ed3d57 100644 (file)
@@ -1117,18 +1117,20 @@ public final class EditContactActivity extends Activity
         }
 
         // Check account name
-        String oneAccount = one.getValues().getAsString(RawContacts.ACCOUNT_NAME);
-        if (oneAccount == null) oneAccount = "null";
-        String twoAccount = two.getValues().getAsString(RawContacts.ACCOUNT_NAME);
-        if (twoAccount == null) twoAccount = "null";
+        ValuesDelta oneValues = one.getValues();
+        String oneAccount = oneValues.getAsString(RawContacts.ACCOUNT_NAME);
+        if (oneAccount == null) oneAccount = "";
+        ValuesDelta twoValues = two.getValues();
+        String twoAccount = twoValues.getAsString(RawContacts.ACCOUNT_NAME);
+        if (twoAccount == null) twoAccount = "";
         value = oneAccount.compareTo(twoAccount);
         if (value != 0) {
             return value;
         }
 
         // Both are in the same account, fall back to contact ID
-        int oneId = one.getValues().getAsInteger(RawContacts._ID);
-        int twoId = two.getValues().getAsInteger(RawContacts._ID);
-        return oneId -twoId;
+        long oneId = oneValues.getAsLong(RawContacts._ID);
+        long twoId = twoValues.getAsLong(RawContacts._ID);
+        return (int)(oneId - twoId);
     }
 }
index bf03052..8bd8e4c 100644 (file)
@@ -197,7 +197,8 @@ public class ContactEditorView extends LinearLayout implements OnClickListener {
         CharSequence accountType = source.getDisplayLabel(mContext);
         if (TextUtils.isEmpty(accountType)) {
             accountType = mContext.getString(R.string.account_phone);
-        } else {
+        }
+        if (!TextUtils.isEmpty(accountName)) {
             mHeaderAccountName.setText(
                     mContext.getString(R.string.from_account_format, accountName));
         }