rxlist


Source link: https://github.com/s0nerik/rxlist

rxlist

Reactive List implementation using RxJava.

java.util.List implementation that can notify of the events that happened with the list using Observable. This library doesn't have any dependencies except RxJava.

Usage

You can use an RxList either as a wrapper around any other java.util.List implementation or as a standalone object (in this case an ArrayList will be used as an implementation for a backing list). Also it's possible to enable the "item removed" notification for each item that was removed when the list gets cleared (disabled by default).

// ArrayList will be used as a backing list implementation. RxList<Item> items = new RxList<>();
  // Will notify of each removed item when the list is cleared. RxList<Item> items = new RxList<>(true);
  // In this case the RxList will wrap the given list and enable the notifications on it. // Note: to get notified of the events you must interact with the RxList, not the wrapped list. List<Item> wrappedItems = new LinkedList<Item>();
 RxList<Item> items = new RxList<>(wrappedItems);
  // Will notify of each removed item when the list is cleared. List<Item> wrappedItems = new LinkedList<Item>();
 RxList<Item> items = new RxList<>(wrappedItems, true);

After you've created the RxList instance you will be able to get notified of the events that happen with it. Use the events() method of the RxList to get the Observable of the RxList's events:

RxList<Item> items = new RxList<>();
 items.events().subscribe(event -> System.out.println(event.type))

This way you can get notified of ITEM_ADDED, ITEM_REMOVED, ITEM_CHANGED, ITEMS_CLEARED events.

Usecases

RxList will be really useful in situations where you need to keep track of the list state and react on it's changes somehow. One of the good examples of such situation (from Android development) is the necessity to call RecyclerView.Adapter's notifyItem(Inserted/Removed/Changed) whenever you want the changes in a list be shown to the user. Take a look at the rxlist-binder for a ready to use RxList to RecyclerView.Adapter binding solution.

Installation

  • To use this library, add the following to your project level build.gradle:
allprojects {

  repositories {

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

  
}
 
}
  • Add this to your app's build.gradle:
compile 'com.github.s0nerik:rxlist:{
latest version
}
'

License

Copyright 2016 Alex Isaienko (s0nerik)  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

Simple View to change Brush Size, Alpha and Color.

Shelf is an easy way to implement repository pattern in your project.

A utility class for converting between different Android display units.

You can manage your application's version update or get your market information more simply.

Simple and easy to use PlaySound.java file lets you generate tone of a particular frequency.

Android library makes using Shared Preference easier.

Features:

  • Support RxJava 2
  • Encrypt Data
  • Support Iterable
  • Build on top of repository design pattern

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