Merge "Uses a tag for vCard-related notifications."
diff --git a/res/layout/contact_tile_regular.xml b/res/layout/contact_tile_square.xml
similarity index 96%
rename from res/layout/contact_tile_regular.xml
rename to res/layout/contact_tile_square.xml
index 0c02318..ca79cef 100644
--- a/res/layout/contact_tile_regular.xml
+++ b/res/layout/contact_tile_square.xml
@@ -15,7 +15,7 @@
 -->
 <view
     xmlns:android="http://schemas.android.com/apk/res/android"
-    class="com.android.contacts.list.ContactTileView"
+    class="com.android.contacts.list.ContactTileSquareView"
     android:focusable="true"
     android:padding="1px"
     android:background="@drawable/list_selector" >
diff --git a/src/com/android/contacts/list/ContactTileAdapter.java b/src/com/android/contacts/list/ContactTileAdapter.java
index 86f6b33..5d5e6cb 100644
--- a/src/com/android/contacts/list/ContactTileAdapter.java
+++ b/src/com/android/contacts/list/ContactTileAdapter.java
@@ -40,7 +40,7 @@
  * Also allows for a configurable number of columns and {@link DisplayType}
  */
 public class ContactTileAdapter extends BaseAdapter {
-    private static final String TAG = "ContactTileAdapter";
+    private static final String TAG = ContactTileAdapter.class.getSimpleName();
 
     /**
      * mContacts2 is only used if {@link DisplayType} is Strequent
@@ -292,7 +292,7 @@
         int columnCount = -1;
 
         switch (itemViewType) {
-            case ViewTypes.REGULAR:
+            case ViewTypes.SQUARE:
                 if (contactTileRowView == null) {
                     // Creating new row if needed
                     contactTileRowView = new ContactTileRow(mContext, layoutResId, true);
@@ -327,8 +327,8 @@
 
     private int getLayoutResourceId(int viewType) {
         switch (viewType) {
-            case ViewTypes.REGULAR:
-                return R.layout.contact_tile_regular;
+            case ViewTypes.SQUARE:
+                return R.layout.contact_tile_square;
             case ViewTypes.SINGLE_ROW:
                 return R.layout.contact_tile_single;
             default:
@@ -343,8 +343,8 @@
     /**
      * Returns view type based on {@link DisplayType}.
      * {@link DisplayType#STARRED_ONLY} and {@link DisplayType#GROUP_MEMBERS}
-     * are {@link ViewTypes#REGULAR}.
-     * {@link DisplayType#FREQUENT_ONLY} is {@link ViewTypes#SMALL}.
+     * are {@link ViewTypes#SQUARE}.
+     * {@link DisplayType#FREQUENT_ONLY} is {@link ViewTypes#SINGLE_ROW}.
      * {@link DisplayType#STREQUENT} mixes both {@link ViewTypes}
      * and also adds in {@link ViewTypes#DIVIDER}.
      */
@@ -353,7 +353,7 @@
         switch (mDisplayType) {
             case STREQUENT:
                 if (position < mDividerRowIndex) {
-                    return ViewTypes.REGULAR;
+                    return ViewTypes.SQUARE;
                 } else if (position == mDividerRowIndex) {
                     return ViewTypes.DIVIDER;
                 } else {
@@ -361,7 +361,7 @@
                 }
             case STARRED_ONLY:
             case GROUP_MEMBERS:
-                return ViewTypes.REGULAR;
+                return ViewTypes.SQUARE;
             case FREQUENT_ONLY:
                 return ViewTypes.SINGLE_ROW;
             default:
@@ -399,8 +399,11 @@
             ContactTileView contactTile;
 
             if (getChildCount() <= tileIndex) {
-                contactTile = (ContactTileView) inflate(mContext, mLayoutResId, null);
-                contactTile.setIsSquare(mIsContactTileSquare);
+                if (mIsContactTileSquare) {
+                    contactTile = (ContactTileSquareView) inflate(mContext, mLayoutResId, null);
+                } else {
+                    contactTile = (ContactTileView) inflate(mContext, mLayoutResId, null);
+                }
                 contactTile.setLayoutParams(new LinearLayout.LayoutParams(0,
                         LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f));
                 contactTile.setPhotoManager(mPhotoManager);
@@ -430,7 +433,7 @@
 
     private static class ViewTypes {
         public static final int COUNT = 3;
-        public static final int REGULAR = 0;
+        public static final int SQUARE = 0;
         public static final int DIVIDER = 1;
         public static final int SINGLE_ROW = 2;
     }
diff --git a/src/com/android/contacts/list/ContactTileSquareView.java b/src/com/android/contacts/list/ContactTileSquareView.java
new file mode 100644
index 0000000..7716481
--- /dev/null
+++ b/src/com/android/contacts/list/ContactTileSquareView.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.contacts.list;
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+/**
+ * A ContactTileSquare displays the contact's picture overlayed with their name
+ * in a perfect square.
+ */
+public class ContactTileSquareView extends ContactTileView {
+    private final static String TAG = ContactTileSquareView.class.getSimpleName();
+
+    public ContactTileSquareView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        // Getting how much space is currently available and telling our
+        // Children to split it.
+        int width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);
+        int childMeasureSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
+        measureChildren(childMeasureSpec, childMeasureSpec);
+        setMeasuredDimension(width, width);
+    }
+}
diff --git a/src/com/android/contacts/list/ContactTileView.java b/src/com/android/contacts/list/ContactTileView.java
index 883e3f0..ad711cf 100644
--- a/src/com/android/contacts/list/ContactTileView.java
+++ b/src/com/android/contacts/list/ContactTileView.java
@@ -32,21 +32,12 @@
  * A ContactTile displays the contact's picture overlayed with their name
  */
 public class ContactTileView extends FrameLayout {
-    private final static String TAG = "ContactTileView";
+    private final static String TAG = ContactTileView.class.getSimpleName();
 
-    /**
-     * This divides into the width to define the height when
-     * {link DisplayTypes@SINLGE_ROW} is true.
-     */
-    private final static int HEIGHT_RATIO = 5;
     private Uri mLookupUri;
     private ImageView mPhoto;
     private TextView mName;
     private ContactPhotoManager mPhotoManager = null;
-    /**
-     * Is set to true if the {@link ContactTileView} is a square.
-     */
-    private boolean mIsSquare;
 
     public ContactTileView(Context context, AttributeSet attrs) {
         super(context, attrs);
@@ -59,18 +50,14 @@
         mPhoto = (ImageView) findViewById(R.id.contact_tile_image);
     }
 
-    public boolean isSquare() {
-        return mIsSquare;
-    }
-
-    public void setIsSquare(boolean isSquare) {
-        mIsSquare = isSquare;
-    }
-
     public void setPhotoManager(ContactPhotoManager photoManager) {
         mPhotoManager = photoManager;
     }
 
+    /**
+     * Populates the data members to be displayed from the
+     * fields in {@link ContactEntry}
+     */
     public void loadFromContact(ContactEntry entry) {
         if (entry != null) {
             mName.setText(entry.name);
@@ -91,14 +78,4 @@
     public Uri getLookupUri() {
         return mLookupUri;
     }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        // Getting how much space is currently available and telling our
-        // Children to split it.
-        int width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);
-        int childMeasureSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
-        measureChildren(childMeasureSpec, childMeasureSpec);
-        setMeasuredDimension(width, width / (mIsSquare ? 1 : HEIGHT_RATIO));
-    }
 }