RxFileObserver


Source link: https://github.com/phajduk/RxFileObserver

RxFileObserver

Reactive wrapper around Android's FileObserver

Download

Gradle:

compile 'com.github.phajduk:rxfileobserver:0.1.0'

Example

Subscribe to any file system changes performed in external storage directory:

File sdCard = Environment.getExternalStorageDirectory();
 Observable<FileEvent> sdCardFileEvents = RxFileObserver.create(sdCard);
 sdCardFileEvents.subscribe(new Action1<FileEvent>() {

  @Override
  public void call(FileEvent fileEvent) {

Log.i(TAG, fileEvent.toString());

  
}
 
}
);

Documentation

Emitted FileEvent contains:

EnumSet<FileEventType> eventTypeEnumSet; String path;
  • path it's just path of changed/removed/created file
  • eventTypeEnumSet gives you information about flags

Flags

public enum FileEventType {

  ACCESS, // Data was read from a file
  MODIFY, // Data was written to a file
  ATTRIB, // Metadata (permissions, owner, timestamp) was changed explicitly
  CLOSE_WRITE, // Someone had a file or directory open for writing, and closed it
  CLOSE_NOWRITE, // Someone had a file or directory open read-only, and closed it
  OPEN, // A file or directory was opened
  MOVED_FROM, // A file or subdirectory was moved from the monitored directory
  MOVED_TO, // A file or subdirectory was moved to the monitored directory
  CREATE, // A new file or subdirectory was created under the monitored directory
  DELETE, // A file was deleted from the monitored directory
  DELETE_SELF, // The monitored file or directory was deleted; monitoring effectively stops
  MOVE_SELF; // The monitored file or directory was moved; monitoring continues
  (...) 
}

License

Copyright 2015 Pawel Hajduk  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. 

Resources

A project which showcases usage of Dagger, RxJava and Retrolambda among other open source libraries.

Font manager for Android.

Custom layout that can rotate its view.

This project aims to solve the "password forgotten" problem for (Android) developers who happen to manage java keystore(s).

This plugin helps to:

  • Avoid problems with collaborators that do not stick to the defined SDK.
  • Removing the need to update the build.gradle file every time you update your android build-tools.

Floating hint for ProgressBar/SeekBar.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes