This library is designed to simplify the process of selecting and retrieving media files from an Android device, and supports media capture for images and videos.
- Handle Runtime Permissions
- Retrieve Result as Uri, File Path as String
- Custom Popup Or BottomSheet with custom text and icon and custom layout file for items
- Capture Image / Video
- Pick Image / Video
- Pick Any File with Mimetype
- All multiple file to pick
allprojects {
repositories {
mavenCentral() // For FilePicker library, this line is enough. Although, it has been published on jitpack as well
maven { url "https://jitpack.io" } //Make sure to add this in your project
}
}
dependencies {
// ...
implementation 'com.github.ChochaNaresh:FilePicker:$libVersion'
// ...
}
If you want to Multiple option with BottomSheet Or Dialog:
FilePicker.Builder(this)
.setPopUpConfig()
.addPickDocumentFile()
.addImageCapture()
.addVideoCapture()
.addPickMedia()
.build()
with custom PopUp Config
//..
setPopUpConfig(
PopUpConfig(
chooserTitle = "Choose Profile",
// layoutId = 0, custom layout
mPopUpType = PopUpType.BOTTOM_SHEET,// PopUpType.BOTTOM_SHEET Or PopUpType.DIALOG
mOrientation = RecyclerView.VERTICAL // RecyclerView.VERTICAL or RecyclerView.HORIZONTAL
)
)
//..
.build()
Pick Document Config
//..
addPickDocumentFile(
DocumentFilePickerConfig(
popUpIcon = R.drawable.ic_file,// DrawableRes Id
popUpText = "File Media",
allowMultiple = false,// set Multiple pick file
maxFiles = 0,// max files working only in android latest version
mMimeTypes = listOf("*/*"),// added Multiple MimeTypes
askPermissionTitle = null, // set Permission ask Title
askPermissionMessage = null,// set Permission ask Message
settingPermissionTitle = null,// set Permission setting Title
settingPermissionMessage = null,// set Permission setting Messag
),
)
//..
.build()
Image Capture Config
//..
addImageCapture(
ImageCaptureConfig(
popUpIcon = R.drawable.ic_camera,// DrawableRes Id
popUpText = "Camera",
mFolder = File(),// set custom folder with write file permission
fileName = "image.jpg",
askPermissionTitle = null, // set Permission ask Title
askPermissionMessage = null,// set Permission ask Message
settingPermissionTitle = null,// set Permission setting Title
settingPermissionMessage = null,// set Permission setting Messag
),
)
//..
.build()
Video Capture Config
//..
addVideoCapture(
VideoCaptureConfig(
popUpIcon = R.drawable.ic_video,// DrawableRes Id
popUpText = "Video",
mFolder=File(),// set custom folder with write file permission
fileName = "video.mp4",
maxSeconds = null,// set video duration in seconds
maxSizeLimit = null,// set size limit
isHighQuality = null,// set isHighQuality true/false
askPermissionTitle = null, // set Permission ask Title
askPermissionMessage = null,// set Permission ask Message
settingPermissionTitle = null,// set Permission setting Title
settingPermissionMessage = null,// set Permission setting Messag
),
)
//..
.build()
Pick Media Config
//..
addPickMedia(
PickMediaConfig(
popUpIcon = R.drawable.ic_video,// DrawableRes Id
popUpText = "Video",
allowMultiple = false,// set Multiple pick file
maxFiles = 0,// max files working only in android latest version
mPickMediaType = ImageAndVideo,
askPermissionTitle = null, // set Permission ask Title
askPermissionMessage = null,// set Permission ask Message
settingPermissionTitle = null,// set Permission setting Title
settingPermissionMessage = null,// set Permission setting Messag
),
)
//..
.build()
Pick Media Types
- ImageOnly
- VideoOnly
- ImageAndVideo
Pick Document
FilePicker.Builder(this)
.pickDocumentFileBuild(DocumentFilePickerConfig()) // Customization check Pick Document Config
Image Capture
FilePicker.Builder(this)
.imageCaptureBuild(ImageCaptureConfig()) // Customization check Image Capture Config
Video Capture
FilePicker.Builder(this)
.videoCaptureBuild(VideoCaptureConfig()) // Customization check Video Capture Config
Pick Media
FilePicker.Builder(this)
.pickMediaBuild(PickMediaConfig()) // Customization check Pick Media Config
- Library - Android Lollipop 5.0+ (API 21)
- Sample - Android Lollipop 5.0+ (API 21)
Copyright 2023 Naresh chocha
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.