@@ -52,6 +52,10 @@ public class PageModule extends ModuleExtension {
5252 protected static final String RESULT_MENU_BAR_TOP = "menuBarTop" ;
5353 protected static final String RESULT_MENU_BAR_RIGHT = "menuBarRight" ;
5454 protected static final String RESULT_MENU_BAR_BOTTOM = "menuBarBottom" ;
55+ protected static final String RESULT_MENU_BAR_PAGE_LEFT = "menuBarPageLeft" ;
56+ protected static final String RESULT_MENU_BAR_PAGE_RIGHT = "menuBarPageRight" ;
57+ protected static final String RESULT_MENU_BAR_PAGE_TOP = "menuBarPageTop" ;
58+ protected static final String RESULT_MENU_BAR_PAGE_BOTTOM = "menuBarPageBottom" ;
5559 protected static final String ACTION_SET_MENUBAR_DATA = "setMenubarData" ;
5660 protected static final String ACTION_SET_MENUBAR_TIPS = "setMenubarTips" ;
5761 protected static final String ACTION_SET_TABBAR_ITEM = "setTabBarItem" ;
@@ -135,12 +139,17 @@ private Response getMenuBarBoundingRect(Request request) throws JSONException {
135139 JSONObject result = new JSONObject ();
136140 Display display = getDisPlay (request );
137141 View menubarView = null ;
142+ Rect contentInsets = null ;
138143 if (null != display ) {
139144 menubarView = display .getMenuBar ();
145+ contentInsets = display .getContentInsets ();
140146 }
141147 Rect rect = new Rect ();
148+ int [] positionWindow = null ;
142149 if (null != menubarView ) {
143150 menubarView .getGlobalVisibleRect (rect );
151+ positionWindow = new int [2 ];
152+ menubarView .getLocationInWindow (positionWindow );
144153 }
145154 int designWidth = -1 ;
146155 HapEngine hapEngine = null ;
@@ -157,6 +166,12 @@ private Response getMenuBarBoundingRect(Request request) throws JSONException {
157166 result .put (RESULT_MENU_BAR_TOP , DisplayUtil .getDesignPxByWidth (rect .top , designWidth ));
158167 result .put (RESULT_MENU_BAR_RIGHT , DisplayUtil .getDesignPxByWidth (rect .right , designWidth ));
159168 result .put (RESULT_MENU_BAR_BOTTOM , DisplayUtil .getDesignPxByWidth (rect .bottom , designWidth ));
169+ if (null != positionWindow && positionWindow .length == 2 ) {
170+ result .put (RESULT_MENU_BAR_PAGE_LEFT , DisplayUtil .getDesignPxByWidth (positionWindow [0 ], designWidth ));
171+ result .put (RESULT_MENU_BAR_PAGE_TOP , DisplayUtil .getDesignPxByWidth (positionWindow [1 ] - (null != contentInsets ? contentInsets .top : 0 ), designWidth ));
172+ result .put (RESULT_MENU_BAR_PAGE_RIGHT , DisplayUtil .getDesignPxByWidth (positionWindow [0 ] + menubarView .getWidth (), designWidth ));
173+ result .put (RESULT_MENU_BAR_PAGE_BOTTOM , DisplayUtil .getDesignPxByWidth (positionWindow [1 ] + menubarView .getHeight () - (null != contentInsets ? contentInsets .top : 0 ), designWidth ));
174+ }
160175 } else {
161176 result .put (RESULT_MENU_BAR_WIDTH , -1 );
162177 result .put (RESULT_MENU_BAR_HEIGHT , -1 );
0 commit comments