Merge "ContactTile column counts are now dynamically adjusted."
diff --git a/res/values/config.xml b/res/values-sw580dp-w1000dp/integers.xml
similarity index 71%
copy from res/values/config.xml
copy to res/values-sw580dp-w1000dp/integers.xml
index 6ebaa1f..5fda2ed 100644
--- a/res/values/config.xml
+++ b/res/values-sw580dp-w1000dp/integers.xml
@@ -13,12 +13,6 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
 <resources>
-
-    <!-- Amount of memory in bytes allocated for photo cache -->
-    <integer name="config_photo_cache_max_bytes">2000000</integer>
-
-    <!-- Number of decoded photo bitmaps retained in an LRU cache -->
-    <integer name="config_photo_cache_max_bitmaps">48</integer>
-</resources>
+    <integer name="contact_tile_column_count">4</integer>
+</resources>
\ No newline at end of file
diff --git a/res/values/config.xml b/res/values-sw580dp-w720dp/integers.xml
similarity index 71%
copy from res/values/config.xml
copy to res/values-sw580dp-w720dp/integers.xml
index 6ebaa1f..c629f7e 100644
--- a/res/values/config.xml
+++ b/res/values-sw580dp-w720dp/integers.xml
@@ -13,12 +13,6 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
 <resources>
-
-    <!-- Amount of memory in bytes allocated for photo cache -->
-    <integer name="config_photo_cache_max_bytes">2000000</integer>
-
-    <!-- Number of decoded photo bitmaps retained in an LRU cache -->
-    <integer name="config_photo_cache_max_bitmaps">48</integer>
+    <integer name="contact_tile_column_count">2</integer>
 </resources>
diff --git a/res/values/config.xml b/res/values-sw580dp/integers.xml
similarity index 71%
copy from res/values/config.xml
copy to res/values-sw580dp/integers.xml
index 6ebaa1f..c629f7e 100644
--- a/res/values/config.xml
+++ b/res/values-sw580dp/integers.xml
@@ -13,12 +13,6 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
 <resources>
-
-    <!-- Amount of memory in bytes allocated for photo cache -->
-    <integer name="config_photo_cache_max_bytes">2000000</integer>
-
-    <!-- Number of decoded photo bitmaps retained in an LRU cache -->
-    <integer name="config_photo_cache_max_bitmaps">48</integer>
+    <integer name="contact_tile_column_count">2</integer>
 </resources>
diff --git a/res/values/config.xml b/res/values-w470dp/integers.xml
similarity index 71%
copy from res/values/config.xml
copy to res/values-w470dp/integers.xml
index 6ebaa1f..d247e46 100644
--- a/res/values/config.xml
+++ b/res/values-w470dp/integers.xml
@@ -13,12 +13,6 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
 <resources>
-
-    <!-- Amount of memory in bytes allocated for photo cache -->
-    <integer name="config_photo_cache_max_bytes">2000000</integer>
-
-    <!-- Number of decoded photo bitmaps retained in an LRU cache -->
-    <integer name="config_photo_cache_max_bitmaps">48</integer>
+    <integer name="contact_tile_column_count">4</integer>
 </resources>
diff --git a/res/values/config.xml b/res/values/integers.xml
similarity index 88%
rename from res/values/config.xml
rename to res/values/integers.xml
index 6ebaa1f..1d3f9b9 100644
--- a/res/values/config.xml
+++ b/res/values/integers.xml
@@ -15,10 +15,12 @@
 -->
 
 <resources>
-
     <!-- Amount of memory in bytes allocated for photo cache -->
     <integer name="config_photo_cache_max_bytes">2000000</integer>
 
     <!-- Number of decoded photo bitmaps retained in an LRU cache -->
     <integer name="config_photo_cache_max_bitmaps">48</integer>
+
+    <!--  Determines the number of columns in a ContactTileRow -->
+    <integer name="contact_tile_column_count">2</integer>
 </resources>
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index d6661db..eecb375 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -16,7 +16,6 @@
 
 package com.android.contacts.activities;
 
-import com.android.contacts.ContactLoader;
 import com.android.contacts.ContactSaveService;
 import com.android.contacts.ContactsActivity;
 import com.android.contacts.R;
@@ -103,8 +102,6 @@
     private static final int SUBACTIVITY_EDIT_GROUP = 5;
     private static final int SUBACTIVITY_CUSTOMIZE_FILTER = 6;
 
-    private static final int FAVORITES_COLUMN_COUNT = 4;
-
     private static final String KEY_SEARCH_MODE = "searchMode";
 
     private DialogManager mDialogManager = new DialogManager(this);
@@ -203,7 +200,6 @@
         } else if (fragment instanceof StrequentContactListFragment) {
             mFavoritesFragment = (StrequentContactListFragment) fragment;
             mFavoritesFragment.setListener(mFavoritesFragmentListener);
-            mFavoritesFragment.setColumnCount(FAVORITES_COLUMN_COUNT);
             mFavoritesFragment.setDisplayType(DisplayType.STARRED_ONLY);
         }
     }
diff --git a/src/com/android/contacts/group/GroupDetailFragment.java b/src/com/android/contacts/group/GroupDetailFragment.java
index 9784187..c4824ae 100644
--- a/src/com/android/contacts/group/GroupDetailFragment.java
+++ b/src/com/android/contacts/group/GroupDetailFragment.java
@@ -31,6 +31,7 @@
 import android.content.Context;
 import android.content.CursorLoader;
 import android.content.Loader;
+import android.content.res.Resources;
 import android.database.Cursor;
 import android.net.Uri;
 import android.os.Bundle;
@@ -44,7 +45,6 @@
 import android.widget.AbsListView.OnScrollListener;
 import android.widget.ListView;
 import android.widget.TextView;
-import android.widget.Toast;
 
 /**
  * Displays the details of a group and shows a list of actions possible for the group.
@@ -72,7 +72,6 @@
 
     private static final int LOADER_METADATA = 0;
     private static final int LOADER_MEMBERS = 1;
-    private static final int NUM_COLS = 4;
 
     private Context mContext;
 
@@ -99,7 +98,11 @@
     public void onAttach(Activity activity) {
         super.onAttach(activity);
         mContext = activity;
-        mAdapter = new ContactTileAdapter(activity, mContactTileListener, NUM_COLS,
+
+        Resources res = getResources();
+        int columnCount = res.getInteger(R.integer.contact_tile_column_count);
+
+        mAdapter = new ContactTileAdapter(activity, mContactTileListener, columnCount,
                 DisplayType.GROUP_MEMBERS);
         configurePhotoLoader();
     }
diff --git a/src/com/android/contacts/list/StrequentContactListFragment.java b/src/com/android/contacts/list/StrequentContactListFragment.java
index e0f0dc1..18edaea 100644
--- a/src/com/android/contacts/list/StrequentContactListFragment.java
+++ b/src/com/android/contacts/list/StrequentContactListFragment.java
@@ -26,6 +26,7 @@
 import android.app.LoaderManager.LoaderCallbacks;
 import android.content.CursorLoader;
 import android.content.Loader;
+import android.content.res.Resources;
 import android.database.Cursor;
 import android.net.Uri;
 import android.os.Bundle;
@@ -44,7 +45,6 @@
     }
 
     private static int LOADER_STREQUENT = 1;
-    private static final int NUM_COLS = 2;
 
     private Listener mListener;
     private ContactTileAdapter mAdapter;
@@ -53,8 +53,12 @@
     @Override
     public void onAttach(Activity activity) {
         super.onAttach(activity);
+
+        Resources res = getResources();
+        int columnCount = res.getInteger(R.integer.contact_tile_column_count);
+
         mAdapter = new ContactTileAdapter(activity, mAdapterListener,
-                NUM_COLS, DisplayType.STREQUENT);
+                columnCount, DisplayType.STREQUENT);
         mAdapter.setPhotoLoader(ContactPhotoManager.getInstance(activity));
     }