Skip to content

Commit

Permalink
Move from Bintray to JitPack. (tbruyelle#231)
Browse files Browse the repository at this point in the history
* Update libraries to latest versions.

* Move from bintray to jitpack.

* Update travis file.
  • Loading branch information
epool authored and tbruyelle committed Jul 6, 2018
1 parent 8ff1dc5 commit 81438b6
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 88 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ language: android
android:
components:
- tools
- build-tools-25.0.2
- android-25
- build-tools-27.0.3
- android-27
- extra-android-m2repository

jdk: oraclejdk8
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ This library allows the usage of RxJava with the new Android M permission model.
To use this library your `minSdkVersion` must be >= 11.

```gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar'
implementation 'com.github.tbruyelle:rxpermissions:0.9.6'
}
```

Expand Down
17 changes: 9 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}

subprojects {
allprojects {
repositories {
google()
jcenter()
}
}

ext {
minSdkVersion = 11
compileSdkVersion = 25
compileSdkVersion = 27
targetSdkVersion = compileSdkVersion
buildToolsVersion = '25.0.2'

rxJava = 'io.reactivex.rxjava2:rxjava:2.1.8'
supportLibraryVersion = '25.2.0'
rxJava = 'io.reactivex.rxjava2:rxjava:2.1.16'
supportLibraryVersion = '27.1.1'
appCompat = "com.android.support:appcompat-v7:$supportLibraryVersion"
supportAnnotations = "com.android.support:support-annotations:$supportLibraryVersion"
junit = 'junit:junit:4.12'
mockito = 'org.mockito:mockito-core:1.10.19'

robolectricVersion = '3.1.4'
robolectricVersion = '3.3.2'
robolectric = "org.robolectric:robolectric:$robolectricVersion"
robolectricShadowsSupport = "org.robolectric:shadows-support-v4:$robolectricVersion"
// Workaround for https://github.com/robolectric/robolectric/issues/1932
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Mar 03 17:05:06 SGT 2017
#Thu Jun 28 09:30:08 CDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
24 changes: 11 additions & 13 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
apply plugin: 'com.android.library'
apply from: 'jitpack.gradle'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 12
version = rootProject.ext.libraryVersion
group = rootProject.ext.publishedGroupId + rootProject.ext.artifact
}
buildTypes {
release {
Expand All @@ -28,15 +25,16 @@ android {
}

dependencies {
compile rootProject.ext.rxJava
compile rootProject.ext.supportAnnotations
implementation rootProject.ext.rxJava
implementation rootProject.ext.supportAnnotations

testCompile rootProject.ext.junit
testCompile rootProject.ext.mockito
testCompile rootProject.ext.robolectric
testCompile rootProject.ext.robolectricShadowsSupport
testCompile rootProject.ext.khronosOpenGLApi
testImplementation rootProject.ext.junit
testImplementation rootProject.ext.mockito
testImplementation rootProject.ext.robolectric
testImplementation rootProject.ext.robolectricShadowsSupport
testImplementation rootProject.ext.khronosOpenGLApi
}

apply from: 'install.gradle'
apply from: 'bintray.gradle'
// Commented to use JitPack instead of bintray
//apply from: 'install.gradle'
//apply from: 'bintray.gradle'
3 changes: 3 additions & 0 deletions lib/jitpack.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
apply plugin: 'com.github.dcendents.android-maven'

group = 'com.github.tbruyelle'
12 changes: 5 additions & 7 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "com.tbruyelle.rxpermissions.sample"
Expand All @@ -19,12 +18,11 @@ android {
}

dependencies {
compile project(':rxpermissions')
implementation project(':rxpermissions')

compile rootProject.ext.appCompat
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile 'com.github.akarnokd:rxjava2-interop:0.8.0'
implementation rootProject.ext.appCompat
implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'

testCompile rootProject.ext.junit
testCompile rootProject.ext.mockito
testImplementation rootProject.ext.junit
testImplementation rootProject.ext.mockito
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@
import android.util.Log;
import android.view.SurfaceView;
import android.widget.Toast;
import com.jakewharton.rxbinding.view.RxView;

import com.jakewharton.rxbinding2.view.RxView;
import com.tbruyelle.rxpermissions2.Permission;
import com.tbruyelle.rxpermissions2.RxPermissions;
import hu.akarnokd.rxjava.interop.RxJavaInterop;

import java.io.IOException;

import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import java.io.IOException;
import rx.functions.Func1;

public class MainActivity extends AppCompatActivity {

private static final String TAG = "RxPermissionsSample";

private Camera camera;
private SurfaceView surfaceView;
private Disposable disposable;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -30,58 +33,58 @@ protected void onCreate(Bundle savedInstanceState) {
rxPermissions.setLogging(true);

setContentView(R.layout.act_main);
surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
surfaceView = findViewById(R.id.surfaceView);

RxJavaInterop.toV2Observable(
RxView.clicks(findViewById(R.id.enableCamera))
.map(new Func1<Void, Object>() {
@Override
public Object call(final Void aVoid) {
return new Object();
}
})
)
// Ask for permissions when button is clicked
.compose(rxPermissions.ensureEach(permission.CAMERA))
.subscribe(new Consumer<Permission>() {
@Override
public void accept(Permission permission) {
Log.i(TAG, "Permission result " + permission);
if (permission.granted) {
releaseCamera();
camera = Camera.open(0);
try {
camera.setPreviewDisplay(surfaceView.getHolder());
camera.startPreview();
} catch (IOException e) {
Log.e(TAG, "Error while trying to display the camera preview", e);
}
} else if (permission.shouldShowRequestPermissionRationale) {
// Denied permission without ask never again
Toast.makeText(MainActivity.this,
"Denied permission without ask never again",
Toast.LENGTH_SHORT).show();
} else {
// Denied permission with ask never again
// Need to go to the settings
Toast.makeText(MainActivity.this,
"Permission denied, can't enable the camera",
Toast.LENGTH_SHORT).show();
}
}
},
new Consumer<Throwable>() {
@Override
public void accept(Throwable t) {
Log.e(TAG, "onError", t);
}
},
new Action() {
@Override
public void run() {
Log.i(TAG, "OnComplete");
}
});
disposable = RxView.clicks(findViewById(R.id.enableCamera))
// Ask for permissions when button is clicked
.compose(rxPermissions.ensureEach(permission.CAMERA))
.subscribe(new Consumer<Permission>() {
@Override
public void accept(Permission permission) {
Log.i(TAG, "Permission result " + permission);
if (permission.granted) {
releaseCamera();
camera = Camera.open(0);
try {
camera.setPreviewDisplay(surfaceView.getHolder());
camera.startPreview();
} catch (IOException e) {
Log.e(TAG, "Error while trying to display the camera preview", e);
}
} else if (permission.shouldShowRequestPermissionRationale) {
// Denied permission without ask never again
Toast.makeText(MainActivity.this,
"Denied permission without ask never again",
Toast.LENGTH_SHORT).show();
} else {
// Denied permission with ask never again
// Need to go to the settings
Toast.makeText(MainActivity.this,
"Permission denied, can't enable the camera",
Toast.LENGTH_SHORT).show();
}
}
},
new Consumer<Throwable>() {
@Override
public void accept(Throwable t) {
Log.e(TAG, "onError", t);
}
},
new Action() {
@Override
public void run() {
Log.i(TAG, "OnComplete");
}
});
}

@Override
protected void onDestroy() {
if (disposable != null && !disposable.isDisposed()) {
disposable.dispose();
}
super.onDestroy();
}

@Override
Expand All @@ -96,4 +99,5 @@ private void releaseCamera() {
camera = null;
}
}

}

0 comments on commit 81438b6

Please sign in to comment.