All Projects → baldapps → Flipper

baldapps / Flipper

Licence: MIT license
Android library for abstract file-system access required by Android Q

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Flipper

AndroidQ-Playground
Sample Android application to learn new Android Q features
Stars: ✭ 16 (-63.64%)
Mutual labels:  android-q
space-client
File Upload (encrypted), File Sharing, Filecoin Markets (TBD), and User Controlled Data. You can access same methods from the Space Daemon using our JS client, so you don't need to worry about gRPC calls.
Stars: ✭ 73 (+65.91%)
Mutual labels:  filesystem-library
FileSystemTest
FileSystem Api Test For Windows
Stars: ✭ 17 (-61.36%)
Mutual labels:  filesystem-library
flysystem-curlftp
Flysystem Adapter for the FTP with cURL implementation
Stars: ✭ 36 (-18.18%)
Mutual labels:  filesystem-library
Flysystem
Abstraction for local and remote filesystems
Stars: ✭ 12,237 (+27711.36%)
Mutual labels:  filesystem-library
Dokany
User mode file system library for windows with FUSE Wrapper
Stars: ✭ 4,055 (+9115.91%)
Mutual labels:  filesystem-library
FileSmith
A strongly typed Swift library for working with local files and directories.
Stars: ✭ 23 (-47.73%)
Mutual labels:  filesystem-library
nilfs-utils
NILFS utilities
Stars: ✭ 32 (-27.27%)
Mutual labels:  filesystem-library

Flipper

Flipper is an android library project to help developers to use file-like interface using the storage access framework. Flipper is designed to handle the new behavior required by Android Q.

Dependencies

  • Android-X package
  • Min version to use Flipper is Android KitKat (API 19)

Set up Instructions

Set up the project dependencies. To use this library in your project:

(1) Use the GitHub source and include that as a module dependency by following these steps:

  • Clone this library into a project named SmartRecyclerView, parallel to your own application project:
git clone https://github.com/baldapps/Flipper.git
  • In the root of your application's project edit the file "settings.gradle" and add the following lines:
include ':flipper'
project(':flipper').projectDir = new File('../Flipper/flipper')
  • In your application's main module (usually called "app"), edit your build.gradle to add a new dependency:
 dependencies {
    ...
    compile project(':flipper')
 }

Now your project is ready to use this library

Main Features

Flipper provides an abstaction layer to manage files using Uri access on Android platform.

Example and how to use the library:

       public class MainActivity extends Activity {

          private StorageManagerCompat manager;

          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
              manager = new StorageManagerCompat(this);
              Root root = manager.getRoot(StorageManagerCompat.DEF_MAIN_ROOT);
              if (root == null || !root.isAccessGranted(this)) {
                   Intent i = manager.requireExternalAccess(this);
                   startActivityForResult(i, 100);
              }
          }
       
          private void myMethod() {
               Root root = manager.getRoot(StorageManagerCompat.DEF_MAIN_ROOT);
               if (root == null)
                   return;
               DocumentFile f = root.toRootDirectory(this);
               if (f == null)
                   return;
               DocumentFile subFolder = DocumentFileCompat.peekSubFolder(f, "mysub");
               if (subFolder == null)
                   return; //directory doesn't exist yet
               DocumentFile myFile = DocumentFileCompat.peekFile(subFolder, "myfile", "image/png");
               if (myFile == null)
                   return; //file doesn't exist yet
               try {
                   InputStream is = getContentResolver().openInputStream(myFile.getUri());
               } catch (FileNotFoundException e) {
                   e.printStackTrace();
               }
          }
       
          @Override
          protected void onActivityResult(int requestCode, int resultCode, Intent data) {
               if (requestCode == 100 && resultCode == RESULT_OK) {
                   Root root = manager.addRoot(this, StorageManagerCompat.DEF_MAIN_ROOT, data);
                   if (root == null)
                       return;
                   DocumentFile f = root.toRootDirectory(this);
                   if (f == null)
                       return;
                   try {
                       DocumentFile subFolder = DocumentFileCompat.getSubFolder(f, "mysub");
                       DocumentFile myFile = DocumentFileCompat.getFile(subFolder, "myfile", "image/png");
                       try {
                           OutputStream os = getContentResolver().openOutputStream(myFile.getUri());
                       } catch (FileNotFoundException e) {
                           e.printStackTrace();
                       }
                   } catch (OperationFailedException e) {
                       e.printStackTrace();
                   }
               }
          }

References and how to report bugs

  • If you find any issues with this library, please open a bug here on GitHub

License

See LICENSE

Change List

1.0.0

  • First version
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].