EZCam

Simple library that allows you to display preview and take pictures easily with callbacks!

Лицензия

Лицензия

Группа

Группа

me.aflak.libraries
Идентификатор

Идентификатор

ezcam
Последняя версия

Последняя версия

2.3.3
Дата

Дата

Тип

Тип

aar
Описание

Описание

EZCam
Simple library that allows you to display preview and take pictures easily with callbacks!
Ссылка на сайт

Ссылка на сайт

https://github.com/omaflak/Android-Camera2-Library
Система контроля версий

Система контроля версий

https://github.com/omaflak/Android-Camera2-Library

Скачать ezcam

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/me.aflak.libraries/ezcam/ -->
<dependency>
    <groupId>me.aflak.libraries</groupId>
    <artifactId>ezcam</artifactId>
    <version>2.3.3</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/me.aflak.libraries/ezcam/
implementation 'me.aflak.libraries:ezcam:2.3.3'
// https://jarcasting.com/artifacts/me.aflak.libraries/ezcam/
implementation ("me.aflak.libraries:ezcam:2.3.3")
'me.aflak.libraries:ezcam:aar:2.3.3'
<dependency org="me.aflak.libraries" name="ezcam" rev="2.3.3">
  <artifact name="ezcam" type="aar" />
</dependency>
@Grapes(
@Grab(group='me.aflak.libraries', module='ezcam', version='2.3.3')
)
libraryDependencies += "me.aflak.libraries" % "ezcam" % "2.3.3"
[me.aflak.libraries/ezcam "2.3.3"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.android.support » appcompat-v7 jar 26.0.0-beta2

Модули Проекта

Данный проект не имеет модулей.

EZCam Download

EZCam is an Android library that simplifies the use of Camera 2 API for a basic usage.

Dependencie

Add the following line in your gradle dependencies :

compile 'me.aflak.libraries:ezcam:X.X'

Or if you use Maven :

<dependency>
  <groupId>me.aflak.libraries</groupId>
  <artifactId>ezcam</artifactId>
  <version>X.X</version>
  <type>pom</type>
</dependency>

TextureView

Important : The TextureView must be in a FrameLayout.

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextureView
    android:id="@+id/textureView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>
</FrameLayout>

Initialize

EZCam cam = new EZCam(Context);
String id = cam.getCamerasList().get(CameraCharacteristics.LENS_FACING_BACK); // should check if LENS_FACING_BACK exist before calling get()
cam.selectCamera(id);

Callback

cam.setCameraCallback(new EZCamCallback() {
	@Override
	public void onCameraReady() {
		// triggered after cam.open(...)
		// you can set capture settings for example:
		cam.setCaptureSetting(CaptureRequest.COLOR_CORRECTION_ABERRATION_MODE, CameraMetadata.COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY);
		cam.setCaptureSetting(CaptureRequest.CONTROL_EFFECT_MODE, CameraMetadata.CONTROL_EFFECT_MODE_NEGATIVE);

		// then start the preview
		cam.startPreview();
	}

	@Override
	public void onPicture(Image image) {
		File file = new File(getFilesDir(), "image.jpg"); // internal storage
		File file = new File(getExternalFilesDir(null), "image.jpg") // external storage, need permissions
		EZCam.saveImage(image, file);
	}

	@Override
	public void onError(String message) {
		// all errors will be passed through this methods
	}

	@Override
	public void onCameraDisconnected() {
		// camera disconnected
	}
});

Open Camera

cam.open(CameraDevice.TEMPLATE_PREVIEW, textureView); // needs Manifest.permission.CAMERA

Take picture

cam.takePicture();

Close camera

@Override
protected void onDestroy() {
cam.close();
	super.onDestroy();
}

TODO

  • Recording videos
  • Apply custom filters

See MainActivity.java

Версии библиотеки

Версия
2.3.3
2.3.2
2.3.1
2.3
2.2
1.0