diff options
author | Winson Chung <winsonc@google.com> | 2011-04-14 16:08:02 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-04-22 12:53:59 -0700 |
commit | 785d2eb2b8d7072c8124300dd9168ff51a91cf38 (patch) | |
tree | a87bc934f8496b2dead1e508260d88c978a038ce /src/com/android/launcher2/PagedViewExtendedLayout.java | |
parent | f579b5041afe8272c79f9f13001120d37eeeee7b (diff) | |
download | android_packages_apps_Trebuchet-785d2eb2b8d7072c8124300dd9168ff51a91cf38.tar.gz android_packages_apps_Trebuchet-785d2eb2b8d7072c8124300dd9168ff51a91cf38.tar.bz2 android_packages_apps_Trebuchet-785d2eb2b8d7072c8124300dd9168ff51a91cf38.zip |
Initial changes to merged AllApps/Customize pane in the Phone UI.
Change-Id: Ifa1676736033fe617dd0cca965156c38fa452948
Diffstat (limited to 'src/com/android/launcher2/PagedViewExtendedLayout.java')
-rw-r--r-- | src/com/android/launcher2/PagedViewExtendedLayout.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/launcher2/PagedViewExtendedLayout.java b/src/com/android/launcher2/PagedViewExtendedLayout.java index 81f14982f..776b99fab 100644 --- a/src/com/android/launcher2/PagedViewExtendedLayout.java +++ b/src/com/android/launcher2/PagedViewExtendedLayout.java @@ -40,6 +40,22 @@ public class PagedViewExtendedLayout extends LinearLayout implements Page { super(context, attrs, defStyle); } + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if (LauncherApplication.isScreenXLarge()) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } else { + // PagedView currently has issues with different-sized pages since it calculates the + // offset of each page to scroll to before it updates the actual size of each page + // (which canchange depending on the content if the contains aren't a fixed size). + // We work around this by having a minimum size on each widget page). + int widthSpecSize = Math.max(getSuggestedMinimumWidth(), + MeasureSpec.getSize(widthMeasureSpec)); + int widthSpecMode = MeasureSpec.AT_MOST; + super.onMeasure(MeasureSpec.makeMeasureSpec(widthSpecSize, widthSpecMode), + heightMeasureSpec); + } + } + @Override public boolean onTouchEvent(MotionEvent event) { // We eat up the touch events here, since the PagedView (which uses the same swiping @@ -94,4 +110,11 @@ public class PagedViewExtendedLayout extends LinearLayout implements Page { public int indexOfChildOnPage(View v) { return indexOfChild(v); } + + public static class LayoutParams extends LinearLayout.LayoutParams { + public LayoutParams() { + super(LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.MATCH_PARENT); + } + } } |