summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/CellLayout.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-06-06 21:27:03 -0700
committerAdam Cohen <adamcohen@google.com>2013-06-06 21:28:57 -0700
commitf0f4eda31841f41d892bf18847c1acdc45d2cd64 (patch)
tree591b09ebbd03d34bf8a60e99cf60c4f5a32f9620 /src/com/android/launcher3/CellLayout.java
parente441bbc7d2baee03e96897b80f55db5ce2aa7e1f (diff)
downloadandroid_packages_apps_Trebuchet-f0f4eda31841f41d892bf18847c1acdc45d2cd64.tar.gz
android_packages_apps_Trebuchet-f0f4eda31841f41d892bf18847c1acdc45d2cd64.tar.bz2
android_packages_apps_Trebuchet-f0f4eda31841f41d892bf18847c1acdc45d2cd64.zip
Making folders scrollable
Change-Id: Id6c9ec62acc6d86dc627d20abad3e2d92010f539
Diffstat (limited to 'src/com/android/launcher3/CellLayout.java')
-rw-r--r--src/com/android/launcher3/CellLayout.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 842037c31..e115e43f5 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -106,6 +106,10 @@ public class CellLayout extends ViewGroup {
private Rect mForegroundRect;
private int mForegroundPadding;
+ // These values allow a fixed measurement to be set on the CellLayout.
+ private int mFixedWidth = -1;
+ private int mFixedHeight = -1;
+
// If we're actively dragging something over this screen, mIsDragOverlapping is true
private boolean mIsDragOverlapping = false;
private final Point mDragCenter = new Point();
@@ -972,6 +976,11 @@ public class CellLayout extends ViewGroup {
metrics.set(cellWidth, cellHeight, widthGap, heightGap);
}
+ public void setFixedSize(int width, int height) {
+ mFixedWidth = width;
+ mFixedHeight = height;
+ }
+
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
@@ -980,7 +989,12 @@ public class CellLayout extends ViewGroup {
int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSpecSize = MeasureSpec.getSize(heightMeasureSpec);
- if (widthSpecMode == MeasureSpec.UNSPECIFIED || heightSpecMode == MeasureSpec.UNSPECIFIED) {
+ int newWidth = widthSpecSize;
+ int newHeight = heightSpecSize;
+ if (mFixedWidth > 0 && mFixedHeight > 0) {
+ newWidth = mFixedWidth;
+ newHeight = mFixedHeight;
+ } else if (widthSpecMode == MeasureSpec.UNSPECIFIED || heightSpecMode == MeasureSpec.UNSPECIFIED) {
throw new RuntimeException("CellLayout cannot have UNSPECIFIED dimensions");
}
@@ -1002,8 +1016,6 @@ public class CellLayout extends ViewGroup {
}
// Initial values correspond to widthSpecMode == MeasureSpec.EXACTLY
- int newWidth = widthSpecSize;
- int newHeight = heightSpecSize;
if (widthSpecMode == MeasureSpec.AT_MOST) {
newWidth = getPaddingLeft() + getPaddingRight() + (mCountX * mCellWidth) +
((mCountX - 1) * mWidthGap);