android 相机 flashmode,GitHub - awenzeng/camera: Android自定义相机 Android custom camera , has a basic came...

CameraDemo

68747470733a2f2f6a69747061636b2e696f2f762f6177656e7a656e672f63616d6572612e737667

68747470733a2f2f6a69747061636b2e696f2f762f6177656e7a656e672f63616d6572612f6d6f6e74682e737667

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

Demo

camera_demo.gif

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:

jitpack.io

https://jitpack.io

com.github.awenzeng

camera

1.0.1

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

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值