diff options
author | Michael Kolb <kolby@google.com> | 2012-02-24 13:48:30 -0800 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2012-02-24 13:53:19 -0800 |
commit | a4befac241ec69791fd30e11355ed3dc10d7fb37 (patch) | |
tree | 86e57eafe3da5062fbceb4c567cbf28fd0e7bd95 /src/com/android/browser/view | |
parent | 7458d4cbde2e5e49503d6e87924930d381b7ad89 (diff) | |
download | packages_apps_Browser-a4befac241ec69791fd30e11355ed3dc10d7fb37.zip packages_apps_Browser-a4befac241ec69791fd30e11355ed3dc10d7fb37.tar.gz packages_apps_Browser-a4befac241ec69791fd30e11355ed3dc10d7fb37.tar.bz2 |
limit pie submenu to screen
Bug: 6050725
Change-Id: I3aa3154501a36a93aac50e1e5c0bae40cf0aeac2
Diffstat (limited to 'src/com/android/browser/view')
-rw-r--r-- | src/com/android/browser/view/BasePieView.java | 3 | ||||
-rw-r--r-- | src/com/android/browser/view/PieListView.java | 10 | ||||
-rw-r--r-- | src/com/android/browser/view/PieMenu.java | 5 | ||||
-rw-r--r-- | src/com/android/browser/view/PieStackView.java | 5 |
4 files changed, 15 insertions, 8 deletions
diff --git a/src/com/android/browser/view/BasePieView.java b/src/com/android/browser/view/BasePieView.java index ec02e3a..b9178be 100644 --- a/src/com/android/browser/view/BasePieView.java +++ b/src/com/android/browser/view/BasePieView.java @@ -109,7 +109,8 @@ public abstract class BasePieView implements PieMenu.PieView { * needs to set top, left, width, height */ @Override - public void layout(int anchorX, int anchorY, boolean left, float angle) { + public void layout(int anchorX, int anchorY, boolean left, float angle, + int parentHeight) { if (mListener != null) { mListener.onLayout(anchorX, anchorY, left); } diff --git a/src/com/android/browser/view/PieListView.java b/src/com/android/browser/view/PieListView.java index 04b512b..1043fc7 100644 --- a/src/com/android/browser/view/PieListView.java +++ b/src/com/android/browser/view/PieListView.java @@ -39,13 +39,17 @@ public class PieListView extends BasePieView { * this will be called before the first draw call */ @Override - public void layout(int anchorX, int anchorY, boolean left, float angle) { - super.layout(anchorX, anchorY, left, angle); + public void layout(int anchorX, int anchorY, boolean left, float angle, + int pHeight) { + super.layout(anchorX, anchorY, left, angle, pHeight); buildViews(); mWidth = mChildWidth; mHeight = mChildHeight * mAdapter.getCount(); mLeft = anchorX + (left ? 0 : - mChildWidth); - mTop = anchorY - mHeight / 2; + mTop = Math.max(anchorY - mHeight / 2, 0); + if (mTop + mHeight > pHeight) { + mTop = pHeight - mHeight; + } if (mViews != null) { layoutChildrenLinear(); } diff --git a/src/com/android/browser/view/PieMenu.java b/src/com/android/browser/view/PieMenu.java index 536ac92..7f8dd6b 100644 --- a/src/com/android/browser/view/PieMenu.java +++ b/src/com/android/browser/view/PieMenu.java @@ -60,7 +60,8 @@ public class PieMenu extends FrameLayout { public void setLayoutListener(OnLayoutListener l); - public void layout(int anchorX, int anchorY, boolean onleft, float angle); + public void layout(int anchorX, int anchorY, boolean onleft, float angle, + int parentHeight); public void draw(Canvas c); @@ -383,7 +384,7 @@ public class PieMenu extends FrameLayout { } private void layoutPieView(PieView pv, int x, int y, float angle) { - pv.layout(x, y, onTheLeft(), angle); + pv.layout(x, y, onTheLeft(), angle, getHeight()); } /** diff --git a/src/com/android/browser/view/PieStackView.java b/src/com/android/browser/view/PieStackView.java index 7e1922d..16d42cb 100644 --- a/src/com/android/browser/view/PieStackView.java +++ b/src/com/android/browser/view/PieStackView.java @@ -59,8 +59,9 @@ public class PieStackView extends BasePieView { * this will be called before the first draw call */ @Override - public void layout(int anchorX, int anchorY, boolean left, float angle) { - super.layout(anchorX, anchorY, left, angle); + public void layout(int anchorX, int anchorY, boolean left, float angle, + int pHeight) { + super.layout(anchorX, anchorY, left, angle, pHeight); buildViews(); mWidth = mChildWidth; mHeight = mChildHeight + (mViews.size() - 1) * mMinHeight; |