nanchen2251/CameraView


CameraView,自定义相机View,自动聚焦,支持自定义UI

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.nanchen2251:CameraView:'
	}
	dependencies {
		implementation("com.github.nanchen2251:CameraView:")
	}
	<dependency>
	    <groupId>com.github.nanchen2251</groupId>
	    <artifactId>CameraView</artifactId>
	    <version></version>
	</dependency>

                            
    libraryDependencies += "com.github.nanchen2251" % "CameraView" % ""
        
        

                            
    :dependencies [[com.github.nanchen2251/CameraView ""]]
        
        

Readme


CameraView 中文版

CustomizeCameraView,autofocus,support customize the ui.

This is not my work.just from team google

###The reason why I was in the warehouse was because I wanted to make it easier for everyone to use it

###At the same time I will follow up the development of their team,in order to bring you something better This is a preview release. The API is subject to change.

This is not an official Google product.

CameraView aims to help Android developers easily integrate Camera features.

Requires API Level 9. The library uses Camera 1 API on API Level 9-20 and Camera2 on 21 and above.

| API Level | Camera API | Preview View | |:---------:|------------|--------------| | 9-13 | Camera1 | SurfaceView | | 14-20 | Camera1 | TextureView | | 21-23 | Camera2 | TextureView | | 24 | Camera2 | SurfaceView |

##You can find the preview gif

Features

  • Camera preview by placing it in a layout XML (and calling the start method)
  • Configuration by attributes
    • Aspect ratio (app:aspectRatio)
    • Auto-focus (app:autoFocus)
    • Flash (app:flash)

Usage

Now,it has been synchronized to jitpack by myself. #####Step 1. Add it in your root build.gradle at the end of repositories:

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

#####Step 2. Add the dependency

dependencies {
	        compile 'com.github.nanchen2251:CameraView:1.0.1'
	}

#####Step 3.You can use it to xml

<com.google.android.cameraview.CameraView
    android:id="@+id/camera"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:keepScreenOn="true"
    android:adjustViewBounds="true"
    app:autoFocus="true"
    app:aspectRatio="4:3"
    app:facing="back"
    app:flash="auto"/>

#####Step 4.And use it to activity.

    @Override
    protected void onResume() {
        super.onResume();
        mCameraView.start();
    }

    @Override
    protected void onPause() {
        mCameraView.stop();
        super.onPause();
    }

You can see a complete usage in the demo app.

##my info    nanchen<br>    ChengDu SiChuan<br>    blogs