diff --git a/res/values-land/config.xml b/res/values-land/config.xml
index 121bb0c146..fc20456c3f 100644
--- a/res/values-land/config.xml
+++ b/res/values-land/config.xml
@@ -20,4 +20,9 @@
false
false
+
+
+ 6
+ 3
diff --git a/res/values-sw600dp/config.xml b/res/values-sw600dp/config.xml
index 2a81e12a15..7a0789839b 100644
--- a/res/values-sw600dp/config.xml
+++ b/res/values-sw600dp/config.xml
@@ -19,4 +19,9 @@
17
+
+ -1
+ -1
+ -1
diff --git a/res/values/config.xml b/res/values/config.xml
index b8040e68fc..7ab98707ce 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -84,4 +84,10 @@
17
+
+
+ 4
+ 4
+ 16
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 33b5de17c7..a6757d7f1a 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -83,6 +83,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private FolderIcon mFolderIcon;
private int mMaxCountX;
private int mMaxCountY;
+ private int mMaxNumItems;
private Rect mNewSize = new Rect();
private Rect mIconRect = new Rect();
private ArrayList mItemsInReadingOrder = new ArrayList();
@@ -121,13 +122,20 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
setAlwaysDrawnWithCacheEnabled(false);
mInflater = LayoutInflater.from(context);
mIconCache = ((LauncherApplication)context.getApplicationContext()).getIconCache();
- mMaxCountX = LauncherModel.getCellCountX();
- mMaxCountY = LauncherModel.getCellCountY();
+
+ Resources res = getResources();
+ mMaxCountX = res.getInteger(R.integer.folder_max_count_x);
+ mMaxCountY = res.getInteger(R.integer.folder_max_count_y);
+ mMaxNumItems = res.getInteger(R.integer.folder_max_num_items);
+ if (mMaxCountX < 0 || mMaxCountY < 0 || mMaxNumItems < 0) {
+ mMaxCountX = LauncherModel.getCellCountX();
+ mMaxCountY = LauncherModel.getCellCountY();
+ mMaxNumItems = mMaxCountX * mMaxCountY;
+ }
mInputMethodManager = (InputMethodManager)
mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
- Resources res = getResources();
mExpandDuration = res.getInteger(R.integer.config_folderAnimDuration);
if (sDefaultFolderName == null) {
@@ -746,7 +754,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
int oldCountY = countY;
if (countX * countY < count) {
// Current grid is too small, expand it
- if (countX <= countY && countX < mMaxCountX) {
+ if ((countX <= countY || countY == mMaxCountY) && countX < mMaxCountX) {
countX++;
} else if (countY < mMaxCountY) {
countY++;
@@ -764,7 +772,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
public boolean isFull() {
- return getItemCount() >= mMaxCountX * mMaxCountY;
+ return getItemCount() >= mMaxNumItems;
}
private void centerAboutIcon() {