RxJava2 Android Samples


Source link: https://github.com/amitshekhariitbhu/RxJava2-Android-Samples

Learning RxJava 2 for Android by example

Get the complete RxJava Course Here

How to use RxJava 2 in Android Application

How to migrate from RxJava 1.0 to RxJava 2.0

This project is for :

  • who is migrating to RxJava 2
  • or just started with RxJava.

Just Build the project and start learning RxJava by examples.

RxJava 2.0 has been completely rewritten from scratch on top of the Reactive-Streams specification. The specification itself has evolved out of RxJava 1.x and provides a common baseline for reactive systems and libraries.

Because Reactive-Streams has a different architecture, it mandates changes to some well known RxJava types.

Migration From RxJava 1.0 to RxJava 2.0

To allow having RxJava 1 and RxJava 2 side-by-side, RxJava 2 is under the maven coordinates io.reactivex.rxjava2:rxjava:2.x.y and classes are accessible below io.reactivex.

Users switching from 1.x to 2.x have to re-organize their imports, but carefully.

Using RxJava 2.0 Library in your application

Add this in your build.gradle

compile 'io.reactivex.rxjava2:rxjava:2.1.1'

If you are using RxAndroid also, then add the following

compile 'io.reactivex.rxjava2:rxandroid:2.0.1'

RxJava 2 Examples present in this sample project

  • RxJava 2.0 Example using CompositeDisposable as CompositeSubscription and Subscription have been removed.

  • RxJava 2 Example using Flowable.

  • RxJava 2 Example using SingleObserver, CompletableObserver.

  • RxJava 2 Example using RxJava2 operators such as map, zip, take, reduce, flatMap, filter, buffer, skip, merge, concat, replay, and much more:

  • RxJava 2 Android Samples using Function as Func1 has been removed.

  • RxJava 2 Android Samples using BiFunction as Func2 has been removed.

  • And many others android examples

Quick Look on few changes done in RxJava2 over RxJava1

RxJava1 -> RxJava2

  • onCompleted -> onComplete - without the trailing d
  • Func1 -> Function
  • Func2 -> BiFunction
  • CompositeSubscription -> CompositeDisposable
  • limit operator has been removed - Use take in RxJava2
  • and much more.

Operators :

  • Map -> transform the items emitted by an Observable by applying a function to each item
  • Zip -> combine the emissions of multiple Observables together via a specified function and emit single items for each combination based on the results of this function
  • Filter -> emit only those items from an Observable that pass a predicate test
  • FlatMap -> transform the items emitted by an Observable into Observables, then flatten the emissions from those into a single Observable
  • Take -> emit only the first n items emitted by an Observable
  • Reduce -> apply a function to each item emitted by an Observable, sequentially, and emit the final value
  • Skip -> suppress the first n items emitted by an Observable
  • Buffer -> periodically gather items emitted by an Observable into bundles and emit these bundles rather than emitting the items one at a time
  • Concat -> emit the emissions from two or more Observables without interleaving them
  • Replay -> ensure that all observers see the same sequence of emitted items, even if they subscribe after the Observable has begun emitting items
  • Merge -> combine multiple Observables into one by merging their emissions

Highlights of the examples :

TODO

  • Many examples are to be added

Find this project useful ? ❤?

  • Support it by clicking the ⭐? button on the upper right of this page. ✌?

Check out an awesome MVP architecture based project which uses RxJava2, Dagger2.

Check out an awesome library for fast and simple networking in Android.

Another awesome library for debugging databases and shared preferences.

Check out Mindorks awesome open source projects here

Contact - Let's become friend

License


Copyright (C) 2016 Amit Shekhar
 Copyright (C) 2011 Android Open Source Project
  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. 

Contributing to RxJava 2 Android Samples

Just make pull request. You are in!

Resources

ListView in Android supports header and footer views - views that do not belong to the underlying adapter but otherwise show up in the list and scroll along with the contents. However, they only work if you have not yet set your own adapter and are therefore not terribly flexible.

The SackOfViewsAdapter is another way of approaching this. Here, you provide the Views that make up the rows, and the adapter feeds them to Android as if they were newly created.

The SackOfViewsAdapter is designed to be sub-classed, mostly to determine how isEnabled() behaves, so you can control which of those views are selectable and which simply scroll with the list.

StrictMode is a handy feature in API Level 9 and higher, telling you where your Android application is doing things it probably should not on the main application thread.

In the spirit of StrictMode, the StrictModeEx project offers classes to help you diagnose similar sorts of problems beyond what StrictMode itself offers.

Right now, that consists of one class: StrictAdapter. This ListAdapter wrapper will log slow-running getView() calls, plus optionally give you an overall performance view on how your Adapter is doing in the code you control.

geo

Java utility methods for geohashing.

A very, very compact library that enables you to create on-demand singletons within your application and easily store them to disk. Utilizing a dead-simple API, this library makes creating singletons and persisting data much more fun!

This app is built during the free time of the developer for fun. It provides with a tool to test some Intent behavior while building and testing other apps or just for fun playing with the framework. ;) This app would not work and feel the same way if it weren't for some great Android open-source projects that were used during the development.

Material Design Example is a sample application for the new design concept made by Google, Material Design. Besides the design, we have the new APIs introduced in Android SDK Lollipop:

  • Custom theme colors
  • Circular reveal
  • Activity transitions
  • Toolbar
  • Recycler View
  • Card View

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