Skip to content

ShabanKamell/RxGallery

Repository files navigation

RxGallery

RxJava wrapper for Android Gallery & Camera.

With RxGallery you get rid of Activity.onActivityResult() and receive the result on the call site. Also, no runtime permissions are required

Features

  • Easy-to-use APIs
  • Results are delivered at the call site not at Activity.onActivityResult
  • Handle all Camera and Gallery with the same APIs.
  • Handle runtime permissions.

Installation

Download

dependencies {
    implementation 'com.sha.kamel:rx-gallery:1.0.0@aar'
}

repositories {
maven {
   url "https://dl.bintray.com/shabankamel/android"
}
...
}

Usage

  new RxGallery()  
        .captureImage(fragmentActivity)  
        .subscribe(bitmap -> imageView.setImageBitmap(bitmap));

Pick Image

     new RxGallery()
         .image(fragmentActivity)
         .subscribe(result -> {
           // Handle logic here
         };

Pick Multiple Images

     new RxGallery()
     .multipleImages(fragmentActivity)
         .subscribe(result -> {
           // Handle logic here
         };

Pick Video

     new RxGallery()
          .video(fragmentActivity)
          .subscribe(result -> {
             // Handle logic here
          };

Pick Multiple Videos

     new RxGallery()
         .multipleVideos(fragmentActivity)
         .subscribe(result -> {
            // Handle logic here
         };

Pick Audio

     new RxGallery()
          .audio(fragmentActivity, MimeType.VIDEO, MimeType.AUDIO)
          .subscribe(result -> {
             // Handle logic here
          };

Pick Multiple Audio Files

     new RxGallery()
           .multipleAudio(fragmentActivity)
           .subscribe(result -> {
              // Handle logic here
           };

Request By Type

Yo can request any type by

     new RxGallery(fragmentActivity, MimeType.VIDEO, MimeType.AUDIO)
         .requestByType()
         .subscribe(result -> {
            // Handle logic here
         };

Request Multiple By Type

     new RxGallery(fragmentActivity, MimeType.VIDEO, MimeType.AUDIO)
           .requestMultipleByType()
           .subscribe(result -> {
             // Handle logic here
           };

See 'app' module for the full code.

License

Apache license 2.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published