Skip to content

Using startActivityForResult needn't onActivityResult, and easy to use Camera.

Notifications You must be signed in to change notification settings

6iovan/RxIntent

Repository files navigation

RxIntent

This library using openForResult or start Camera App without callback.
Support Android N(FileUriExposedException).

Setup

To use this library your minSdkVersion must be >= 16. just because of not to be old school developer!

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency:

dependencies {
    implementation 'com.github.1van:RxIntent:-SNAPSHOT'
}

Usage

RxIntent.open(ExampleActivity.this, ResultActivity.class)
        .subscribe(result -> {
            // TODO
         });
RxIntent.with(this)
        .intent(new Intent(ExampleActivity.this, ResultActivity.class))
        .open()
        .subscribe(result -> {
            // TODO
        });

Capture videos:

RxIntent.with(this)
        .video()
        .setDurationLimit(10)
        .setVideoQuality(1)
        .file() // Provide two return types are File and Uri.
        .subscribe(file -> {
            // TODO
        });

Capture images:

RxIntent.with(this)
        .image()
        .uri() // Provide two return types are File and Uri.
        .subscribe(uri -> {
            // TODO
        });

With RxPermissions:

RxPermissions rxPermissions = new RxPermissions(this);
rxPermissions.request(Manifest.permission.CAMERA,
        Manifest.permission.READ_EXTERNAL_STORAGE,
        Manifest.permission.WRITE_EXTERNAL_STORAGE)
        .flatMap(granted -> RxIntent.with(this).image().uri())
        .subscribe(uri -> {
            // TODO 
        });

Releases

No releases published

Packages

No packages published

Languages