{"id":13396052,"url":"https://github.com/Flipboard/bottomsheet","last_synced_at":"2025-03-13T22:31:36.229Z","repository":{"id":30913747,"uuid":"34471600","full_name":"Flipboard/bottomsheet","owner":"Flipboard","description":"Android component which presents a dismissible view from the bottom of the screen","archived":false,"fork":false,"pushed_at":"2019-03-13T10:10:01.000Z","size":363,"stargazers_count":4520,"open_issues_count":54,"forks_count":596,"subscribers_count":153,"default_branch":"master","last_synced_at":"2024-10-08T14:24:31.894Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Flipboard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-23T17:37:32.000Z","updated_at":"2024-09-25T01:57:38.000Z","dependencies_parsed_at":"2022-08-07T16:00:23.753Z","dependency_job_id":null,"html_url":"https://github.com/Flipboard/bottomsheet","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flipboard%2Fbottomsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flipboard%2Fbottomsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flipboard%2Fbottomsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flipboard%2Fbottomsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flipboard","download_url":"https://codeload.github.com/Flipboard/bottomsheet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243493763,"owners_count":20299713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T18:00:38.475Z","updated_at":"2025-03-13T22:31:35.836Z","avatar_url":"https://github.com/Flipboard.png","language":"Java","funding_links":[],"categories":["Index `(light-weight pages)`","Java","Index"],"sub_categories":[],"readme":"# BottomSheet\n\n[![Build Status](https://travis-ci.org/Flipboard/bottomsheet.svg)](https://travis-ci.org/Flipboard/bottomsheet) [![Join the chat at https://gitter.im/Flipboard/bottomsheet](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Flipboard/bottomsheet?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nBottomSheet is an Android component which presents a dismissible view from the bottom of the screen. BottomSheet can be a useful replacement for dialogs and menus but can hold any view so the use cases are endless. This repository includes the BottomSheet component itself but also includes a set of common view components presented in a bottom sheet. These are located in the commons module.\n\nBottomSheet has been used in production at Flipboard for a while now so it is thoroughly tested. Here is a GIF of it in action inside of Flipboard!\n\n![FlipUI gif](http://i.imgur.com/2e3ZhoU.gif)\n\n## Installation\n\nIf all you want is the BottomSheet component and don't need things from commons you can skip that dependency.\n\n```groovy\nrepositories {\n    jcenter()\n}\n\ndependencies {\n    compile 'com.flipboard:bottomsheet-core:1.5.3'\n    compile 'com.flipboard:bottomsheet-commons:1.5.3' // optional\n}\n```\n\n## Getting Started\n\nGet started by wrapping your layout in a `BottomSheetLayout`. So if you currently have this:\n\n```xml\n\u003cLinearLayout\n    android:id=\"@+id/root\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u003e\n\n    \u003cView\n        android:id=\"@+id/view1\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"/\u003e\n\n\u003c/LinearLayout\u003e\n```\n\nYou would have to update it to look like this:\n\n```xml\n\u003ccom.flipboard.bottomsheet.BottomSheetLayout\n    android:id=\"@+id/bottomsheet\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u003e\n\n    \u003cLinearLayout\n        android:id=\"@+id/root\"\n        android:orientation=\"vertical\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\u003e\n\n        \u003cView\n            android:id=\"@+id/view1\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"/\u003e\n\n    \u003c/LinearLayout\u003e\n\n\u003c/com.flipboard.bottomsheet.BottomSheetLayout\u003e\n```\n\nBack in your activity or fragment you would get a reference to the BottomSheetLayout like any other view.\n\n```java\nBottomSheetLayout bottomSheet = (BottomSheetLayout) findViewById(R.id.bottomsheet);\n```\n\nNow all you need to do is show a view in the bottomSheet:\n\n```java\nbottomSheet.showWithSheetView(LayoutInflater.from(context).inflate(R.layout.my_sheet_layout, bottomSheet, false));\n```\n\nYou could also use one of the sheet views from the commons module.\n\n```java\nbottomSheet.showWithSheetView(new IntentPickerSheetView(this, shareIntent, \"Share with...\", new IntentPickerSheetView.OnIntentPickedListener() {\n    @Override\n    public void onIntentPicked(IntentPickerSheetView.ActivityInfo activityInfo) {\n        bottomSheet.dismissSheet();\n        startActivity(activityInfo.getConcreteIntent(shareIntent));\n    }\n}));\n```\n\nThat's it for the simplest of use cases. Check out the [API documentation](https://github.com/Flipboard/bottomsheet/wiki/API-Documentation) to find out how to customize BottomSheet to fit your use cases.\n\nFor more examples, also see the [Recipes](https://github.com/Flipboard/bottomsheet/wiki/Recipes) wiki.\n\n## Common Components\n\nThese are located in the optional `bottomsheet-commons` dependency and implement common use cases for bottom sheet.\n\nIntent Picker | Menu Sheet | ImagePicker Sheet\n--- | --- | ---\n![IntentPickerSheetView gif](http://i.imgur.com/wr9HJD1.gif) | ![MenuSheetView gif](http://i.imgur.com/f2j9Y5e.gif) | ![ImagePickerSheetView gif](https://camo.githubusercontent.com/23a9cf2bf9353a98d1b585e79d06639c7f5297c7/687474703a2f2f692e696d6775722e636f6d2f6f67764b4735692e676966)\n\n### IntentPickerSheetView\n\nThis component presents an intent chooser in the form of a BottomSheet view. Give it an intent such as a share intent and let the user choose what activity they want to share the intent with in a BottomSheet.\n\nExample from the sample app.\n\n```java\nIntentPickerSheetView intentPickerSheet = new IntentPickerSheetView(MainActivity.this, shareIntent, \"Share with...\", new IntentPickerSheetView.OnIntentPickedListener() {\n    @Override\n    public void onIntentPicked(IntentPickerSheetView.ActivityInfo activityInfo) {\n        bottomSheet.dismissSheet();\n        startActivity(activityInfo.getConcreteIntent(shareIntent));\n    }\n});\n// Filter out built in sharing options such as bluetooth and beam.\nintentPickerSheet.setFilter(new IntentPickerSheetView.Filter() {\n    @Override\n    public boolean include(IntentPickerSheetView.ActivityInfo info) {\n        return !info.componentName.getPackageName().startsWith(\"com.android\");\n    }\n});\n// Sort activities in reverse order for no good reason\nintentPickerSheet.setSortMethod(new Comparator\u003cIntentPickerSheetView.ActivityInfo\u003e() {\n    @Override\n    public int compare(IntentPickerSheetView.ActivityInfo lhs, IntentPickerSheetView.ActivityInfo rhs) {\n        return rhs.label.compareTo(lhs.label);\n    }\n});\nbottomSheet.showWithSheetView(intentPickerSheet);\n```\n\n### MenuSheetView\n\nThis component presents a BottomSheet view that's backed by a menu. It behaves similarly to the new `NavigationView` in the Design support library, and is intended to mimic the examples in the Material Design spec. It supports list and grid states, with the former adding further support for separators and subheaders.\n\nExample from the sample app.\n\n```java\nMenuSheetView menuSheetView =\n        new MenuSheetView(MenuActivity.this, MenuSheetView.MenuType.LIST, \"Create...\", new MenuSheetView.OnMenuItemClickListener() {\n            @Override\n            public boolean onMenuItemClick(MenuItem item) {\n                Toast.makeText(MenuActivity.this, item.getTitle(), Toast.LENGTH_SHORT).show();\n                if (bottomSheetLayout.isSheetShowing()) {\n                    bottomSheetLayout.dismissSheet();\n                }\n                return true;\n            }\n        });\nmenuSheetView.inflateMenu(R.menu.create);\nbottomSheetLayout.showWithSheetView(menuSheetView);\n```\n\n## Contributing\n\nWe welcome pull requests for bug fixes, new features, and improvements to BottomSheet. Contributors to the main BottomSheet repository must accept Flipboard's Apache-style [Individual Contributor License Agreement (CLA)](https://docs.google.com/forms/d/1gh9y6_i8xFn6pA15PqFeye19VqasuI9-bGp_e0owy74/viewform) before any changes can be merged.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFlipboard%2Fbottomsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFlipboard%2Fbottomsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFlipboard%2Fbottomsheet/lists"}