summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2012-02-24 13:48:30 -0800
committerMichael Kolb <kolby@google.com>2012-02-24 13:53:19 -0800
commita4befac241ec69791fd30e11355ed3dc10d7fb37 (patch)
tree86e57eafe3da5062fbceb4c567cbf28fd0e7bd95 /src/com/android/browser
parent7458d4cbde2e5e49503d6e87924930d381b7ad89 (diff)
downloadpackages_apps_Browser-a4befac241ec69791fd30e11355ed3dc10d7fb37.tar.gz
packages_apps_Browser-a4befac241ec69791fd30e11355ed3dc10d7fb37.tar.bz2
packages_apps_Browser-a4befac241ec69791fd30e11355ed3dc10d7fb37.zip
limit pie submenu to screen
Bug: 6050725 Change-Id: I3aa3154501a36a93aac50e1e5c0bae40cf0aeac2
Diffstat (limited to 'src/com/android/browser')
-rw-r--r--src/com/android/browser/view/BasePieView.java3
-rw-r--r--src/com/android/browser/view/PieListView.java10
-rw-r--r--src/com/android/browser/view/PieMenu.java5
-rw-r--r--src/com/android/browser/view/PieStackView.java5
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 ec02e3a68..b9178be07 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 04b512b17..1043fc772 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 536ac92fd..7f8dd6b8d 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 7e1922d81..16d42cbcc 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;