Giter VIP home page Giter VIP logo

filepicker's Introduction

File Picker Library for Android

API Language Language

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.

Features

  • 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

Usage

	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'
        // ...
}

Where $libVersion = libVersion

Customization

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

If you want to use only one

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

Compatibility

  • Library - Android Lollipop 5.0+ (API 21)
  • Sample - Android Lollipop 5.0+ (API 21)

License

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.

filepicker's People

Contributors

chochanaresh avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.