skydoves / PowerMenu

:fire: Powerful and modernized popup menu with fully customizable animations.
Apache License 2.0
1.19k stars 175 forks source link

CustomPowerMenu setOnMenuItemClickListener not working #16

Closed wiliam-toney closed 6 years ago

wiliam-toney commented 6 years ago

Below is the code i implemented. private OnMenuItemClickListener onMenuItemClickListener = new OnMenuItemClickListener() { @Override public void onItemClick(int position, SwitcherItem item) { Toast.makeText(getBaseContext(), item.getName(), Toast.LENGTH_SHORT).show(); mSwitcherMenu.dismiss(); } };

mSwitcherMenu = new CustomPowerMenu.Builder<>(this, new PatientSwitcherAdapter()) .addItem(new SwitcherItem("", "John Appleseed")) .addItem(new SwitcherItem("", "Evil Monster")) .addItem(new SwitcherItem("", "New Patient")) .addItem(new SwitcherItem("", "AAA EEE")) .setOnMenuItemClickListener(onMenuItemClickListener) .setFooterView(R.layout.cell_signout) .setWidth(dm.widthPixels * 2 / 3) .setBackgroundAlpha(0.2f) .setAnimation(MenuAnimation.SHOWUP_TOP_LEFT) .setMenuRadius(10f) .setMenuShadow(10f) .build();

But onItemClick is not calling. I appreciate your any help!