Skip to content

Commit

Permalink
Migrate to RxJava 3
Browse files Browse the repository at this point in the history
Fix code style

Update README and CHANGELOG

Apply code style, update README
  • Loading branch information
MrAsterisco committed Jun 3, 2020
1 parent 58b0b17 commit 2cc2a09
Show file tree
Hide file tree
Showing 43 changed files with 480 additions and 473 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
CHANGELOG
=========

v. 4.0.0
--------
*01 Jun 2020*

- **migrated library to RxJava3.x** on RxJava3.x branch and released it as `reactivenetwork-rx3` artifact
- the `onError` method in `NetworkObservingStrategy` now requires a `Throwable` instead of an `Exception`.
- updated project dependencies
- update gradle version

v. 3.0.8
--------
*02 Apr 2020*
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ReactiveNetwork-brightgreen.svg?style=flat-square)](https://android-arsenal.com/details/1/2290)

view website with documentation: [RxJava1.x](http://pwittchen.github.io/ReactiveNetwork/docs/RxJava1.x/), [**RxJava2.x**](http://pwittchen.github.io/ReactiveNetwork/docs/RxJava2.x/)
view website with documentation: [RxJava1.x](http://pwittchen.github.io/ReactiveNetwork/docs/RxJava1.x/), [RxJava2.x](http://pwittchen.github.io/ReactiveNetwork/docs/RxJava2.x/), [**RxJava3.x**](http://pwittchen.github.io/ReactiveNetwork/docs/RxJava3.x/)

ReactiveNetwork is an Android library listening **network connection state** and **Internet connectivity** with RxJava Observables. It's a successor of [Network Events](https://github.com/pwittchen/NetworkEvents) library rewritten with Reactive Programming approach. Library supports both new and legacy network monitoring strategies. Min sdk version = 9.

| Current Branch | Branch | Artifact Id | Build Status | Coverage | Maven Central |
|:--------------:|:-------:|:-----------:|:-------------:|:--------:|:-------------:|
| | [`RxJava1.x`](https://github.com/pwittchen/ReactiveNetwork/tree/RxJava1.x) | `reactivenetwork` | [![Build Status for RxJava1.x](https://img.shields.io/travis/pwittchen/ReactiveNetwork/RxJava1.x.svg?style=flat-square)](https://travis-ci.org/pwittchen/ReactiveNetwork) | [![codecov](https://img.shields.io/codecov/c/github/pwittchen/ReactiveNetwork/RxJava1.x.svg?style=flat-square&label=coverage)](https://codecov.io/gh/pwittchen/ReactiveNetwork/branch/RxJava1.x) | ![Maven Central](https://img.shields.io/maven-central/v/com.github.pwittchen/reactivenetwork.svg?style=flat-square) |
| :ballot_box_with_check: | [`RxJava2.x`](https://github.com/pwittchen/ReactiveNetwork/tree/RxJava2.x) | `reactivenetwork-rx2` | [![Build Status for RxJava2.x](https://img.shields.io/travis/pwittchen/ReactiveNetwork/RxJava2.x.svg?style=flat-square)](https://travis-ci.org/pwittchen/ReactiveNetwork) | [![codecov](https://img.shields.io/codecov/c/github/pwittchen/ReactiveNetwork/RxJava2.x.svg?style=flat-square&label=coverage)](https://codecov.io/gh/pwittchen/ReactiveNetwork/branch/RxJava2.x) | ![Maven Central](https://img.shields.io/maven-central/v/com.github.pwittchen/reactivenetwork-rx2.svg?style=flat-square) |
| | [`RxJava2.x`](https://github.com/pwittchen/ReactiveNetwork/tree/RxJava2.x) | `reactivenetwork-rx2` | [![Build Status for RxJava2.x](https://img.shields.io/travis/pwittchen/ReactiveNetwork/RxJava2.x.svg?style=flat-square)](https://travis-ci.org/pwittchen/ReactiveNetwork) | [![codecov](https://img.shields.io/codecov/c/github/pwittchen/ReactiveNetwork/RxJava2.x.svg?style=flat-square&label=coverage)](https://codecov.io/gh/pwittchen/ReactiveNetwork/branch/RxJava2.x) | ![Maven Central](https://img.shields.io/maven-central/v/com.github.pwittchen/reactivenetwork-rx2.svg?style=flat-square) |
| :ballot_box_with_check: | [`RxJava3.x`](https://github.com/pwittchen/ReactiveNetwork/tree/RxJava3.x) | `reactivenetwork-rx3` | [![Build Status for RxJava3.x](https://img.shields.io/travis/pwittchen/ReactiveNetwork/RxJava3.x.svg?style=flat-square)](https://travis-ci.org/pwittchen/ReactiveNetwork) | [![codecov](https://img.shields.io/codecov/c/github/pwittchen/ReactiveNetwork/RxJava3.x.svg?style=flat-square&label=coverage)](https://codecov.io/gh/pwittchen/ReactiveNetwork/branch/RxJava3.x) | ![Maven Central](https://img.shields.io/maven-central/v/com.github.pwittchen/reactivenetwork-rx3.svg?style=flat-square) |

Contents
--------
Expand Down Expand Up @@ -600,11 +601,11 @@ Then commit and push your changes to `gh-pages` branch.
Documentation
--------------------------

view website with documentation: [RxJava1.x](http://pwittchen.github.io/ReactiveNetwork/docs/RxJava1.x/), [**RxJava2.x**](http://pwittchen.github.io/ReactiveNetwork/docs/RxJava2.x/)
view website with documentation: [RxJava1.x](http://pwittchen.github.io/ReactiveNetwork/docs/RxJava1.x/), [RxJava2.x](http://pwittchen.github.io/ReactiveNetwork/docs/RxJava2.x/), [**RxJava3.x**](http://pwittchen.github.io/ReactiveNetwork/docs/RxJava3.x/)

It can be generated as follows:

Copy the latest `README.md` file from `RxJava1.x` or `RxJava2.x` branch. Then checkout to `gh-pages` branch and put it into appropriate directory inside `docs/` directory.
Copy the latest `README.md` file from `RxJava1.x`, `RxJava2.x` or `RxJava3.x` branch. Then checkout to `gh-pages` branch and put it into appropriate directory inside `docs/` directory.

You can do it as follows via bash script:

Expand Down Expand Up @@ -633,7 +634,7 @@ Next, we can just save changes, commit and push them to remote repository.
Releasing
---------

See [RELEASING.md](https://github.com/pwittchen/ReactiveNetwork/blob/RxJava2.x/RELEASING.md) file.
See [RELEASING.md](https://github.com/pwittchen/ReactiveNetwork/blob/RxJava3.x/RELEASING.md) file.

Contributors
------------
Expand All @@ -650,6 +651,7 @@ Contributors
- [Alexander Perfilyev](https://github.com/aperfilyev)
- [Vishesh Vadhera](https://github.com/VisheshVadhera)
- [@ychescale9](https://github.com/ychescale9)
- [Alessio Moiso](https://github.com/MrAsterisco)

References
----------
Expand Down
4 changes: 4 additions & 0 deletions app-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ android {
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

detekt {
Expand Down
26 changes: 13 additions & 13 deletions app-kotlin/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,25 +146,25 @@ exceptions:
TooGenericExceptionCaught:
active: true
exceptions:
- ArrayIndexOutOfBoundsException
- Error
- Exception
- IllegalMonitorStateException
- NullPointerException
- IndexOutOfBoundsException
- RuntimeException
- Throwable
- ArrayIndexOutOfBoundsException
- Error
- Exception
- IllegalMonitorStateException
- NullPointerException
- IndexOutOfBoundsException
- RuntimeException
- Throwable
ExceptionRaisedInUnexpectedLocation:
active: false
methodNames: 'toString,hashCode,equals,finalize'
TooGenericExceptionThrown:
active: true
exceptions:
- Error
- Exception
- NullPointerException
- Throwable
- RuntimeException
- Error
- Exception
- NullPointerException
- Throwable
- RuntimeException
NotImplementedDeclaration:
active: false
PrintStackTrace:
Expand Down
12 changes: 6 additions & 6 deletions app-kotlin/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.pwittchen.reactivenetwork.kotlinapp">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true" >
android:usesCleartextTraffic="true">
<activity android:name="com.github.pwittchen.reactivenetwork.kotlinapp.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ package com.github.pwittchen.reactivenetwork.kotlinapp
import android.app.Activity
import android.os.Bundle
import android.util.Log
import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import com.github.pwittchen.reactivenetwork.library.rx3.ReactiveNetwork
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.disposables.Disposable
import io.reactivex.rxjava3.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_main.connectivity_status
import kotlinx.android.synthetic.main.activity_main.internet_status

Expand Down
8 changes: 4 additions & 4 deletions app-kotlin/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>

</resources>
36 changes: 18 additions & 18 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.pwittchen.reactivenetwork.app" >
package="com.github.pwittchen.reactivenetwork.app">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import com.github.pwittchen.reactivenetwork.library.rx3.ReactiveNetwork;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.schedulers.Schedulers;

public class MainActivity extends Activity {
private static final String TAG = "ReactiveNetwork";
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/values-w820dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
8 changes: 4 additions & 4 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>

</resources>
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ ext {
minSdkVersion = 14
minSdkVersionApps = 23
compileSdkVersion = 28
buildToolsVersion = '28.0.3'
gradleVersion = '4.6'
buildToolsVersion = '29.0.2'
gradleVersion = '6.3'
kotlinVersion = '1.3.72'
detektVersion = '1.0.0.RC6-1'
}

ext.deps = [rxjava2 : 'io.reactivex.rxjava2:rxjava:2.2.19',
rxandroid2 : 'io.reactivex.rxjava2:rxandroid:2.1.1',
ext.deps = [rxjava3 : 'io.reactivex.rxjava3:rxjava:3.0.4',
rxandroid3 : 'io.reactivex.rxjava3:rxandroid:3.0.0',
annotation : 'androidx.annotation:annotation:1.1.0',
appcompat : 'androidx.appcompat:appcompat:1.1.0',
junit : 'junit:junit:4.13',
Expand All @@ -38,7 +38,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.android.tools.build:gradle:4.0.0'
classpath('com.hiya:jacoco-android:0.2') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ org.gradle.jvmargs=-XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+Heap

android.useAndroidX=true
android.enableJetifier=true
android.enableR8.fullMode=false
android.enableUnitTestBinaryResources=true
android.enableR8.fullMode=false
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Jun 01 10:11:40 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ android {
}

dependencies {
api deps.rxjava2
api deps.rxandroid2
api deps.rxjava3
api deps.rxandroid3
implementation deps.annotation

testImplementation deps.junit
Expand Down
8 changes: 4 additions & 4 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.pwittchen.reactivenetwork.library.rx2">
package="com.github.pwittchen.reactivenetwork.library.rx3">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application />
<uses-permission android:name="android.permission.INTERNET" />

<application/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

</manifest>

0 comments on commit 2cc2a09

Please sign in to comment.