diff options
author | Adam Cohen <adamcohen@google.com> | 2011-11-15 17:10:00 -0800 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2011-11-15 17:10:20 -0800 |
commit | 78dc83e875fdf541881cfb867ec38bee21d546e9 (patch) | |
tree | 75414000e07bec2079a1faaf9c6b7d52802b6a3e | |
parent | 2cf7a80c87b07d2e729ef6c86d547a33b49db47d (diff) | |
download | android_packages_apps_Trebuchet-78dc83e875fdf541881cfb867ec38bee21d546e9.tar.gz android_packages_apps_Trebuchet-78dc83e875fdf541881cfb867ec38bee21d546e9.tar.bz2 android_packages_apps_Trebuchet-78dc83e875fdf541881cfb867ec38bee21d546e9.zip |
Modifying portals in landscape on the phone UI
Change-Id: I4190b0e4958dfd0d59d943d9b4c4d6fd2e9303c0
-rw-r--r-- | res/values-land/config.xml | 5 | ||||
-rw-r--r-- | res/values-sw600dp/config.xml | 5 | ||||
-rw-r--r-- | res/values/config.xml | 6 | ||||
-rw-r--r-- | src/com/android/launcher2/Folder.java | 18 |
4 files changed, 29 insertions, 5 deletions
diff --git a/res/values-land/config.xml b/res/values-land/config.xml index 121bb0c14..fc20456c3 100644 --- a/res/values-land/config.xml +++ b/res/values-land/config.xml @@ -20,4 +20,9 @@ <bool name="config_useDropTargetDownTransition">false</bool> <!-- Whether or not to fade the side pages --> <bool name="config_workspaceFadeAdjacentScreens">false</bool> + + <!-- Folder max bounds and max number of items. + Note: folder_max_count_x * folder_max_count_y >= folder_max_num_items. --> + <integer name="folder_max_count_x">6</integer> + <integer name="folder_max_count_y">3</integer> </resources> diff --git a/res/values-sw600dp/config.xml b/res/values-sw600dp/config.xml index 2a81e12a1..7a0789839 100644 --- a/res/values-sw600dp/config.xml +++ b/res/values-sw600dp/config.xml @@ -19,4 +19,9 @@ <!-- When shrinking the workspace, this is the percentage of its original size. --> <integer name="config_workspaceShrinkPercent">17</integer> + <!-- Folder max bounds and max number of items. Note: folder_max_count_x * folder_max_count_y + >= folder_max_num_items. When these are set to -1, they are automatically determined. --> + <integer name="folder_max_count_x">-1</integer> + <integer name="folder_max_count_y">-1</integer> + <integer name="folder_max_num_items">-1</integer> </resources> diff --git a/res/values/config.xml b/res/values/config.xml index b8040e68f..7ab98707c 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -84,4 +84,10 @@ <!-- When shrinking the workspace, this is the percentage of its original size. --> <integer name="config_workspaceShrinkPercent">17</integer> + + <!-- Folder max bounds and max number of items. Note: folder_max_count_x * folder_max_count_y + >= folder_max_num_items. When these are set to -1, they are automatically determined. --> + <integer name="folder_max_count_x">4</integer> + <integer name="folder_max_count_y">4</integer> + <integer name="folder_max_num_items">16</integer> </resources> diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java index 33b5de17c..a6757d7f1 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<View> mItemsInReadingOrder = new ArrayList<View>(); @@ -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() { |