0

I have implemented the radial menu library from here: https://code.google.com/p/radial-menu-widget/downloads/list.

I use the menu inside of a FrameLayout where I show a WebView with a map. If I click on a marker the radial menu pops up. My problem is, that not the whole display respond correctly to let the menu pop up.

Image: http://sceada.bplaced.net/1.png

On the right side the red line marks the boundary of something, I have really no idea what that could be. If I click outside of the red line the menu doesn't pop up. If I switch to landscape it is getting more worse. Image: http:// sceada.bplaced.net/2.png

All views that I could reach have normal values (as expected) for width and heights. So what kind of element could that be?

06-01 18:27:37.295: D/JsInterface(8640): popup.getWidth(): 1196

06-01 18:27:37.295: D/JsInterface(8640): popup.getHeight(): 638

06-01 18:27:37.295: D/JsInterface(8640): popup.getTag(): null

06-01 18:27:37.299: D/JsInterface(8640): Landscape

06-01 18:27:37.299: D/JsInterface(8640): statusBarOffset: 130

06-01 18:27:37.299: D/JsInterface(8640): xPosition: 598

06-01 18:27:37.299: D/JsInterface(8640): yPosition: 319

06-01 18:27:37.299: D/JsInterface(8640): xSource: 609

06-01 18:27:37.299: D/JsInterface(8640): ySource: 272

06-01 18:27:37.299: D/JsInterface(8640): dm.heightPixels: 768

06-01 18:27:37.299: D/JsInterface(8640): dm.widthPixels: 1196

06-01 18:27:37.299: D/JsInterface(8640): webViewHolder.getMeasuredHeight(): 638

06-01 18:27:37.299: D/JsInterface(8640): webViewHolder.getMeasuredWidth(): 1196

06-01 18:27:37.299: D/JsInterface(8640): pieMenu.getHeight(): 638

06-01 18:27:37.299: D/JsInterface(8640): pieMenu.getWidth(): 1196

06-01 18:27:37.299: D/JsInterface(8640): mWebView.getHeight(): 638

06-01 18:27:37.299: D/JsInterface(8640): mWebView.getWidth(): 1196

06-01 18:27:37.304: D/JsInterface(8640): item.getWidth(): 1196

06-01 18:27:37.304: D/JsInterface(8640): item.getHeight(): 638

06-01 18:27:37.304: D/JsInterface(8640): item.getTag(): null

Some code how I create the pie menu:

private void createPieMenu() {
    mMenuItems.clear();
    pieMenu = new RadialMenuWidget(this); 

    menuEditItem = new RadialMenuItem("edit","Edit");
    menuAttributeItem = new RadialMenuItem("attribute","Attribute");
    menuCloseItem = new RadialMenuItem("close", null);

    menuCloseItem.setDisplayIcon(android.R.drawable.ic_menu_close_clear_cancel);
    menuCloseItem.setOnMenuItemPressed(new RadialMenuItem.RadialMenuItemClickListener() {
        @Override
        public void execute() {
            pieMenu.dismiss();
        }
    });

    mMenuItems.add(menuEditItem);
    mMenuItems.add(menuAttributeItem);

    pieMenu.setCenterCircle(menuCloseItem);

    pieMenu.setAnimationSpeed(1000L);

    //pieMenu.setSourceLocation(200, 200);
    //pieMenu.setShowSourceLocation(true);
    pieMenu.setIconSize(15, 30);
    pieMenu.setTextSize(13);
    pieMenu.setOutlineColor(Color.BLACK, 225);
    pieMenu.setInnerRingColor(0x72B7E8, 180);

    pieMenu.addMenuEntry(mMenuItems);


    mJsInterface.setPieMenu(pieMenu);
}

public void showRadialMenu(){
    mContext.runOnUiThread(new Runnable() {
        @Override
        public void run() { 
            webViewHolder.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
            pieMenu.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
            pieMenu.layout(0, 0, (int)webViewHolder.getMeasuredWidth(), (int)webViewHolder.getMeasuredHeight());
            pieMenu.invalidate();
            View popup = (View) pieMenu.getRootView();

            if(popup != null){
                if(Konstanten.D){
                    Log.d("JsInterface", "popup.getWidth(): " + popup.getWidth());
                    Log.d("JsInterface", "popup.getHeight(): " + popup.getHeight());
                    Log.d("JsInterface", "popup.getTag(): " + popup.getTag());
                }
            }
            pieMenu.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
            pieMenu.setAnimation(onOpenAnimation((int)webViewHolder.getMeasuredHeight()/2, (int)webViewHolder.getMeasuredWidth()/2, x, y));
            pieMenu.show(webViewHolder, 0, 0);

            int count = webViewHolder.getChildCount();
            for(int i = 0; i < count; i++){
                View item = (View) webViewHolder.getChildAt(i);

                if(item != null){
                    if(Konstanten.D){
                        Log.d("JsInterface", "item.getWidth(): " + item.getWidth());
                        Log.d("JsInterface", "item.getHeight(): " + item.getHeight());
                        Log.d("JsInterface", "item.getTag(): " + item.getTag());
                    }
                }
            }
        }
    });
}
Brian
  • 14,610
  • 7
  • 35
  • 43
Sceada
  • 513
  • 2
  • 11

1 Answers1

0

Ok, I think I found a workaround. I implemented my own PopupWindow and assigned the pie menu to it.

window = new PopupWindow(mContext);
            window.setWidth((int)webViewHolder.getMeasuredWidth());
            window.setHeight(webViewHolder.getMeasuredHeight()+statusBarOffset);
            window.setTouchable(true);
            window.setFocusable(true);
            window.setOutsideTouchable(true);
            window.setBackgroundDrawable(new BitmapDrawable());
            window.setContentView(pieMenu);
            window.showAtLocation(webViewHolder, 0, 0, 0);

It took me 5 hours to solve this. To bad that is not possible to modify the PopUpWindow from the library.

Sceada
  • 513
  • 2
  • 11