Skip to content
BalaKrishnan edited this page Jan 18, 2020 · 2 revisions

EasyCam Wiki

EasyCam focused on two things

  1. Easy implementation of the camera in the app
  2. Easy Customization of camera view

This library handles all the logical parts internally and lets you implement a camera view within minutes.

How does it work?

EasyCam has Capture and Preview page. The Capture page is where the user has a preview of the camera preview (you can look at the image below). Each UI component on this page is customizable. The preview page contains a preview of the image taken. You can go through the list of images you had captured and delete them if required.

It stores the images taken in the external directory as files and returns in onActivityResult callback.

EasyCam offers the following features

  1. Screen orientation handling
  2. Output image orientation handling
  3. Front and Back camera support
  4. Flash support
  5. Single and multiple photoshoot mode
  6. Set minimum and maximum count for multiple shoot mode
  7. Preview of taken photos
  8. Manual focus
  9. Live preview in full screen or fit the aspect ratio
  10. Delete option in multiple shoot mode

Add the dependency in module Gradle file

implementation 'in.balakrishnan.easycam:easycam:0.0.3-rc5'

implementation 'androidx.recyclerview:recyclerview:1.1.0'

implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0-rc03'

You can trigger the Camera Activity with the following code

        Intent intent = new Intent(this, CameraControllerActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.putExtra("inputData", new CameraBundleBuilder()
                .setFullscreenMode(false)
                .setDoneButtonString("Add")
                .setSinglePhotoMode(false)
                .setMax_photo(3)
                .setManualFocus(true)
                .setBucketName(getClass().getName())
                .setPreviewEnableCount(true)
                .setPreviewIconVisiblity(true)
                .setPreviewPageRedirection(true)
                .setEnableDone(false)
                .setClearBucket(true)
                .createCameraBundle());
        startActivityForResult(intent, 214);

You will get the result in the onActivityResult callback

   @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 214) {
            if (resultCode == RESULT_OK) {
                assert data != null;
                list = data.getStringArrayExtra("resultData");
            }
        }
    }

CameraBundleBuilder is a builder class used to configure the Camera View. With simple parameters, you will get the following screen