diff --git a/build.gradle b/build.gradle index 74b2ab0d..1ea4bd05 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } 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 // in the individual module build.gradle files diff --git a/camerakit/build.gradle b/camerakit/build.gradle index 767c6a86..0aca3977 100644 --- a/camerakit/build.gradle +++ b/camerakit/build.gradle @@ -11,7 +11,7 @@ android { buildToolsVersion "25.0.2" defaultConfig { - minSdkVersion 16 + minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" @@ -32,7 +32,7 @@ android { } 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' diff --git a/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java b/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java index 90be2924..184ac2f9 100644 --- a/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java +++ b/camerakit/src/main/java/com/flurgle/camerakit/CameraView.java @@ -122,23 +122,28 @@ public class CameraView extends FrameLayout { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (mAdjustViewBounds) { Size previewSize = getPreviewSize(); - if (getLayoutParams().width == LayoutParams.WRAP_CONTENT) { - int height = MeasureSpec.getSize(heightMeasureSpec); - float ratio = (float) height / (float) previewSize.getWidth(); - int width = (int) (previewSize.getHeight() * ratio); - super.onMeasure( - MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), - heightMeasureSpec - ); - return; - } else if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) { - int width = MeasureSpec.getSize(widthMeasureSpec); - float ratio = (float) width / (float) previewSize.getHeight(); - int height = (int) (previewSize.getWidth() * ratio); - super.onMeasure( - widthMeasureSpec, - MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY) - ); + if(previewSize != null) { + if (getLayoutParams().width == LayoutParams.WRAP_CONTENT) { + int height = MeasureSpec.getSize(heightMeasureSpec); + float ratio = (float) height / (float) previewSize.getWidth(); + int width = (int) (previewSize.getHeight() * ratio); + super.onMeasure( + MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), + heightMeasureSpec + ); + return; + } else if (getLayoutParams().height == LayoutParams.WRAP_CONTENT) { + int width = MeasureSpec.getSize(widthMeasureSpec); + float ratio = (float) width / (float) previewSize.getHeight(); + int height = (int) (previewSize.getWidth() * ratio); + super.onMeasure( + widthMeasureSpec, + MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY) + ); + return; + } + }else{ + super.onMeasure(widthMeasureSpec, heightMeasureSpec); return; } } diff --git a/demo/build.gradle b/demo/build.gradle index dc9a7a0c..1a7f45c7 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion "25.0.2" defaultConfig { applicationId "com.flurgle.camerakit.demo" - minSdkVersion 16 + minSdkVersion 15 targetSdkVersion 25 versionCode 2 versionName "1.0.1" @@ -21,7 +21,7 @@ android { dependencies { 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' annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' } diff --git a/demo/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml index 6bad6b6f..d347e804 100644 --- a/demo/src/main/AndroidManifest.xml +++ b/demo/src/main/AndroidManifest.xml @@ -3,7 +3,7 @@ package="com.flurgle.camerakit.demo"> - \ No newline at end of file + diff --git a/demo/src/main/java/com/flurgle/camerakit/demo/AutoUnfocusEditText.java b/demo/src/main/java/com/flurgle/camerakit/demo/AutoUnfocusEditText.java index c87b885e..3def38bd 100644 --- a/demo/src/main/java/com/flurgle/camerakit/demo/AutoUnfocusEditText.java +++ b/demo/src/main/java/com/flurgle/camerakit/demo/AutoUnfocusEditText.java @@ -1,12 +1,12 @@ package com.flurgle.camerakit.demo; import android.content.Context; +import android.support.v7.widget.AppCompatEditText; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.inputmethod.InputMethodManager; -import android.widget.EditText; -public class AutoUnfocusEditText extends EditText { +public class AutoUnfocusEditText extends AppCompatEditText { public AutoUnfocusEditText(Context context) { super(context); @@ -36,4 +36,4 @@ public class AutoUnfocusEditText extends EditText { imm.hideSoftInputFromWindow(getWindowToken(), 0); } -} \ No newline at end of file +} diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml index 4801771c..915f1c92 100644 --- a/demo/src/main/res/layout/activity_main.xml +++ b/demo/src/main/res/layout/activity_main.xml @@ -109,7 +109,7 @@ android:layout_marginLeft="3dp" android:text="CAPTURE METHOD" android:textColor="@android:color/black" - android:textSize="14dp" + android:textSize="14sp" android:textStyle="bold" /> + android:textSize="11sp" /> @@ -314,7 +314,7 @@ android:layout_marginLeft="3dp" android:text="HEIGHT" android:textColor="@android:color/black" - android:textSize="14dp" + android:textSize="14sp" android:textStyle="bold" /> + android:textSize="11sp" /> diff --git a/demo/src/main/res/layout/activity_preview.xml b/demo/src/main/res/layout/activity_preview.xml index 221e29fd..21b0f228 100644 --- a/demo/src/main/res/layout/activity_preview.xml +++ b/demo/src/main/res/layout/activity_preview.xml @@ -50,7 +50,7 @@ android:layout_marginLeft="3dp" android:text="NATIVE CAPTURE RESOLUTION" android:textColor="@android:color/black" - android:textSize="18dp" + android:textSize="18sp" android:textStyle="bold" /> + android:textSize="14.5sp" /> @@ -87,7 +87,7 @@ android:layout_marginLeft="3dp" android:text="ACTUAL RESOLUTION" android:textColor="@android:color/black" - android:textSize="18dp" + android:textSize="18sp" android:textStyle="bold" /> + android:textSize="14.5sp" /> @@ -124,7 +124,7 @@ android:layout_marginLeft="3dp" android:text="APPROX. UNCOMPRESSED SIZE" android:textColor="@android:color/black" - android:textSize="18dp" + android:textSize="18sp" android:textStyle="bold" /> + android:textSize="14.5sp" /> @@ -180,4 +180,4 @@ - \ No newline at end of file + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fb1fe53a..7c12d050 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME 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