Basic demo app

pull/1/head
Dylan McIntyre 8 years ago
parent 7fbda858dc
commit be41269264
  1. 2
      .gitignore
  2. 36
      .idea/misc.xml
  3. 17
      README.md
  4. 17
      camerakit/src/main/java/com/wonderkiln/camerakit/CameraView.java
  5. 9
      demo/src/main/res/drawable/ic_flash.xml
  6. 12
      demo/src/main/res/drawable/ic_photo.xml
  7. 9
      demo/src/main/res/drawable/ic_switch.xml
  8. 9
      demo/src/main/res/drawable/ic_video.xml
  9. 214
      demo/src/main/res/layout/activity_main.xml

2
.gitignore vendored

@ -38,3 +38,5 @@ captures/
# Keystore files
*.jks
.idea

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.8 (2)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -1 +1,16 @@
# camerakit-android
## 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).

@ -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

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M7,2v11h3v9l7,-12h-4l4,-8z"/>
</vector>

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
<path
android:fillColor="#FF000000"
android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M20,4h-3.17L15,2L9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM15,15.5L15,13L9,13v2.5L5.5,12 9,8.5L9,11h6L15,8.5l3.5,3.5 -3.5,3.5z"/>
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M17,10.5V7c0,-0.55 -0.45,-1 -1,-1H4c-0.55,0 -1,0.45 -1,1v10c0,0.55 0.45,1 1,1h12c0.55,0 1,-0.45 1,-1v-3.5l4,4v-11l-4,4z"/>
</vector>

@ -1,11 +1,213 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@android:color/white">
<com.wonderkiln.camerakit.CameraView
android:id="@+id/camera"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="wrap_content"
android:descendantFocusability="beforeDescendants"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
</FrameLayout>
<com.wonderkiln.camerakit.CameraView
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="400dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="4">
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:backgroundTint="@color/colorPrimary"
android:src="@drawable/ic_photo"
android:tint="@android:color/white" />
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:backgroundTint="@color/colorPrimaryDark"
android:src="@drawable/ic_video"
android:tint="@android:color/white" />
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:backgroundTint="@color/colorPrimary"
android:src="@drawable/ic_flash"
android:tint="@android:color/white" />
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:backgroundTint="@color/colorPrimaryDark"
android:src="@drawable/ic_switch"
android:tint="@android:color/white" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:background="#cccccc" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
<View
android:layout_width="2.5dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="WIDTH"
android:textColor="@android:color/black"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="screen: 1080px"
android:textColor="@android:color/black"
android:textSize="11dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="pixels" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:gravity="center"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WRAP_CONTENT" />
<android.support.v7.widget.AppCompatCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="MATCH_PARENT" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
<View
android:layout_width="2.5dp"
android:layout_height="match_parent"
android:background="@color/colorPrimary" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="HEIGHT"
android:textColor="@android:color/black"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="screen: 1920px"
android:textColor="@android:color/black"
android:textSize="11dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="pixels" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:gravity="center"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WRAP_CONTENT" />
<android.support.v7.widget.AppCompatCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="MATCH_PARENT" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:backgroundTint="@color/colorPrimary"
android:text="Update parameters"
android:textColor="@android:color/white" />
</LinearLayout>
</LinearLayout>
</ScrollView>

Loading…
Cancel
Save