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.
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'
}
For full example, please refer to the sample
app.
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();
@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);
}
@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
Storage.create(context)
.showImages(int n) //maximum "n" number of images can be selected by the user
.start(); // Could be Activity, Fragment, Support Fragment
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
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
Storage.create(context)
.showVideos(int n) //maximum "n" number of videos can be selected by the user
.start(); // Could be Activity, Fragment, Support Fragment
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
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]