EasyCam makes it easy to implement Camera features in Android App so easily. It offers Single and Multiple photoshoot mode with a preview option.
We have developed this module while working on one of our project
Add 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'
(Viewmodel and Recyclerview are used to maintain state and list the images. We are working on to provide support without viemodel or recyclerview)
Start the Intent when required from activity or fragment
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 results in 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");
}
}
}
Delete the files once you are processed them using following function
FileUtils.clearAllFiles(this, getClass().getName());
The above function requires context and bucket name.
What EasyCam offers
The standout point in Easy cam is that all components are configurable (i.e) Capture button drawable, Done button background and text.
Also we have thrown in a cool feature that preview badge image will turn along with the device orientation. We can either enable or disable this.
You can see the change log here
Interested to contribute to EasyCam, You are one pull request away. You can go through the guidelines here
Reach out to me in Twitter