From be412692648ef6bb558b815d71835e3c53a5fd5f Mon Sep 17 00:00:00 2001 From: Dylan McIntyre Date: Wed, 18 Jan 2017 22:33:13 -0500 Subject: [PATCH] Basic demo app --- .gitignore | 2 + .idea/misc.xml | 36 --- README.md | 17 +- .../com/wonderkiln/camerakit/CameraView.java | 17 +- demo/src/main/res/drawable/ic_flash.xml | 9 + demo/src/main/res/drawable/ic_photo.xml | 12 + demo/src/main/res/drawable/ic_switch.xml | 9 + demo/src/main/res/drawable/ic_video.xml | 9 + demo/src/main/res/layout/activity_main.xml | 214 +++++++++++++++++- 9 files changed, 270 insertions(+), 55 deletions(-) delete mode 100644 .idea/misc.xml create mode 100644 demo/src/main/res/drawable/ic_flash.xml create mode 100644 demo/src/main/res/drawable/ic_photo.xml create mode 100644 demo/src/main/res/drawable/ic_switch.xml create mode 100644 demo/src/main/res/drawable/ic_video.xml diff --git a/.gitignore b/.gitignore index f6b286ce..5111d77d 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,5 @@ captures/ # Keystore files *.jks + +.idea diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 9fc28d4d..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 5818f17f..1f88a13b 100644 --- a/README.md +++ b/README.md @@ -1 +1,16 @@ -# camerakit-android \ No newline at end of file + +## Setup +Add __CameraKit__ to your dependencies block: +```groovy +compile 'com.wonderkiln:camerakit:1.0.0' +``` + +## Usage + +## To Do (incoming!) + +## Credits +Dylan McIntyre + +## License +CameraKit-Android is [MIT licensed](https://github.com/wonderkiln/camerakit-android/blob/master/LICENSE). \ No newline at end of file diff --git a/camerakit/src/main/java/com/wonderkiln/camerakit/CameraView.java b/camerakit/src/main/java/com/wonderkiln/camerakit/CameraView.java index 6b9ef4b7..ccc371d5 100644 --- a/camerakit/src/main/java/com/wonderkiln/camerakit/CameraView.java +++ b/camerakit/src/main/java/com/wonderkiln/camerakit/CameraView.java @@ -20,7 +20,6 @@ import java.lang.annotation.RetentionPolicy; public class CameraView extends FrameLayout { public static final int FACING_BACK = Constants.FACING_BACK; - public static final int FACING_FRONT = Constants.FACING_FRONT; @IntDef({FACING_BACK, FACING_FRONT}) @@ -29,9 +28,7 @@ public class CameraView extends FrameLayout { } public static final int FLASH_OFF = Constants.FLASH_OFF; - public static final int FLASH_ON = Constants.FLASH_ON; - public static final int FLASH_AUTO = Constants.FLASH_AUTO; @Retention(RetentionPolicy.SOURCE) @@ -55,6 +52,8 @@ public class CameraView extends FrameLayout { private int mPictureMode; + private boolean mAdjustViewBounds; + private CameraListener mCameraListener; private DisplayOrientationDetector mDisplayOrientationDetector; @@ -123,16 +122,12 @@ public class CameraView extends FrameLayout { } public void stop() { - if (mCameraImpl != null) { - mCameraImpl.stop(); - } + mCameraImpl.stop(); } public void setFacing(@Facing int facing) { this.mFacing = facing; - if (mCameraImpl != null) { - mCameraImpl.setFacing(facing); - } + mCameraImpl.setFacing(facing); } @Facing @@ -152,9 +147,7 @@ public class CameraView extends FrameLayout { public void setFlash(@Flash int flash) { this.mFlash = flash; - if (mCameraImpl != null) { - mCameraImpl.setFlash(flash); - } + mCameraImpl.setFlash(flash); } @Flash diff --git a/demo/src/main/res/drawable/ic_flash.xml b/demo/src/main/res/drawable/ic_flash.xml new file mode 100644 index 00000000..a3c81cc3 --- /dev/null +++ b/demo/src/main/res/drawable/ic_flash.xml @@ -0,0 +1,9 @@ + + + diff --git a/demo/src/main/res/drawable/ic_photo.xml b/demo/src/main/res/drawable/ic_photo.xml new file mode 100644 index 00000000..c872f167 --- /dev/null +++ b/demo/src/main/res/drawable/ic_photo.xml @@ -0,0 +1,12 @@ + + + + diff --git a/demo/src/main/res/drawable/ic_switch.xml b/demo/src/main/res/drawable/ic_switch.xml new file mode 100644 index 00000000..d49ce20e --- /dev/null +++ b/demo/src/main/res/drawable/ic_switch.xml @@ -0,0 +1,9 @@ + + + diff --git a/demo/src/main/res/drawable/ic_video.xml b/demo/src/main/res/drawable/ic_video.xml new file mode 100644 index 00000000..e23eac81 --- /dev/null +++ b/demo/src/main/res/drawable/ic_video.xml @@ -0,0 +1,9 @@ + + + diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml index 168ab541..d243fa69 100644 --- a/demo/src/main/res/layout/activity_main.xml +++ b/demo/src/main/res/layout/activity_main.xml @@ -1,11 +1,213 @@ - + android:layout_height="match_parent" + android:background="@android:color/white"> - + android:layout_height="wrap_content" + android:descendantFocusability="beforeDescendants" + android:focusable="true" + android:focusableInTouchMode="true" + android:orientation="vertical"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +