summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/PagedView.java
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2010-11-04 16:15:23 -0700
committerAdam Lesinski <adamlesinski@google.com>2010-11-17 10:57:43 -0800
commit6b879f0a5885274a85333531e091283405d490cc (patch)
treeeca43695425abca4fb465919aef7c4b295abc25d /src/com/android/launcher2/PagedView.java
parent61033d3d86fcae1f654f3fbfc9979d131e265d76 (diff)
downloadandroid_packages_apps_Trebuchet-6b879f0a5885274a85333531e091283405d490cc.tar.gz
android_packages_apps_Trebuchet-6b879f0a5885274a85333531e091283405d490cc.tar.bz2
android_packages_apps_Trebuchet-6b879f0a5885274a85333531e091283405d490cc.zip
Layout tweaks in Launcher
-Removed All apps and Configure toolbar buttons from Customization Drawer, removed Configure button from All apps and added Market icon to All apps -Changed spacing of CellLayouts when scrolling -Modified gap spacing in workspace layout -Made workspace invisible in All apps but touching the place where the workspace was takes you back to workspace Change-Id: I6e2579bfebeb8f1f80fdae07da442f6d399abe33
Diffstat (limited to 'src/com/android/launcher2/PagedView.java')
-rw-r--r--src/com/android/launcher2/PagedView.java32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index d4dffe6b0..fb8b7d64d 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -349,11 +349,16 @@ public abstract class PagedView extends ViewGroup {
throw new IllegalStateException("Workspace can only be used in EXACTLY mode.");
}
+ /* Allow the height to be set as WRAP_CONTENT. This allows the particular case
+ * of the All apps view on XLarge displays to not take up more space then it needs. Width
+ * is still not allowed to be set as WRAP_CONTENT since many parts of the code expect
+ * each page to have the same width.
+ */
final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
- final int heightSize = MeasureSpec.getSize(heightMeasureSpec);
- if (heightMode != MeasureSpec.EXACTLY) {
- throw new IllegalStateException("Workspace can only be used in EXACTLY mode.");
- }
+ int heightSize = MeasureSpec.getSize(heightMeasureSpec);
+ int maxChildHeight = 0;
+
+ final int verticalPadding = mPaddingTop + mPaddingBottom;
// The children are given the same width and height as the workspace
// unless they were set to WRAP_CONTENT
@@ -380,9 +385,14 @@ public abstract class PagedView extends ViewGroup {
final int childWidthMeasureSpec =
MeasureSpec.makeMeasureSpec(widthSize, childWidthMode);
final int childHeightMeasureSpec =
- MeasureSpec.makeMeasureSpec(heightSize, childHeightMode);
+ MeasureSpec.makeMeasureSpec(heightSize - verticalPadding, childHeightMode);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
+ maxChildHeight = Math.max(maxChildHeight, child.getMeasuredHeight());
+ }
+
+ if (heightMode == MeasureSpec.AT_MOST) {
+ heightSize = maxChildHeight + verticalPadding;
}
setMeasuredDimension(widthSize, heightSize);
@@ -399,6 +409,7 @@ public abstract class PagedView extends ViewGroup {
mFirstLayout = false;
}
+ final int verticalPadding = mPaddingTop + mPaddingBottom;
final int childCount = getChildCount();
int childLeft = 0;
if (childCount > 0) {
@@ -409,10 +420,13 @@ public abstract class PagedView extends ViewGroup {
final View child = getChildAt(i);
if (child.getVisibility() != View.GONE) {
final int childWidth = child.getMeasuredWidth();
- final int childHeight = (mCenterPagesVertically ?
- (getMeasuredHeight() - child.getMeasuredHeight()) / 2 : 0);
- child.layout(childLeft, childHeight,
- childLeft + childWidth, childHeight + child.getMeasuredHeight());
+ final int childHeight = child.getMeasuredHeight();
+ int childTop = mPaddingTop;
+ if (mCenterPagesVertically) {
+ childTop += ((getMeasuredHeight() - verticalPadding) - childHeight) / 2;
+ }
+ child.layout(childLeft, childTop,
+ childLeft + childWidth, childTop + childHeight);
childLeft += childWidth + mPageSpacing;
}
}