Skip to content

Latest commit

 

History

History
98 lines (82 loc) · 2.94 KB

README_EN.md

File metadata and controls

98 lines (82 loc) · 2.94 KB

IDCardCamera

Android custom ID card camera

jitpack API

Design sketch

APK

download APK

Features

  • 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

Usage

Step 1. Add a JitPack repertory

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

Step 2. Add a gradle dependency

dependencies {
	compile 'com.github.wildma:IDCardCamera:1.1.1'
}

Step 3. Open photographic interface

  • 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".

Step 4. Get a picture

@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));
			}
		}
	}
}

Clear Cache

FileUtils.clearCache(this);

Blog:Android custom ID card camera

Thanks

License

   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.