BoomMenu icon indicating copy to clipboard operation
BoomMenu copied to clipboard

BoomMenuButton onClickListener

Open radiolondra opened this issue 8 years ago • 4 comments

Maybe a stupid question but... Ther's a way to override the onClickListener event of a BoomMenuButton without modifying the Boom source code? I tried in XML too, setting the android:onClick property to a new function without any success...

radiolondra avatar Jul 14 '17 14:07 radiolondra

What I need to do is a conditional boom() of the menu button, the menu is shown only if some settings are ok, otherwise the click on the menu button has to call another function (not open the menu):

rightBmb.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean isAlertActive = ApplicationSettings.isAlertActive(context); if (!isAlertActive) { rightBmb.boom(); } else { showSnackbar(coordinatorLayout, context.getString(R.string.already_sending),Snackbar.LENGTH_LONG, Color.YELLOW); } } });

radiolondra avatar Jul 14 '17 14:07 radiolondra

i think maybe if you use the onboommenuwillshow calback listener add an if condition in there if you want to show do nothing else bmb.reboom and do what do you want ?

ziadkiwan avatar Jul 24 '17 06:07 ziadkiwan

This is how a did it

            bmb.findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {   // hack to hide on click
                @Override
                public void onClick(View view) {
                    if (bmb.isBoomed())
                        bmb.reboom();
                    else bmb.boom();
                }
            });

pellyadolfo avatar Nov 23 '18 23:11 pellyadolfo

Hello, pardon me, how can i add onclick listener to each menu button pop ups

aynerd avatar Apr 24 '19 15:04 aynerd