diff --git a/.repo/camerakit-android-header.png b/.repo/camerakit-android-header.png
new file mode 100644
index 00000000..b12139c3
Binary files /dev/null and b/.repo/camerakit-android-header.png differ
diff --git a/.repo/google-play-badge.png b/.repo/google-play-badge.png
new file mode 100644
index 00000000..c77b7464
Binary files /dev/null and b/.repo/google-play-badge.png differ
diff --git a/README.md b/README.md
index 5c28de74..b3cb3d86 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,33 @@
+![CameraKit Header](.repo/camerakit-android-header.png)
+
+CameraKit is an extraordinarily easy to use utility to work with the infamous Android Camera and Camera2 APIs. Built by [Dylan McIntyre](https://github.com/dwillmc).
+
+
+Try out all the unique features using the CameraKit Demo from the Google Play store!
+
+
+
+
+## Features
+
+- Image and video capture seamlessly working with the same preview session.
+- Automatic system permission handling.
+- Automatic preview scaling.
+ - Create a `CameraView` of any size (not just presets!).
+ - Automatic output cropping to match your `CameraView` bounds.
+- Multiple capture modes.
+ - `PICTURE_MODE_QUALITY`: an image captured normally using the camera APIs.
+ - `PICTURE_MODE_SPEED`: a freeze frame of the `CameraView` preview (similar to SnapChat and Instagram) for devices with slower cameras.
+ - Automatic picture mode determination based on measured speed.
## Setup
-Add __CameraKit__ to your dependencies block:
+Add __CameraKit__ to the dependencies block in your `app` level `build.gradle`:
```groovy
compile 'com.flurgle:camerakit:1.0.0'
```
## Usage
-## To Do (incoming!)
## Credits
Dylan McIntyre
diff --git a/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java b/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java
index de62fb36..93e497ae 100644
--- a/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java
+++ b/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java
@@ -2,6 +2,8 @@ package com.flurgle.camerakit;
import android.content.Context;
import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.IntDef;
@@ -277,7 +279,7 @@ public class CameraView extends FrameLayout {
}
- protected static class CameraListenerMiddleWare extends CameraListener {
+ protected class CameraListenerMiddleWare extends CameraListener {
private CameraListener mCameraListener;
@@ -300,7 +302,14 @@ public class CameraView extends FrameLayout {
@Override
public void onPictureTaken(byte[] picture) {
super.onPictureTaken(picture);
- mCameraListener.onPictureTaken(picture);
+ if (mCropOutput) {
+ Bitmap bitmap = BitmapFactory.decodeByteArray(picture, 0, picture.length);
+ int previewWidth = mCameraImpl.mPreview.getWidth();
+ int previewHeight = mCameraImpl.mPreview.getWidth();
+ mCameraListener.onPictureTaken(picture);
+ } else {
+ mCameraListener.onPictureTaken(picture);
+ }
}
@Override
diff --git a/demo/src/main/java/com/flurgle/camerakit/demo/MainActivity.java b/demo/src/main/java/com/flurgle/camerakit/demo/MainActivity.java
index 93d81462..d4a61c54 100644
--- a/demo/src/main/java/com/flurgle/camerakit/demo/MainActivity.java
+++ b/demo/src/main/java/com/flurgle/camerakit/demo/MainActivity.java
@@ -57,6 +57,8 @@ public class MainActivity extends AppCompatActivity {
@BindView(R.id.height)
EditText height;
+ int pictureMode = Constants.PICTURE_MODE_QUALITY;
+
boolean blockInvalidation;
@Override
diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml
index c248fbaf..3f567d3c 100644
--- a/demo/src/main/res/layout/activity_main.xml
+++ b/demo/src/main/res/layout/activity_main.xml
@@ -18,7 +18,8 @@
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_gravity="center_horizontal"
- app:ckFacing="front" />
+ app:ckCropOutput="true"
+ app:ckFacing="back" />