Closed csibesz07 closed 8 years ago
Can you explain your use-case? I don't see how editing items in real-time might be a good option
I'm making a plugin for an app called Tasker. The plugin allows the user to create material style menus, messages. And i thought i would make a preview which changes on user interaction to represent the menu that will appear. I'm new to android but i've learnt a lot making the plugin.
I see. Do you want to give this a try and send a pull request later? It's not on my plans to implement such behavior, so, any contributions would be helpful.
Alright, I'll see what I can do.
@rubensousa I hope I will add this feature, as it is really required. :)
This has been resolved in commit #13 . Sooner release will be added.
Here is some code to handle dynamic behaviour.
private void createShareMenu() {
BottomSheetBuilder builder = new BottomSheetBuilder(MyCardsActivity.this, R.style.AppTheme_BottomSheetDialog_Custom)
.setMode(BottomSheetBuilder.MODE_GRID)
.setItemClickListener(new BottomSheetItemClickListener() {
@Override
public void onBottomSheetItemClick(MenuItem item) {
}
});
for (YourMenuItem yourMenuItem : ListOfYourMenuItems) {
builder.addItem(yourMenuItem.getMenuId(), yourMenuItem.getName(), new BitmapDrawable(getResources(), yourMenuItem.getBitmap()));
}
BottomSheetMenuDialog dialog = builder.createDialog();
dialog.show();
}
you need to preload your menu items with bitmap in this case. you can also just pass its drawable.
Hi, i would like to edit, add, remove menu items, submenus without creating a new view with the builder, dynamically. I think a class which allows editing
List<BottomSheetItem> items
would solve it. The recyclerview could animate changes. What do you think? Is it possible?