安卓相机库 - sandriosCamera

2016-12-25      128      Android
项目简介

sandriosCamera

安卓相机库

sandrios camera 让开发者无需处理复杂的相机API即可整合图像和视频捕捉。

它在cameravie中包含图片选择界面可以让用户从相机模块内访问最近的媒体。

Download

你可以从 GitHub的发布页下载一个aar.

或者使用Gradle:

repositories {
   jcenter()
}

dependencies {
  compile 'com.sandrios.android:sandriosCamera:1.0.6'
}

或者Maven:

<dependency>
  <groupId>com.sandrios.android</groupId>
  <artifactId>sandriosCamera</artifactId>
  <version>1.0.6</version>
  <type>pom</type>
</dependency>

ProGuard

依赖于你的ProGuard设置和使用方法,你可能需要在proguard.cfg中导入下列代码:

-keep public class com.sandrios.** { *; }

-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; }
-keep public class android.support.v7.internal.view.menu.** { *; }

-keep public class * extends android.support.v4.view.ActionProvider {
    public <init>(android.content.Context);
}

-dontwarn android.support.**

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}


-keepattributes *Annotation*
-keepclassmembers class ** {
    @com.squareup.otto.Subscribe public *;
    @com.squareup.otto.Produce public *;
}

怎么样使用Sandrios Camera?

检查示例项目以获得更多示例:

private static final int CAPTURE_MEDIA = 368;

  // showImagePicker is boolean value: Default is true
  private void launchCamera() {
      new SandriosCamera(activity, CAPTURE_MEDIA)
                                  .setShowPicker(showImagePicker)
                                  .setMediaAction(CameraConfiguration.MEDIA_ACTION_VIDEO) // default is CameraConfiguration.MEDIA_ACTION_BOTH
                                  .launchCamera();
  }

  @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);

         if (requestCode == CAPTURE_MEDIA && resultCode == RESULT_OK) {
             Log.e("File", "" + data.getStringExtra(SandriosCameraConfiguration.Arguments.FILE_PATH));
             Toast.makeText(this, "Media captured.", Toast.LENGTH_SHORT).show();
         }
     }