Skip to content

Commit 879242b

Browse files
authored
Merge pull request #4 from natario1/master
update library
2 parents 08884bc + 8196388 commit 879242b

File tree

8 files changed

+48
-9
lines changed

8 files changed

+48
-9
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
### v1.5.1
2+
3+
- Bug: byte array length for Frames was incorrect thanks to [@ssakhavi][ssakhavi] ([#205][205])
4+
- Bug: gestures were crashing in some conditions ([#222][222])
5+
- Bug: import correctly the ExifInterface library ([#222][222])
6+
- Updated dependencies thanks to [@caleb-allen][caleb-allen] ([#190][190])
7+
18
## v1.5.0
29

310
- New: set encoder for video recordings with `cameraVideoCodec` ([#174][174])
@@ -80,6 +87,8 @@ https://github.com/natario1/CameraView/compare/v1.2.3...v1.3.0
8087
[RobertoMorelos]: https://github.com/RobertoMorelos
8188
[RocketRider]: https://github.com/RocketRider
8289
[xp-vit]: https://github.com/xp-vit
90+
[caleb-allen]: https://github.com/caleb-allen
91+
[ssakhavi]: https://github.com/ssakhavi
8392

8493
[73]: https://github.com/natario1/CameraView/pull/73
8594
[80]: https://github.com/natario1/CameraView/pull/80
@@ -104,3 +113,6 @@ https://github.com/natario1/CameraView/compare/v1.2.3...v1.3.0
104113
[172]: https://github.com/natario1/CameraView/pull/172
105114
[173]: https://github.com/natario1/CameraView/pull/173
106115
[174]: https://github.com/natario1/CameraView/pull/174
116+
[190]: https://github.com/natario1/CameraView/pull/190
117+
[205]: https://github.com/natario1/CameraView/pull/205
118+
[222]: https://github.com/natario1/CameraView/pull/222

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ addressing most of the common issues and needs, and still leaving you with flexi
1212
See [CHANGELOG](https://github.com/natario1/CameraView/blob/master/CHANGELOG.md).
1313

1414
```groovy
15-
compile 'com.otaliastudios:cameraview:1.5.0'
15+
compile 'com.otaliastudios:cameraview:1.5.1'
1616
```
1717

1818
Make sure your project repositories include the `jcenter()`:

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
}
88

99
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.0.1'
10+
classpath 'com.android.tools.build:gradle:3.2.0-alpha15'
1111
// https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en
1212
// https://www.theguardian.com/technology/developer-blog/2016/dec/06/how-to-publish-an-android-library-a-mysterious-conversation
1313
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
@@ -25,7 +25,7 @@ allprojects {
2525
ext {
2626
compileSdkVersion = 27
2727
buildToolsVersion = "27.0.3"
28-
supportLibVersion = '27.1.0'
28+
supportLibVersion = '27.1.1'
2929
minSdkVersion = 15
3030
targetSdkVersion = 27
3131
}

cameraview/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'com.github.dcendents.android-maven'
33
apply plugin: 'com.jfrog.bintray'
44

55
// Required by bintray
6-
version = '1.5.0'
6+
version = '1.5.1'
77
group = 'com.otaliastudios'
88

99
//region android dependencies
@@ -48,7 +48,7 @@ dependencies {
4848
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
4949
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
5050

51-
implementation "com.android.support:exifinterface:$supportLibVersion"
51+
api "com.android.support:exifinterface:$supportLibVersion"
5252
implementation "com.android.support:support-annotations:$supportLibVersion"
5353
}
5454

@@ -178,7 +178,7 @@ apply plugin: 'jacoco'
178178

179179
def reportsDirectory = "$buildDir/reports/"
180180
jacoco {
181-
toolVersion = "0.7.4+"
181+
toolVersion = "0.8.1"
182182
reportsDir = file(reportsDirectory)
183183
}
184184

cameraview/src/main/java/com/otaliastudios/cameraview/FrameManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@ int allocate(int bitsPerPixel, Size previewSize) {
8888

8989
private int getBufferSize(int bitsPerPixel, Size previewSize) {
9090
long sizeInBits = previewSize.getHeight() * previewSize.getWidth() * bitsPerPixel;
91-
return (int) Math.ceil(sizeInBits / 8.0d) + 1;
91+
return (int) Math.ceil(sizeInBits / 8.0d);
9292
}
9393
}

cameraview/src/main/utils/com/otaliastudios/cameraview/CameraUtils.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.hardware.Camera;
99
import android.os.Handler;
1010
import android.support.annotation.UiThread;
11+
import android.support.annotation.WorkerThread;
1112
import android.support.media.ExifInterface;
1213

1314
import java.io.ByteArrayInputStream;
@@ -55,6 +56,19 @@ public static boolean hasCameraFacing(Context context, Facing facing) {
5556
}
5657

5758

59+
/**
60+
* Decodes an input byte array and outputs a Bitmap that is ready to be displayed.
61+
* The difference with {@link android.graphics.BitmapFactory#decodeByteArray(byte[], int, int)}
62+
* is that this cares about orientation, reading it from the EXIF header.
63+
*
64+
* @param source a JPEG byte array
65+
*/
66+
@SuppressWarnings("WeakerAccess")
67+
@WorkerThread
68+
public static void decodeBitmap(final byte[] source) {
69+
decodeBitmap(source, Integer.MAX_VALUE, Integer.MAX_VALUE);
70+
}
71+
5872
/**
5973
* Decodes an input byte array and outputs a Bitmap that is ready to be displayed.
6074
* The difference with {@link android.graphics.BitmapFactory#decodeByteArray(byte[], int, int)}
@@ -100,9 +114,21 @@ public void run() {
100114
}
101115

102116

117+
/**
118+
* Decodes an input byte array and outputs a Bitmap that is ready to be displayed.
119+
* The difference with {@link android.graphics.BitmapFactory#decodeByteArray(byte[], int, int)}
120+
* is that this cares about orientation, reading it from the EXIF header.
121+
*
122+
* The image is also downscaled taking care of the maxWidth and maxHeight arguments.
123+
*
124+
* @param source a JPEG byte array
125+
* @param maxWidth the max allowed width
126+
* @param maxHeight the max allowed height
127+
*/
103128
// TODO ignores flipping
104129
@SuppressWarnings({"SuspiciousNameCombination", "WeakerAccess"})
105-
/* for tests */ static Bitmap decodeBitmap(byte[] source, int maxWidth, int maxHeight) {
130+
@WorkerThread
131+
public static Bitmap decodeBitmap(byte[] source, int maxWidth, int maxHeight) {
106132
if (maxWidth <= 0) maxWidth = Integer.MAX_VALUE;
107133
if (maxHeight <= 0) maxHeight = Integer.MAX_VALUE;
108134
int orientation;

cameraview/src/main/views/com/otaliastudios/cameraview/ScrollGestureLayout.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ protected void onInitialize(Context context) {
2929
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
3030
boolean horizontal;
3131
LOG.i("onScroll:", "distanceX="+distanceX, "distanceY="+distanceY);
32+
if (e1 == null || e2 == null) return false; // Got some crashes about this.
3233
if (e1.getX() != mPoints[0].x || e1.getY() != mPoints[0].y) {
3334
// First step. We choose now if it's a vertical or horizontal scroll, and
3435
// stick to it for the whole gesture.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

0 commit comments

Comments
 (0)