diff --git a/README.md b/README.md index 67d29d65..e887e238 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ CameraView is a well documented, high-level library that makes capturing picture

+```groovy +compile 'com.otaliastudios:cameraview:1.0.0' +``` + *This is a fork of [CameraKit-Android library](https://github.com/gogopop/CameraKit-Android), originally a fork of [Google's CameraView library](https://github.com/google/cameraview). The library at this point has been completely rewritten and refactored. See [below](#roadmap) for a list of what was done. This works better than any other library I have tried, and I would be grateful for any issue, suggestion or contribution.* ### Features @@ -33,10 +37,6 @@ CameraView is a well documented, high-level library that makes capturing picture - `CameraUtils` to help with Bitmaps and orientations - Lightweight, no dependencies, just support `ExifInterface` -### Setup - -For now, you must clone the repo and add it to your project. - # Docs - [Usage](#usage) @@ -473,7 +473,7 @@ These are still things that need to be done, off the top of my head: - [x] new Gestures framework to map gestures to camera controls - [x] heavily reduced dependencies - [ ] `Camera2` integration -- [ ] publish to bintray +- [x] publish to bintray - [ ] check onPause / onStop / onSaveInstanceState consistency - [ ] add a `setPreferredAspectRatio` API to choose the capture size. Preview size will adapt, and then, if let free, the CameraView will adapt as well - [ ] animate grid lines similar to stock camera app diff --git a/build.gradle b/build.gradle index 5a7fc30f..bed9eb31 100644 --- a/build.gradle +++ b/build.gradle @@ -6,9 +6,10 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:2.3.2' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + // https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en + // https://www.theguardian.com/technology/developer-blog/2016/dec/06/how-to-publish-an-android-library-a-mysterious-conversation + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' } } @@ -22,6 +23,7 @@ allprojects { ext { compileSdkVersion = 25 buildToolsVersion = "25.0.2" + supportLibVersion = '25.3.1' minSdkVersion = 15 targetSdkVersion = 25 } diff --git a/cameraview/build.gradle b/cameraview/build.gradle index d7e67bd8..5974906a 100644 --- a/cameraview/build.gradle +++ b/cameraview/build.gradle @@ -1,4 +1,10 @@ apply plugin: 'com.android.library' +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'com.jfrog.bintray' + +// Required by bintray +version = '1.0.0' +group = 'com.otaliastudios' android { compileSdkVersion rootProject.ext.compileSdkVersion @@ -8,7 +14,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 - versionName "0.1" + versionName project.version } buildTypes { release { @@ -25,7 +31,100 @@ android { } dependencies { - compile 'com.android.support:exifinterface:25.3.1' - compile 'com.android.support:support-annotations:25.3.1' + compile "com.android.support:exifinterface:$supportLibVersion" + compile "com.android.support:support-annotations:$supportLibVersion" } + +install { + repositories.mavenInstaller { + pom.project { + name 'CameraView' + description 'A well documented, high-level Android interface that makes capturing pictures ' + + 'and videos easy, addressing most of the common issues and needs.' + url 'https://github.com/natario1/CameraView' + + packaging 'aar' + groupId project.group + artifactId 'cameraview' + version project.version + + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + scm { + connection 'https://github.com/natario1/CameraView.git' + developerConnection 'https://github.com/natario1/CameraView.git' + url 'https://github.com/natario1/CameraView' + + } + developers { + developer { + id = 'natario' + name 'Natario' + } + } + } + } +} + +Properties props = new Properties() +props.load(project.rootProject.file('local.properties').newDataInputStream()) + +bintray { + // https://github.com/bintray/gradle-bintray-plugin + user = props.getProperty('bintray.user') + key = props.get('bintray.key') + configurations = ['archives'] + pkg { + repo = 'android' + name = 'CameraView' + licenses = ['Apache-2.0'] + vcsUrl = 'https://github.com/natario1/CameraView.git' + publish = true + override = true + version { + name = project.version + desc = 'CameraView v. '+project.version + released = new Date() + vcsTag = 'v'+project.version + } + } +} + +// From official sample https://github.com/bintray/bintray-examples/blob/master/gradle-aar-example/build.gradle +task sourcesJar(type: Jar) { + classifier = 'sources' + from android.sourceSets.main.java.sourceFiles +} + +task javadoc(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + classpath += project.files("${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar") + project.android.libraryVariants.all { variant -> + if (variant.name == 'release') { + classpath += files(variant.javaCompile.classpath) + } + } + exclude '**/BuildConfig.java' + exclude '**/R.java' + exclude '**/internal/**' +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives javadocJar + archives sourcesJar +} + +// export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home +// To deploy ./gradlew bintrayUpload + diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java index d264f229..f3948c1d 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java @@ -600,7 +600,7 @@ public class CameraView extends FrameLayout { * but you can take a look at {@link CameraOptions#isZoomSupported()}. * This will have no effect if called before the camera is opened. * - * Zoom value should be >= 0 and <= 1, where 1 will be the maximum available zoom. + * Zoom value should be between 0 and 1, where 1 will be the maximum available zoom. * If it's not, it will be capped. * * @param zoom value in [0,1] @@ -792,8 +792,8 @@ public class CameraView extends FrameLayout { * Starts an autofocus process at the given coordinates, with respect * to the view width and height. * - * @param x should be >= 0 and <= getWidth() - * @param y should be >= 0 and <= getHeight() + * @param x should be between 0 and getWidth() + * @param y should be between 0 and getHeight() */ public void startAutoFocus(float x, float y) { if (x < 0 || x > getWidth()) throw new IllegalArgumentException("x should be >= 0 and <= getWidth()"); @@ -1018,7 +1018,7 @@ public class CameraView extends FrameLayout { * @param file a file where the video will be saved * @param durationMillis video max duration * - * @throws IllegalArgumentException if durationMillis is < 500 milliseconds + * @throws IllegalArgumentException if durationMillis is less than 500 milliseconds */ public void startCapturingVideo(File file, long durationMillis) { if (durationMillis < 500) { @@ -1313,6 +1313,7 @@ public class CameraView extends FrameLayout { /** * This does nothing. * @deprecated + * @param focus no-op */ @Deprecated public void setFocus(@Focus int focus) { @@ -1321,6 +1322,7 @@ public class CameraView extends FrameLayout { /** * This does nothing. + * @return no-op * @deprecated */ @Deprecated @@ -1333,6 +1335,7 @@ public class CameraView extends FrameLayout { /** * This does nothing. * @deprecated + * @param method no-op */ @Deprecated public void setCaptureMethod(@Method int method) {} @@ -1341,6 +1344,7 @@ public class CameraView extends FrameLayout { /** * This does nothing. * @deprecated + * @param permissions no-op */ @Deprecated public void setPermissionPolicy(@Permissions int permissions) {} @@ -1352,6 +1356,7 @@ public class CameraView extends FrameLayout { * @see CameraConstants#ZOOM_OFF * @see CameraConstants#ZOOM_PINCH * + * @param zoom no-op * @deprecated use {@link #mapGesture(Gesture, int)} to map zoom control to gestures */ @Deprecated @@ -1361,6 +1366,7 @@ public class CameraView extends FrameLayout { /** * Gets the current zoom mode. + * @return no-op * @deprecated use {@link #mapGesture(Gesture, int)} to map zoom control to gestures */ @ZoomMode diff --git a/demo/build.gradle b/demo/build.gradle index ef165e2d..72c1e043 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -7,8 +7,8 @@ android { applicationId "com.otaliastudios.cameraview.demo" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 4 - versionName "1.0.3" + versionCode 1 + versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } @@ -22,7 +22,7 @@ android { dependencies { compile project(':cameraview') - compile 'com.android.support:appcompat-v7:25.2.0' + compile "com.android.support:appcompat-v7:$supportLibVersion" compile 'com.jakewharton:butterknife:8.4.0' annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' } diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml index e7e4a796..b0bb2fee 100644 --- a/demo/src/main/res/layout/activity_main.xml +++ b/demo/src/main/res/layout/activity_main.xml @@ -25,7 +25,6 @@ android:layout_height="400dp" android:layout_gravity="center_horizontal" android:keepScreenOn="true" - app:cameraZoomMode="off" app:cameraGrid="off" app:cameraCropOutput="false" app:cameraFacing="back"