saurabharora90 / MaterialArcMenu

An android custom view which allows you to have a arc style-menu on your pages
Apache License 2.0
271 stars 52 forks source link

Close Menu #1

Open tellfa opened 8 years ago

tellfa commented 8 years ago

Hi, thanks for this library i want close menu with touch to another sides. how to work it?

saurabharora90 commented 8 years ago

Hi.

You mean when you click outside the menu area? You can hook up a OnClickListener on your layout and use the isMenuOpened() API to check the state of the menu. If the menu is opened, you can use the toggleMenu() API to close it. Should work for your case if I understand it correctly?

tellfa commented 8 years ago

Thank you very much for your quick response <3 can you send me code? please, i really need this library and code. i'm Amateur :( . please help . thanks you my dear firend

saurabharora90 commented 8 years ago

Can you post your layout (xml file), where you are using the library? I should be able to expand on that and help you out

tellfa commented 8 years ago

thank you man <3 attached xml file in .txt file ArcMenu.txt

tellfa commented 8 years ago

can you send me code my friend?

tellfa commented 8 years ago

i'm sorry that your time. i use this code :

    RelativeLayout r = (RelativeLayout) view.findViewById(R.id.r1);
    r.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ArcMenu te = (ArcMenu) view.findViewById(R.id.arcMenu);
            if (te.isMenuOpened()== true){
                te.toggleMenu();
            }
        }
    });

but it Does not work me! how to fix it?

tellfa commented 8 years ago

change to this : public void onClick(View view) { ArcMenu te = (ArcMenu) view.findViewById(R.id.arcMenu); if (te.isMenuOpened()){ te.toggleMenu(); }

but dose not work :(

saurabharora90 commented 8 years ago

I am still confused. You have a recycler view. Is that populated with data? And do you have some Click events attached to it, coz the the click event won't be bubbled to the parent if the child is handling it.

tellfa commented 8 years ago

i added this code to my adapter (RecyclerView Adapter) but show me FC error :cry: my code in adapter : v.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) {

                if (arcMenu.isMenuOpened()){
                    arcMenu.toggleMenu();
                }

                return true;
            }
        });

FC error : error

please help me :cry: please

tellfa commented 8 years ago

hay @saurabharora90 , can you help me?

saurabharora90 commented 8 years ago

This looks the arcMenu variable wasn't initialized. It isn't being thrown by the library. Really difficult to comment without actual code.