Android custom ID card camera
- Custom camera interface
- Support to turn on flash
- Support touch screen for focusing
- Support automatic focus
- Support automatic clipping of images
- Support manual irregular clipping of images
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
dependencies {
compile 'com.github.wildma:IDCardCamera:1.1.1'
}
- front
IDCardCamera.create(this).openCamera(IDCardCamera.TYPE_IDCARD_FRONT);
- back
IDCardCamera.create(this).openCamera(IDCardCamera.TYPE_IDCARD_BACK);
notice: In the Fragment,Replace "this" with "fragment.this".
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == IDCardCamera.RESULT_CODE) {
final String path = IDCardCamera.getImagePath(data);
if (!TextUtils.isEmpty(path)) {
if (requestCode == IDCardCamera.TYPE_IDCARD_FRONT) {
mIvFront.setImageBitmap(BitmapFactory.decodeFile(path));
} else if (requestCode == IDCardCamera.TYPE_IDCARD_BACK) {
mIvBack.setImageBitmap(BitmapFactory.decodeFile(path));
}
}
}
}
FileUtils.clearCache(this);
Blog:Android custom ID card camera
Copyright 2018 wildma
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.