Skip to content

1.3

Compare
Choose a tag to compare
@ZacSweers ZacSweers released this 23 Jul 23:21
· 130 commits to master since this release

Commons

  • Introducing MenuSheetView! This is a SheetView that can represent a menu resource as a list or grid.
    • A list can support submenus, and will include a divider and header for them where appropriate. Grids currently don't support submenus and don't in the Material Design spec either.
    • You can retrieve the underlying Menu instance via getMenu() and dynamically add your own items. Just make sure you call updateMenu() after you're done!
MenuSheetView menuSheetView =
        new MenuSheetView(MenuActivity.this, menuType, "Create...", new MenuSheetView.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                Toast.makeText(MenuActivity.this, item.getTitle(), Toast.LENGTH_SHORT).show();
                if (bottomSheetLayout.isSheetShowing()) {
                    bottomSheetLayout.dismissSheet();
                }
                return true;
            }
        });
menuSheetView.inflateMenu(R.menu.create);
bottomSheetLayout.showWithSheetView(menuSheetView);
  • Commons sheets have an appropriate shadow and elevation now. Unfortunately, we can't build this into BottomSheetLayout, but we've added a recipe explaining how to add this to your own sheets.
    • Issue #4

BottomSheetLayout

  • Back press handling is handled now. Default behavior is to dismiss the entire sheet on back press, regardless of state. You can customize this via a new setPeekOnDismiss(boolean) API. Setting this to true will cause an expanded sheet collapse to the peeked state on back press, rather than dismissing.

Sample

  • We've given the sample a little UI refresh and made it easier to add more commons examples in the future.

Enjoy!

MenuSheetView gif