Skip to content

Releases: Flipboard/bottomsheet

v1.5.3

29 Nov 21:19
Compare
Choose a tag to compare

Core

  • BottomSheetLayout listeners were automatically removed at the end of dismissSheet() animation.
    This functionality was removed.

v1.5.2

09 Sep 01:35
Compare
Choose a tag to compare

Core

  • Fix scrolling issue when the BottomSheet contains a ViewPager with RecyclerViews inside

Commons

  • Add a way to specify custom layouts for list items and grid items in MenuSheetView
  • Fix grid items text getting cut off when text is scaled to extra large

v1.5.1

26 May 16:33
Compare
Choose a tag to compare

Core

  • Fixed duplicate state change notifications
  • Fixed possible incorrect sheet position and dimming

Commons

  • IntentPickerSheet works below API 16

1.5.0

01 Dec 23:19
Compare
Choose a tag to compare
  • Introducing BottomSheetFragment (#79) in the commons module
  • Support for multiple state and dismiss listeners on a single sheet (#86). Note: this is a breaking API change for listeners. Change your calls from setOnStateChangeListener to addOnStateChangeListener. Make sure to remove your listeners with a call to removeOnStateChangeListener after they're no longer useful, or you'll create a memory leak
  • Fixed sheets sometimes being in the wrong position with dynamic sizing (#80)

1.4.3

16 Sep 19:07
Compare
Choose a tag to compare

Fixes mix-ins not working properly when using the getConcreteIntent method. Note: because of the changes required to fix that issue, there was a breaking change to the API for mix-ins

1.4.2

11 Sep 00:08
Compare
Choose a tag to compare

This release changes sheets are handled when a sheet is requested while another is already visible. Now, instead of throwing a RuntimeException, it will animate out the existing sheet and then show the new one afterward. This is a more natural behavior, and doesn't require developers to manage this themselves.

1.4.1

11 Sep 00:07
Compare
Choose a tag to compare

This release changes the behavior of the dim view to be INVISIBLE during the hidden state. This should ensure that it doesn't cause some undesired behavior on media views, such as using the Youtube SDK

1.4

01 Sep 20:22
Compare
Choose a tag to compare
1.4

Commons

  • Introducing ImagePickerSheetView! This is a SheetView that can be used to pick images from local storage, while also offering placeholder options for camera and picking. Android doesn't have a nice built-in option for having the user choose between a camera or local storage, so hopefully this will be a good utility for the community.
  • Check out the sample for some example usage, including intents to use for camera and picker tiles.
ImagePickerSheetView sheetView = new ImagePickerSheetView.Builder(this)
        .setMaxItems(30)
        .setShowCameraOption(createCameraIntent() != null)
        .setShowPickerOption(createPickIntent() != null)
        .setImageProvider(new ImagePickerSheetView.ImageProvider() {
            @Override
            public void onProvideImage(ImageView imageView, Uri imageUri, int size) {
                Glide.with(ImagePickerActivity.this)
                        .load(imageUri)
                        .centerCrop()
                        .crossFade()
                        .into(imageView);
            }
        })
        .setOnTileSelectedListener(new ImagePickerSheetView.OnTileSelectedListener() {
            @Override
            public void onTileSelected(ImagePickerSheetView.ImagePickerTile selectedTile) {
                bottomSheetLayout.dismissSheet();
                if (selectedTile.isCameraTile()) {
                    dispatchTakePictureIntent();
                } else if (selectedTile.isPickerTile()) {
                    startActivityForResult(createPickIntent(), REQUEST_LOAD_IMAGE);
                } else if (selectedTile.isImageTile()) {
                    showSelectedImage(selectedTile.getImageUri());
                } else {
                    genericError();
                }
            }
        })
        .setTitle("Choose an image...")
        .create();

bottomSheetLayout.showWithSheetView(sheetView);
  • Fix: GridView columns not appearing sometimes on API < 17
  • Improvement: Sheets on tablets will now default to a reasonable width, and will no longer default/force MATCH_PARENT. You can still use MATCH_PARENT by setting your own LayoutParams on the sheet view before passing it in.
  • Improvement: Sheets on both phones and tablets will default to WRAP_CONTENT. You can still use MATCH_PARENT by setting your own LayoutParams on the sheet view before passing it in.
  • Improvement: Icons in the intent picker sheet are lazily loaded in the background, which should substantially reduce delay when opening.
  • Breaking API change: OnIntentPickedListener#onIntentPicked will now return the full ActivityInfo rather than the intent. This is to provide more flexibility and allow usage of its new tag field for storing other information.
    • To recreate the concrete intent, you can call the new getConcreteIntent(Intent) method.
public Intent getConcreteIntent(Intent intent) {
            Intent concreteIntent = new Intent(intent);
            concreteIntent.setComponent(componentName);
            return concreteIntent;
        }

BottomSheetLayout

  • New: Added methods for setting custom peek translations (@davideas)
  • New: Added two helper functions: predictedDefaultWidth and isTablet. These are for retrieving what BottomSheetLayout thinks its width and whether or not it is on a tablet.
  • Fix: Sheets not staying anchored to the bottom of the screen in some places
  • Fix: InterceptContentTouch flag not being handled correctly, which would sometimes cause problems with intercepting touches on the sheet view
  • Fix: Prevent the layout from rendering the sheet undismissable in race conditions (#48)

Sample

  • We've included an ImagePicker demo, complete with image loading and intent handling.

Enjoy!

ImagePicker gif

1.3

23 Jul 23:21
Compare
Choose a tag to compare
1.3

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

v1.1

08 Jun 23:06
Compare
Choose a tag to compare
  • Rename BottomSheet to BottomSheetLayout
  • Allow customizing how the content view is dimmed