Loading core/java/com/android/internal/view/menu/CascadingMenuPopup.java +21 −15 Original line number Original line Diff line number Diff line Loading @@ -181,8 +181,10 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey private View mAnchorView; private View mAnchorView; private View mShownAnchorView; private View mShownAnchorView; private int mLastPosition; private int mLastPosition; private int mInitXOffset; private boolean mHasXOffset; private int mInitYOffset; private boolean mHasYOffset; private int mXOffset; private int mYOffset; private boolean mForceShowIcon; private boolean mForceShowIcon; private boolean mShowTitle; private boolean mShowTitle; private Callback mPresenterCallback; private Callback mPresenterCallback; Loading Loading @@ -379,9 +381,6 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey parentView = null; parentView = null; } } final int x; final int y; final Rect epicenterBounds; if (parentView != null) { if (parentView != null) { // This menu is a cascading submenu anchored to a parent view. // This menu is a cascading submenu anchored to a parent view. popupWindow.setTouchModal(false); popupWindow.setTouchModal(false); Loading @@ -401,6 +400,7 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey // By now, mDropDownGravity is the resolved absolute gravity, so // By now, mDropDownGravity is the resolved absolute gravity, so // this should work in both LTR and RTL. // this should work in both LTR and RTL. final int x; if ((mDropDownGravity & Gravity.RIGHT) == Gravity.RIGHT) { if ((mDropDownGravity & Gravity.RIGHT) == Gravity.RIGHT) { if (showOnRight) { if (showOnRight) { x = parentOffsetLeft + menuWidth; x = parentOffsetLeft + menuWidth; Loading @@ -415,17 +415,21 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey } } } } y = parentOffsetTop; epicenterBounds = null; } else { x = mInitXOffset; y = mInitYOffset; epicenterBounds = getEpicenterBounds(); } popupWindow.setHorizontalOffset(x); popupWindow.setHorizontalOffset(x); final int y = parentOffsetTop; popupWindow.setVerticalOffset(y); popupWindow.setVerticalOffset(y); } else { if (mHasXOffset) { popupWindow.setHorizontalOffset(mXOffset); } if (mHasYOffset) { popupWindow.setVerticalOffset(mYOffset); } final Rect epicenterBounds = getEpicenterBounds(); popupWindow.setEpicenterBounds(epicenterBounds); popupWindow.setEpicenterBounds(epicenterBounds); } final CascadingMenuInfo menuInfo = new CascadingMenuInfo(popupWindow, menu, mLastPosition); final CascadingMenuInfo menuInfo = new CascadingMenuInfo(popupWindow, menu, mLastPosition); mShowingMenus.add(menuInfo); mShowingMenus.add(menuInfo); Loading Loading @@ -712,12 +716,14 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey @Override @Override public void setHorizontalOffset(int x) { public void setHorizontalOffset(int x) { mInitXOffset = x; mHasXOffset = true; mXOffset = x; } } @Override @Override public void setVerticalOffset(int y) { public void setVerticalOffset(int y) { mInitYOffset = y; mHasYOffset = true; mYOffset = y; } } @Override @Override Loading core/java/com/android/internal/view/menu/StandardMenuPopup.java +5 −7 Original line number Original line Diff line number Diff line Loading @@ -108,8 +108,6 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On private int mDropDownGravity = Gravity.NO_GRAVITY; private int mDropDownGravity = Gravity.NO_GRAVITY; private int mXOffset; private int mYOffset; private boolean mShowTitle; private boolean mShowTitle; public StandardMenuPopup(Context context, MenuBuilder menu, View anchorView, int popupStyleAttr, public StandardMenuPopup(Context context, MenuBuilder menu, View anchorView, int popupStyleAttr, Loading Loading @@ -177,8 +175,6 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On mPopup.setContentWidth(mContentWidth); mPopup.setContentWidth(mContentWidth); mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); mPopup.setHorizontalOffset(mXOffset); mPopup.setVerticalOffset(mYOffset); mPopup.setEpicenterBounds(getEpicenterBounds()); mPopup.setEpicenterBounds(getEpicenterBounds()); mPopup.show(); mPopup.show(); Loading Loading @@ -276,7 +272,9 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On mMenu.close(false /* closeAllMenus */); mMenu.close(false /* closeAllMenus */); // Show the new sub-menu popup at the same location as this popup. // Show the new sub-menu popup at the same location as this popup. if (subPopup.tryShow(mXOffset, mYOffset)) { final int horizontalOffset = mPopup.getHorizontalOffset(); final int verticalOffset = mPopup.getVerticalOffset(); if (subPopup.tryShow(horizontalOffset, verticalOffset)) { if (mPresenterCallback != null) { if (mPresenterCallback != null) { mPresenterCallback.onOpenSubMenu(subMenu); mPresenterCallback.onOpenSubMenu(subMenu); } } Loading Loading @@ -338,12 +336,12 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On @Override @Override public void setHorizontalOffset(int x) { public void setHorizontalOffset(int x) { mXOffset = x; mPopup.setHorizontalOffset(x); } } @Override @Override public void setVerticalOffset(int y) { public void setVerticalOffset(int y) { mYOffset = y; mPopup.setVerticalOffset(y); } } @Override @Override Loading Loading
core/java/com/android/internal/view/menu/CascadingMenuPopup.java +21 −15 Original line number Original line Diff line number Diff line Loading @@ -181,8 +181,10 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey private View mAnchorView; private View mAnchorView; private View mShownAnchorView; private View mShownAnchorView; private int mLastPosition; private int mLastPosition; private int mInitXOffset; private boolean mHasXOffset; private int mInitYOffset; private boolean mHasYOffset; private int mXOffset; private int mYOffset; private boolean mForceShowIcon; private boolean mForceShowIcon; private boolean mShowTitle; private boolean mShowTitle; private Callback mPresenterCallback; private Callback mPresenterCallback; Loading Loading @@ -379,9 +381,6 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey parentView = null; parentView = null; } } final int x; final int y; final Rect epicenterBounds; if (parentView != null) { if (parentView != null) { // This menu is a cascading submenu anchored to a parent view. // This menu is a cascading submenu anchored to a parent view. popupWindow.setTouchModal(false); popupWindow.setTouchModal(false); Loading @@ -401,6 +400,7 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey // By now, mDropDownGravity is the resolved absolute gravity, so // By now, mDropDownGravity is the resolved absolute gravity, so // this should work in both LTR and RTL. // this should work in both LTR and RTL. final int x; if ((mDropDownGravity & Gravity.RIGHT) == Gravity.RIGHT) { if ((mDropDownGravity & Gravity.RIGHT) == Gravity.RIGHT) { if (showOnRight) { if (showOnRight) { x = parentOffsetLeft + menuWidth; x = parentOffsetLeft + menuWidth; Loading @@ -415,17 +415,21 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey } } } } y = parentOffsetTop; epicenterBounds = null; } else { x = mInitXOffset; y = mInitYOffset; epicenterBounds = getEpicenterBounds(); } popupWindow.setHorizontalOffset(x); popupWindow.setHorizontalOffset(x); final int y = parentOffsetTop; popupWindow.setVerticalOffset(y); popupWindow.setVerticalOffset(y); } else { if (mHasXOffset) { popupWindow.setHorizontalOffset(mXOffset); } if (mHasYOffset) { popupWindow.setVerticalOffset(mYOffset); } final Rect epicenterBounds = getEpicenterBounds(); popupWindow.setEpicenterBounds(epicenterBounds); popupWindow.setEpicenterBounds(epicenterBounds); } final CascadingMenuInfo menuInfo = new CascadingMenuInfo(popupWindow, menu, mLastPosition); final CascadingMenuInfo menuInfo = new CascadingMenuInfo(popupWindow, menu, mLastPosition); mShowingMenus.add(menuInfo); mShowingMenus.add(menuInfo); Loading Loading @@ -712,12 +716,14 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey @Override @Override public void setHorizontalOffset(int x) { public void setHorizontalOffset(int x) { mInitXOffset = x; mHasXOffset = true; mXOffset = x; } } @Override @Override public void setVerticalOffset(int y) { public void setVerticalOffset(int y) { mInitYOffset = y; mHasYOffset = true; mYOffset = y; } } @Override @Override Loading
core/java/com/android/internal/view/menu/StandardMenuPopup.java +5 −7 Original line number Original line Diff line number Diff line Loading @@ -108,8 +108,6 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On private int mDropDownGravity = Gravity.NO_GRAVITY; private int mDropDownGravity = Gravity.NO_GRAVITY; private int mXOffset; private int mYOffset; private boolean mShowTitle; private boolean mShowTitle; public StandardMenuPopup(Context context, MenuBuilder menu, View anchorView, int popupStyleAttr, public StandardMenuPopup(Context context, MenuBuilder menu, View anchorView, int popupStyleAttr, Loading Loading @@ -177,8 +175,6 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On mPopup.setContentWidth(mContentWidth); mPopup.setContentWidth(mContentWidth); mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); mPopup.setHorizontalOffset(mXOffset); mPopup.setVerticalOffset(mYOffset); mPopup.setEpicenterBounds(getEpicenterBounds()); mPopup.setEpicenterBounds(getEpicenterBounds()); mPopup.show(); mPopup.show(); Loading Loading @@ -276,7 +272,9 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On mMenu.close(false /* closeAllMenus */); mMenu.close(false /* closeAllMenus */); // Show the new sub-menu popup at the same location as this popup. // Show the new sub-menu popup at the same location as this popup. if (subPopup.tryShow(mXOffset, mYOffset)) { final int horizontalOffset = mPopup.getHorizontalOffset(); final int verticalOffset = mPopup.getVerticalOffset(); if (subPopup.tryShow(horizontalOffset, verticalOffset)) { if (mPresenterCallback != null) { if (mPresenterCallback != null) { mPresenterCallback.onOpenSubMenu(subMenu); mPresenterCallback.onOpenSubMenu(subMenu); } } Loading Loading @@ -338,12 +336,12 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On @Override @Override public void setHorizontalOffset(int x) { public void setHorizontalOffset(int x) { mXOffset = x; mPopup.setHorizontalOffset(x); } } @Override @Override public void setVerticalOffset(int y) { public void setVerticalOffset(int y) { mYOffset = y; mPopup.setVerticalOffset(y); } } @Override @Override Loading