{"id":21969941,"url":"https://github.com/kroegerama/bottomsheet-imagepicker","last_synced_at":"2025-07-22T16:33:05.165Z","repository":{"id":34537962,"uuid":"179953462","full_name":"kroegerama/bottomsheet-imagepicker","owner":"kroegerama","description":"Modern image picker for Android","archived":false,"fork":false,"pushed_at":"2022-04-14T20:26:48.000Z","size":3966,"stargazers_count":327,"open_issues_count":12,"forks_count":47,"subscribers_count":9,"default_branch":"master","last_synced_at":"2023-11-07T18:57:40.001Z","etag":null,"topics":["android","bottomsheet","image","imagepicker","library","picker"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kroegerama.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":"2019-04-07T11:01:19.000Z","updated_at":"2023-10-14T10:42:16.000Z","dependencies_parsed_at":"2022-07-20T04:47:14.835Z","dependency_job_id":null,"html_url":"https://github.com/kroegerama/bottomsheet-imagepicker","commit_stats":null,"previous_names":[],"tags_count":8,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kroegerama%2Fbottomsheet-imagepicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kroegerama%2Fbottomsheet-imagepicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kroegerama%2Fbottomsheet-imagepicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kroegerama%2Fbottomsheet-imagepicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kroegerama","download_url":"https://codeload.github.com/kroegerama/bottomsheet-imagepicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227142708,"owners_count":17737019,"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":["android","bottomsheet","image","imagepicker","library","picker"],"created_at":"2024-11-29T14:28:02.881Z","updated_at":"2024-11-29T14:28:03.650Z","avatar_url":"https://github.com/kroegerama.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Release](https://jitpack.io/v/kroegerama/bottomsheet-imagepicker.svg)](https://jitpack.io/#kroegerama/bottomsheet-imagepicker)\n[![Build Status](https://travis-ci.org/kroegerama/bottomsheet-imagepicker.svg?branch=master)](https://travis-ci.org/kroegerama/bottomsheet-imagepicker)\n\n# BottomSheet Image Picker for Android\n\nA modern image picker implemented as [BottomSheet](https://developer.android.com/reference/android/support/design/widget/BottomSheetDialogFragment).\n\n\u003cp\u003e\n\u003cimg src=\"screens/single_select_1.png\" alt=\"Single Selection Demo 1\" width=\"275\" /\u003e\u0026emsp;\n\u003cimg src=\"screens/single_select_2.png\" alt=\"Single Selection Demo 2\" width=\"275\" /\u003e\u0026emsp;\n\u003cimg src=\"screens/multi_select_1.png\" alt=\"Multi Selection Demo 1\" width=\"275\" /\u003e\n\u003c/p\u003e\n\n## Features\n\n1. select single/multiple images right in the bottom sheet\n2. use camera to take a picture\n3. choose image from gallery app\n4. handles all permission requests\n\nThis library is based on [BSImagePicker](https://github.com/siralam/BSImagePicker).\nI reimplemented everything in Kotlin and added some features. Also, I used the new androidX artifacts.\n\n## How to Use\n\nMinimum SDK: 17\n\n### Add to Project\n\nFirst make sure `jitpack` is included as a repository in your **project**'s build.gradle:  \n\n```groovy\nallprojects {\n    repositories {\n        //...\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\n\nAnd then add the below to your app's build.gradle:  \n\n```groovy\n    implementation 'com.kroegerama:bottomsheet-imagepicker:\u003cversion\u003e'\n```\n\n\n### Step 1: Create your own FileProvider\n\nJust follow the guide from [Official Android Document](https://developer.android.com/reference/android/support/v4/content/FileProvider#ProviderDefinition).\nSee the demo application [file_paths.xml](app/src/main/res/xml/file_paths.xml) and [AndroidManifest.xml](app/src/main/AndroidManifest.xml).\n\n### Step 2: Implement the callback handler\n\nThe caller Activity or Fragment has to implement `BottomSheetImagePicker.OnImagesSelectedListener` to receive the selection callbacks. It will automatically be used by the image picker. No need to register a listener.\n\n##### Kotlin\n\n```kotlin\nclass AcMain: BaseActivity(), BottomSheetImagePicker.OnImagesSelectedListener {\n    //...\n\n    override fun onImagesSelected(uris: List\u003cUri\u003e, tag: String?) {\n        toast(\"Result from tag: $tag\")\n\n        imageContainer.removeAllViews()\n        uris.forEach { uri -\u003e\n            val iv = LayoutInflater.from(this).inflate(R.layout.scrollitem_image, imageContainer, false) as ImageView\n            imageContainer.addView(iv)\n            Glide.with(this).load(uri).into(iv)\n        }\n    }\n}\n```\n\n##### Java\n\n```java\npublic class AcMainJava extends BaseActivity implements BottomSheetImagePicker.OnImagesSelectedListener {\n    //...\n    \n    @Override\n    public void onImagesSelected(@NotNull List\u003c? extends Uri\u003e uris, @Nullable String tag) {\n        imageContainer.removeAllViews();\n        for (Uri uri : uris) {\n            ImageView iv = (ImageView) LayoutInflater.from(this).inflate(R.layout.scrollitem_image, imageContainer, false);\n            imageContainer.addView(iv);\n            Glide.with(this).load(uri).into(iv);\n        }\n    }\n}\n```\n\nYou can set a `requestTag` in the builder. This is useful when you need to show more than one picker on the same page. You will receive this tag as `tag` parameter in the callback.\n\n### Step 3: Create the image picker using the Builder\n\nThe setters are all **optional** and the builder will fallback to default values.\n\n#### single select\n##### Kotlin\n\n```kotlin\n    BottomSheetImagePicker.Builder(getString(R.string.file_provider))\n        .cameraButton(ButtonType.Button)            //style of the camera link (Button in header, Image tile, None)\n        .galleryButton(ButtonType.Button)           //style of the gallery link\n        .singleSelectTitle(R.string.pick_single)    //header text\n        .peekHeight(R.dimen.peekHeight)             //peek height of the bottom sheet\n        .columnSize(R.dimen.columnSize)             //size of the columns (will be changed a little to fit)\n        .requestTag(\"single\")                       //tag can be used if multiple pickers are used\n        .show(supportFragmentManager)\n```\n##### Java\n```java\n    new BottomSheetImagePicker.Builder(getString(R.string.file_provider))\n       .cameraButton(ButtonType.Button)\n       .galleryButton(ButtonType.Button)\n       .singleSelectTitle(R.string.pick_single)\n       .peekHeight(R.dimen.peekHeight)\n       .columnSize(R.dimen.columnSize)\n       .requestTag(\"single\")\n       .show(getSupportFragmentManager(), null);\n```\n\n#### multi select\n##### Kotlin\n```kotlin\n    BottomSheetImagePicker.Builder(getString(R.string.file_provider))\n        .multiSelect(3, 6)                  //user has to select 3 to 6 images\n        .multiSelectTitles(\n            R.plurals.pick_multi,           //\"you have selected \u003ccount\u003e images\n            R.plurals.pick_multi_more,      //\"You have to select \u003cmin-count\u003e more images\"\n            R.string.pick_multi_limit       //\"You cannot select more than \u003cmax\u003e images\"\n        )\n        .peekHeight(R.dimen.peekHeight)     //peek height of the bottom sheet\n        .columnSize(R.dimen.columnSize)     //size of the columns (will be changed a little to fit)\n        .requestTag(\"multi\")                //tag can be used if multiple pickers are used\n        .show(supportFragmentManager)\n```\n##### Java\n```java\n    new BottomSheetImagePicker.Builder(getString(R.string.file_provider))\n        .multiSelect(3, 6)\n        .multiSelectTitles(\n                R.plurals.pick_multi,\n                R.plurals.pick_multi_more,\n                R.string.pick_multi_limit\n        )\n        .peekHeight(R.dimen.peekHeight)\n        .columnSize(R.dimen.columnSize)\n        .requestTag(\"multi\")\n        .show(getSupportFragmentManager(), null);\n```\n\n### The image picker works in activities and fragments\n##### Kotlin\n```kotlin\n    //inside activity\n        .show(supportFragmentManager)\n    //inside fragment\n        .show(childFragmentManager)\n```\n##### Java\n```java\n    //inside activity\n        .show(getSupportFragmentManager(), null);\n    //inside fragment\n        .show(getChildFragmentManager(), null);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkroegerama%2Fbottomsheet-imagepicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkroegerama%2Fbottomsheet-imagepicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkroegerama%2Fbottomsheet-imagepicker/lists"}