Code Monkey home page Code Monkey logo

allstorage's Introduction

AllStorage

AllStorage is a library used for selecting different files from your smart-phone's storage. It provides a tabbed interface which allows you to select files of different types eg. images, videos, sound files etc. You can limitize the maximum number of files which the user can select. This library provides run-time permissions for newer android versions.

Screenshot

Click to see how image picker looks…

Download

Add this to your project's build.gradle

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

And add this to your module's build.gradle

dependencies {
 	implementation 'com.github.pakbachelors:AllStorage:1.0.4'
}

Usage

For full example, please refer to the sample app.

Start AllStorage activity

The simplest way to select items from different media types where the limit for number of items of each media is 5

Storage.create(context) // Activity or Fragment
	    .all().start();

Recieving Result

@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (Storage.shouldHandle(requestCode, resultCode, data)) {
            List<SelectedFiles> selectedFiles = Storage.getResults();
            Toast.makeText(getApplicationContext(), selectedFiles.size() + "", Toast.LENGTH_LONG).show();
            Log.d("www", ""+selectedFiles.size());
        }
        super.onActivityResult(requestCode, resultCode, data);
    }

Handling Runtime permissions

@RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        Storage.handlePermissions(requestCode, grantResults);
    }

Complete features of what you can do with AllStorage

Storage.create(context)
.showImages(int n) //allows the user to pick "n" number of items from image type media stored in user's smartphone
.showCamera(int n) //allows the user to snap multiple pics and select "n" number of those items 
.showAudios(int n) //allows the user to pick "n" number of items from audio type media stored in user's smartphone
.showVideos(int n)  //allows the user to pick "n" number of items from video type media stored in user's smartphone
.showFiles(int n) //allows the user to pick "n" number of items from user storage files eg. pdf, zip, txt etc.
.all() //allows the user to pick maximum of 5 items from each of the media type
.start(); // start Storage activity with request code

	

Images Only

Storage.create(context)
.showImages(int n) //maximum "n" number of images can be selected by the user
.start(); // Could be Activity, Fragment, Support Fragment 

Camera Only

Storage.create(context)
.showCamera(int n) //allows he user to snap pics and maximum "n" number of snapped images can be selected by the user
.start(); // Could be Activity, Fragment, Support Fragment 

Audio files Only

Storage.create(context)
.showAudios(int n) //maximum "n" number of audio files can be selected by the user
.start(); // Could be Activity, Fragment, Support Fragment 

Video files Only

Storage.create(context)
.showVideos(int n) //maximum "n" number of videos can be selected by the user
.start(); // Could be Activity, Fragment, Support Fragment 

Other files

Storage.create(context)
.showFiles(int n) //maximum "n" number of files(pdf, txt, ppt etc.) can be selected by the user
.start(); // Could be Activity, Fragment, Support Fragment 

Contributions

Modification License

Copyright (c) 2018 PakBachelors

The Permission is granted, free of charge, to anyone obtaining a copy of this software, to deal in the Software without
any restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell
copies of the Software. 
For suggestions or improvements in the software, feel free to contact at [email protected]



allstorage's People

Contributors

mirzashafique avatar

allstorage's Issues

Sync. issue

there is a sync. issue
whenever I try to add the dependency, it gives an error "failed linking resources", along with 3 other errors
I have attached a snapshots to show where the error points

edrf

ervrtfv

fgvd

I am new to android studio
please help

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.