Dylan McIntyre 8 years ago
commit 425fc07054
  1. 2
      build.gradle
  2. 4
      camerakit/build.gradle
  3. 39
      camerakit/src/main/java/com/flurgle/camerakit/CameraView.java
  4. 4
      demo/build.gradle
  5. 4
      demo/src/main/AndroidManifest.xml
  6. 6
      demo/src/main/java/com/flurgle/camerakit/demo/AutoUnfocusEditText.java
  7. 16
      demo/src/main/res/layout/activity_main.xml
  8. 16
      demo/src/main/res/layout/activity_preview.xml
  9. 2
      gradle/wrapper/gradle-wrapper.properties

@ -5,7 +5,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files

@ -11,7 +11,7 @@ android {
buildToolsVersion "25.0.2" buildToolsVersion "25.0.2"
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 15
targetSdkVersion 25 targetSdkVersion 25
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
@ -32,7 +32,7 @@ android {
} }
dependencies { dependencies {
compile 'com.android.support:appcompat-v7:25.0.1' compile 'com.android.support:appcompat-v7:25.2.0'
} }
apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle' apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'

@ -122,23 +122,28 @@ public class CameraView extends FrameLayout {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mAdjustViewBounds) { if (mAdjustViewBounds) {
Size previewSize = getPreviewSize(); Size previewSize = getPreviewSize();
if (getLayoutParams().width == LayoutParams.WRAP_CONTENT) { if(previewSize != null) {
int height = MeasureSpec.getSize(heightMeasureSpec); if (getLayoutParams().width == LayoutParams.WRAP_CONTENT) {
float ratio = (float) height / (float) previewSize.getWidth(); int height = MeasureSpec.getSize(heightMeasureSpec);
int width = (int) (previewSize.getHeight() * ratio); float ratio = (float) height / (float) previewSize.getWidth();
super.onMeasure( int width = (int) (previewSize.getHeight() * ratio);
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), super.onMeasure(
heightMeasureSpec MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
); heightMeasureSpec
return; );
} else if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) { return;
int width = MeasureSpec.getSize(widthMeasureSpec); } else if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) {
float ratio = (float) width / (float) previewSize.getHeight(); int width = MeasureSpec.getSize(widthMeasureSpec);
int height = (int) (previewSize.getWidth() * ratio); float ratio = (float) width / (float) previewSize.getHeight();
super.onMeasure( int height = (int) (previewSize.getWidth() * ratio);
widthMeasureSpec, super.onMeasure(
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY) widthMeasureSpec,
); MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
);
return;
}
}else{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return; return;
} }
} }

@ -5,7 +5,7 @@ android {
buildToolsVersion "25.0.2" buildToolsVersion "25.0.2"
defaultConfig { defaultConfig {
applicationId "com.flurgle.camerakit.demo" applicationId "com.flurgle.camerakit.demo"
minSdkVersion 16 minSdkVersion 15
targetSdkVersion 25 targetSdkVersion 25
versionCode 2 versionCode 2
versionName "1.0.1" versionName "1.0.1"
@ -21,7 +21,7 @@ android {
dependencies { dependencies {
compile project(':camerakit') compile project(':camerakit')
compile 'com.android.support:appcompat-v7:25.0.1' compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.jakewharton:butterknife:8.4.0' compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
} }

@ -3,7 +3,7 @@
package="com.flurgle.camerakit.demo"> package="com.flurgle.camerakit.demo">
<application <application
android:allowBackup="true" android:allowBackup="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
@ -26,4 +26,4 @@
</application> </application>
</manifest> </manifest>

@ -1,12 +1,12 @@
package com.flurgle.camerakit.demo; package com.flurgle.camerakit.demo;
import android.content.Context; import android.content.Context;
import android.support.v7.widget.AppCompatEditText;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
public class AutoUnfocusEditText extends EditText { public class AutoUnfocusEditText extends AppCompatEditText {
public AutoUnfocusEditText(Context context) { public AutoUnfocusEditText(Context context) {
super(context); super(context);
@ -36,4 +36,4 @@ public class AutoUnfocusEditText extends EditText {
imm.hideSoftInputFromWindow(getWindowToken(), 0); imm.hideSoftInputFromWindow(getWindowToken(), 0);
} }
} }

@ -109,7 +109,7 @@
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:text="CAPTURE METHOD" android:text="CAPTURE METHOD"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="14dp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
<RadioGroup <RadioGroup
@ -161,7 +161,7 @@
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:text="CROP OUTPUT" android:text="CROP OUTPUT"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="14dp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
<RadioGroup <RadioGroup
@ -216,7 +216,7 @@
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:text="WIDTH" android:text="WIDTH"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="14dp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
@ -226,7 +226,7 @@
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:text="screen: 1080px" android:text="screen: 1080px"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="11dp" /> android:textSize="11sp" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -250,7 +250,7 @@
android:gravity="center" android:gravity="center"
android:text="UPDATE" android:text="UPDATE"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="14dp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
</FrameLayout> </FrameLayout>
@ -314,7 +314,7 @@
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:text="HEIGHT" android:text="HEIGHT"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="14dp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
@ -324,7 +324,7 @@
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:text="screen: 1920px" android:text="screen: 1920px"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="11dp" /> android:textSize="11sp" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -348,7 +348,7 @@
android:gravity="center" android:gravity="center"
android:text="UPDATE" android:text="UPDATE"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="14dp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
</FrameLayout> </FrameLayout>

@ -50,7 +50,7 @@
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:text="NATIVE CAPTURE RESOLUTION" android:text="NATIVE CAPTURE RESOLUTION"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="18dp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
@ -59,7 +59,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="14.5dp" /> android:textSize="14.5sp" />
</LinearLayout> </LinearLayout>
@ -87,7 +87,7 @@
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:text="ACTUAL RESOLUTION" android:text="ACTUAL RESOLUTION"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="18dp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
@ -96,7 +96,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="14.5dp" /> android:textSize="14.5sp" />
</LinearLayout> </LinearLayout>
@ -124,7 +124,7 @@
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:text="APPROX. UNCOMPRESSED SIZE" android:text="APPROX. UNCOMPRESSED SIZE"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="18dp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
@ -161,7 +161,7 @@
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:text="CAPTURE LATENCY" android:text="CAPTURE LATENCY"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="18dp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
@ -170,7 +170,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:textSize="14.5dp" /> android:textSize="14.5sp" />
</LinearLayout> </LinearLayout>
@ -180,4 +180,4 @@
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

Loading…
Cancel
Save