Skip to content

Android自定义相机 Android custom camera , has a basic camera, front and rear camera , flash mode , delay shooting , framing square frame ,camera focus

Notifications You must be signed in to change notification settings

awenzeng/camera

Repository files navigation

CameraDemo

JitPack Downloads

A simple camera app.Please feel free to use this. (Welcome to Star and Fork)

Camera Info(Android Camera相机开发详解)

Demo

Download apk

Download

You can download the latest version from GitHub's releases page.

Or use Gradle.

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
	dependencies {
          compile 'com.github.awenzeng:camera:1.0.1'
  }

Or Maven:

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>
	<dependency>
      <groupId>com.github.awenzeng</groupId>
      <artifactId>camera</artifactId>
      <version>1.0.1</version>
  </dependency>

For info on using the bleeding edge, see the Snapshots wiki page.

ProGuard

Depending on your ProGuard (DexGuard) config and usage, you may need to include the following lines in your proguard.cfg

## app proguard
-keep class com.awen.camera.widget.**{*;}

##Rxjava
-dontwarn javax.annotation.**
-dontwarn javax.inject.**
# RxJava RxAndroid
-dontwarn sun.misc.**
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
    long producerIndex;
    long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
    rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
    rx.internal.util.atomic.LinkedQueueNode consumerNode;
}

How do I use Camera?

Simple use cases with camera's generated API will look something like this:

Init in your application:

public class CameraDemoApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        CameraApplication.init(this,true);
    }
}

In your Activity:

        PermissionsModel permissionsModel = new PermissionsModel(this);
        permissionsModel.checkCameraPermission(new PermissionsModel.PermissionListener() {
            @Override
            public void onPermission(boolean isPermission) {
                if (isPermission) {
                    Intent intent = new Intent(MainActivity.this, TakePhotoActivity.class);
                    startActivityForResult(intent, TakePhotoActivity.REQUEST_CAPTRUE_CODE);
                }
            }
        });
        
    
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK) {
            switch (requestCode) {
                case TakePhotoActivity.REQUEST_CAPTRUE_CODE: {
                    String path = data.getStringExtra(TakePhotoActivity.RESULT_PHOTO_PATH);
                    showTakePhotoImg.setImageBitmap(BitmapUtil.getBitmap(path));
                    Log.v(TAG, "图片地址:" + path);
                    break;
                }
            }
        }
        super.onActivityResult(requestCode, resultCode, data);
    }

Thanks

Rxjava

RxAndroid

RxPermissions

License

Copyright 2017 AwenZeng

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.

About

Android自定义相机 Android custom camera , has a basic camera, front and rear camera , flash mode , delay shooting , framing square frame ,camera focus

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages