From 45229984260513832f27e2315936af6edcf2ca3d Mon Sep 17 00:00:00 2001 From: AMIT SHEKHAR Date: Fri, 21 Oct 2016 13:48:48 +0530 Subject: [PATCH 001/123] upgraded to RxJava2 RC5 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 775d571..c907d89 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,6 +23,6 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.1.1' - compile 'io.reactivex.rxjava2:rxjava:2.0.0-RC3' + compile 'io.reactivex.rxjava2:rxjava:2.0.0-RC5' compile 'io.reactivex.rxjava2:rxandroid:2.0.0-RC1' } From 7dcd17d6477782c9134d05172407bbc2eddec5bc Mon Sep 17 00:00:00 2001 From: AMIT SHEKHAR Date: Fri, 21 Oct 2016 13:50:22 +0530 Subject: [PATCH 002/123] upgraded to RxJava2 RC5 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 867dd7a..fe4054b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Users switching from 1.x to 2.x have to re-organize their imports, but carefully Add this in your build.gradle ```groovy -compile 'io.reactivex.rxjava2:rxjava:2.0.0-RC2' +compile 'io.reactivex.rxjava2:rxjava:2.0.0-RC5' ``` If you are using RxAndroid also, then add the following ```groovy From bfc949723844befd15b1c3f2aabea8582ef2fe49 Mon Sep 17 00:00:00 2001 From: AMIT SHEKHAR Date: Wed, 2 Nov 2016 16:13:59 +0530 Subject: [PATCH 003/123] Update RxJava2 to 2.0.0 --- README.md | 4 ++-- app/build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fe4054b..7c5b848 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,11 @@ Users switching from 1.x to 2.x have to re-organize their imports, but carefully Add this in your build.gradle ```groovy -compile 'io.reactivex.rxjava2:rxjava:2.0.0-RC5' +compile 'io.reactivex.rxjava2:rxjava:2.0.0' ``` If you are using RxAndroid also, then add the following ```groovy -compile 'io.reactivex.rxjava2:rxandroid:2.0.0-RC1' +compile 'io.reactivex.rxjava2:rxandroid:2.0.0' ``` # RxJava 2 Examples present in this sample project diff --git a/app/build.gradle b/app/build.gradle index c907d89..82b3e53 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,6 +23,6 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.1.1' - compile 'io.reactivex.rxjava2:rxjava:2.0.0-RC5' - compile 'io.reactivex.rxjava2:rxandroid:2.0.0-RC1' + compile 'io.reactivex.rxjava2:rxjava:2.0.0' + compile 'io.reactivex.rxjava2:rxandroid:2.0.0' } From a52dd3cff3dbd942126b7bf7c2bac60e7c9fa509 Mon Sep 17 00:00:00 2001 From: Wonyoung Date: Mon, 7 Nov 2016 18:51:13 +0900 Subject: [PATCH 004/123] gradle version up --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a3330d4..c20bca1 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.0' + classpath 'com.android.tools.build:gradle:2.2.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From 7b371f0de029ff9a8e91170f2e1341ac44e657b0 Mon Sep 17 00:00:00 2001 From: AMIT SHEKHAR Date: Tue, 15 Nov 2016 13:52:14 +0530 Subject: [PATCH 005/123] Change : description --- .../java/com/rxjava2/android/samples/MergeExampleActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/rxjava2/android/samples/MergeExampleActivity.java b/app/src/main/java/com/rxjava2/android/samples/MergeExampleActivity.java index 088d8d7..d8ae8c0 100644 --- a/app/src/main/java/com/rxjava2/android/samples/MergeExampleActivity.java +++ b/app/src/main/java/com/rxjava2/android/samples/MergeExampleActivity.java @@ -38,7 +38,7 @@ public void onClick(View view) { } /* - * Using merge operator to combine Observable : merge maintain does not + * Using merge operator to combine Observable : merge does not maintain * the order of Observable. * It will emit all the 7 values may not be in order * Ex - "A1", "B1", "A2", "A3", "A4", "B2", "B3" - may be anything From f2bbe13f2c267cdcc051792dc9283be2348affc1 Mon Sep 17 00:00:00 2001 From: AMIT SHEKHAR Date: Fri, 18 Nov 2016 11:42:11 +0530 Subject: [PATCH 006/123] few changes --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7c5b848..4373b21 100644 --- a/README.md +++ b/README.md @@ -99,14 +99,15 @@ RxJava1 -> RxJava2 ### Found this project useful :heart: * Support by clicking the :star: button on the upper right of this page. :v: +### Check out an awesome library for fast and simple networking in Android. +* [Fast Android Networking Library](https://github.com/amitshekhariitbhu/Fast-Android-Networking) + ### Contact - Let's become friend - [Twitter](https://twitter.com/amitiitbhu) - [Github](https://github.com/amitshekhariitbhu) - [Medium](https://medium.com/@amitshekhar) - [Facebook](https://www.facebook.com/amit.shekhar.iitbhu) -### Check out [Fast Android Networking Library](https://github.com/amitshekhariitbhu/Fast-Android-Networking) for simple and easy networking in Android. - ### License ``` Copyright (C) 2016 Amit Shekhar From f2dbeae4dce19cc3237a952d29f88a44f709d4aa Mon Sep 17 00:00:00 2001 From: AMIT SHEKHAR Date: Fri, 18 Nov 2016 16:43:12 +0530 Subject: [PATCH 007/123] few changes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4373b21..e39a6d2 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,8 @@ RxJava1 -> RxJava2 * Many examples are to be added -### Found this project useful :heart: -* Support by clicking the :star: button on the upper right of this page. :v: +### Find this project useful ? :heart: +* Support it clicking the :star: button on the upper right of this page. :v: ### Check out an awesome library for fast and simple networking in Android. * [Fast Android Networking Library](https://github.com/amitshekhariitbhu/Fast-Android-Networking) From 94376b9dc988c8e21191b7dd93777de89fe9cb17 Mon Sep 17 00:00:00 2001 From: AMIT SHEKHAR Date: Fri, 18 Nov 2016 16:43:37 +0530 Subject: [PATCH 008/123] few changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e39a6d2..0fb99c9 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ RxJava1 -> RxJava2 * Many examples are to be added ### Find this project useful ? :heart: -* Support it clicking the :star: button on the upper right of this page. :v: +* Support it by clicking the :star: button on the upper right of this page. :v: ### Check out an awesome library for fast and simple networking in Android. * [Fast Android Networking Library](https://github.com/amitshekhariitbhu/Fast-Android-Networking) From 79cae1e7f10b3780f3c2ed06faa9feff6a41a4ef Mon Sep 17 00:00:00 2001 From: AMIT SHEKHAR Date: Fri, 9 Dec 2016 10:46:10 +0530 Subject: [PATCH 009/123] Update library versions --- README.md | 4 ++-- app/build.gradle | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0fb99c9..9fac2b8 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,11 @@ Users switching from 1.x to 2.x have to re-organize their imports, but carefully Add this in your build.gradle ```groovy -compile 'io.reactivex.rxjava2:rxjava:2.0.0' +compile 'io.reactivex.rxjava2:rxjava:2.0.2' ``` If you are using RxAndroid also, then add the following ```groovy -compile 'io.reactivex.rxjava2:rxandroid:2.0.0' +compile 'io.reactivex.rxjava2:rxandroid:2.0.1' ``` # RxJava 2 Examples present in this sample project diff --git a/app/build.gradle b/app/build.gradle index 82b3e53..5955173 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,6 +23,6 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.1.1' - compile 'io.reactivex.rxjava2:rxjava:2.0.0' - compile 'io.reactivex.rxjava2:rxandroid:2.0.0' + compile 'io.reactivex.rxjava2:rxjava:2.0.2' + compile 'io.reactivex.rxjava2:rxandroid:2.0.1' } From be515c41419884c3aad53e7f97990c565dcd8e87 Mon Sep 17 00:00:00 2001 From: Landice Fu Date: Tue, 13 Dec 2016 14:42:06 +0800 Subject: [PATCH 010/123] add scan demo --- app/src/main/AndroidManifest.xml | 4 +- .../rxjava2/android/samples/MainActivity.java | 4 + .../android/samples/ScanExampleActivity.java | 92 +++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 7 ++ app/src/main/res/values/strings.xml | 1 + 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/com/rxjava2/android/samples/ScanExampleActivity.java diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ae9be2f..626dbe5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -58,6 +58,9 @@ + @@ -70,7 +73,6 @@ - diff --git a/app/src/main/java/com/rxjava2/android/samples/MainActivity.java b/app/src/main/java/com/rxjava2/android/samples/MainActivity.java index a2b8e73..178bc6e 100644 --- a/app/src/main/java/com/rxjava2/android/samples/MainActivity.java +++ b/app/src/main/java/com/rxjava2/android/samples/MainActivity.java @@ -69,6 +69,10 @@ public void startSkipActivity(View view) { startActivity(new Intent(MainActivity.this, SkipExampleActivity.class)); } + public void startScanActivity(View view) { + startActivity(new Intent(MainActivity.this, ScanExampleActivity.class)); + } + public void startReplayActivity(View view) { startActivity(new Intent(MainActivity.this, ReplayExampleActivity.class)); } diff --git a/app/src/main/java/com/rxjava2/android/samples/ScanExampleActivity.java b/app/src/main/java/com/rxjava2/android/samples/ScanExampleActivity.java new file mode 100644 index 0000000..c3ce226 --- /dev/null +++ b/app/src/main/java/com/rxjava2/android/samples/ScanExampleActivity.java @@ -0,0 +1,92 @@ +package com.rxjava2.android.samples; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import com.rxjava2.android.samples.utils.AppConstant; + +import io.reactivex.Observable; +import io.reactivex.Observer; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.disposables.Disposable; +import io.reactivex.functions.BiFunction; +import io.reactivex.schedulers.Schedulers; + +public class ScanExampleActivity extends AppCompatActivity { + + private static final String TAG = ScanExampleActivity.class.getSimpleName(); + Button btn; + TextView textView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_example); + btn = (Button) findViewById(R.id.btn); + textView = (TextView) findViewById(R.id.textView); + + btn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + doSomeWork(); + } + }); + } + + /* Using scan operator, it sends also the previous result */ + private void doSomeWork() { + getObservable() + // Run on a background thread + .subscribeOn(Schedulers.io()) + // Be notified on the main thread + .observeOn(AndroidSchedulers.mainThread()) + .scan(new BiFunction() { + @Override + public Integer apply(Integer int1, Integer int2) throws Exception { + return int1 + int2; + } + }) + .subscribe(getObserver()); + } + + private Observable getObservable() { + return Observable.just(1, 2, 3, 4, 5); + } + + private Observer getObserver() { + return new Observer() { + + @Override + public void onSubscribe(Disposable d) { + Log.d(TAG, " onSubscribe : " + d.isDisposed()); + } + + @Override + public void onNext(Integer value) { + textView.append(" onNext : value : " + value); + textView.append(AppConstant.LINE_SEPARATOR); + Log.d(TAG, " onNext value : " + value); + } + + @Override + public void onError(Throwable e) { + textView.append(" onError : " + e.getMessage()); + textView.append(AppConstant.LINE_SEPARATOR); + Log.d(TAG, " onError : " + e.getMessage()); + } + + @Override + public void onComplete() { + textView.append(" onComplete"); + textView.append(AppConstant.LINE_SEPARATOR); + Log.d(TAG, " onComplete"); + } + }; + } + + +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 95bd666..e8172c2 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -113,6 +113,13 @@ android:text="@string/skip" android:textColor="@android:color/black" /> +