Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Commit

Permalink
Start working on 1.9.7 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Dushyanth Maguluru committed Aug 3, 2017
1 parent a526e66 commit c446d6e
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 27 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log

## [1.9.6] - July 28, 2017
## [1.9.7] - August 2, 2017
* Fix everything that was broken since 1.9.5 (Relevant issues: #336, #315, #339, #338)

## [1.9.6] - August 1, 2017
* Revert changes from 1.9.5 as it causes more harm than good (See #336)

## [1.9.5] - July 28, 2017
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Installation

Add the following dependency to your build.gradle file.

`compile 'me.dm7.barcodescanner:zxing:1.9.6'`
`compile 'me.dm7.barcodescanner:zxing:1.9.7'`

Simple Usage
------------
Expand Down Expand Up @@ -126,7 +126,7 @@ Installation

Add the following dependency to your build.gradle file.

`compile 'me.dm7.barcodescanner:zbar:1.9.6'`
`compile 'me.dm7.barcodescanner:zbar:1.9.7'`

Simple Usage
------------
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {

allprojects {
group = 'me.dm7.barcodescanner'
version = '1.9.6'
version = '1.9.7'

repositories {
mavenCentral()
Expand Down Expand Up @@ -44,8 +44,8 @@ subprojects {
defaultConfig {
minSdkVersion versions.min_sdk
targetSdkVersion versions.target_sdk
versionCode 196
versionName "1.9.6"
versionCode 197
versionName "1.9.7"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,30 +307,30 @@ public void setAspectTolerance(float aspectTolerance) {
}

public byte[] getRotatedData(byte[] data, Camera camera) {
if (DisplayUtils.getScreenOrientation(getContext()) == Configuration.ORIENTATION_PORTRAIT) {
Camera.Parameters parameters = camera.getParameters();
Camera.Size size = parameters.getPreviewSize();
int width = size.width;
int height = size.height;
Camera.Parameters parameters = camera.getParameters();
Camera.Size size = parameters.getPreviewSize();
int width = size.width;
int height = size.height;

int displayOrientation = mPreview.getDisplayOrientation();

int rotationCount = 1;
int rotationCount = getRotationCount();

if(rotationCount == 1 || rotationCount == 3) {
for (int i = 0; i < rotationCount; i++) {
byte[] rotatedData = new byte[data.length];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++)
rotatedData[x * height + height - y - 1] = data[x + y * width];
}
int tmp = width;
width = height;
height = tmp;
data = rotatedData;
}
}

return data;
}

public int getRotationCount() {
int displayOrientation = mPreview.getDisplayOrientation();
return displayOrientation / 90;
}
}

2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ext.versions = [
build_tools : "25.0.2",
support_lib : "25.3.1",
zxing : "3.3.0",
barcodescanner: "1.9.6"
barcodescanner: "1.9.7"
]

ext.libraries = [
Expand Down
4 changes: 2 additions & 2 deletions zbar-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: 'com.android.application'

dependencies {
//compile project(":zbar")
compile libraries.barcodescanner_zbar
compile project(":zbar")
//compile libraries.barcodescanner_zbar
compile libraries.support_v4
compile libraries.appcompat_v7
compile libraries.design_support
Expand Down
4 changes: 2 additions & 2 deletions zbar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ext {
}

dependencies {
//compile project(":core")
compile libraries.barcodescanner_core
compile project(":core")
//compile libraries.barcodescanner_core
compile fileTree(dir: 'libs', include: '*.jar')
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.dm7.barcodescanner.zbar;

import android.content.Context;
import android.graphics.Rect;
import android.hardware.Camera;
import android.os.Handler;
import android.os.Looper;
Expand Down Expand Up @@ -83,11 +84,18 @@ public void onPreviewFrame(byte[] data, Camera camera) {
Camera.Size size = parameters.getPreviewSize();
int width = size.width;
int height = size.height;

int rotationCount = getRotationCount();
if(rotationCount == 1 || rotationCount == 3) {
int tmp = width;
width = height;
height = tmp;
}
data = getRotatedData(data, camera);

Rect rect = getFramingRectInPreview(width, height);
Image barcode = new Image(width, height, "Y800");
barcode.setData(data);
barcode.setCrop(rect.left, rect.top, rect.width(), rect.height());

int result = mScanner.scanImage(barcode);

Expand Down
4 changes: 2 additions & 2 deletions zxing-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: 'com.android.application'

dependencies {
//compile project(":zxing")
compile libraries.barcodescanner_zxing
compile project(":zxing")
//compile libraries.barcodescanner_zxing
compile libraries.support_v4
compile libraries.appcompat_v7
compile libraries.design_support
Expand Down
4 changes: 2 additions & 2 deletions zxing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ext {
}

dependencies {
//compile project(":core")
compile libraries.barcodescanner_core
compile project(":core")
//compile libraries.barcodescanner_core
compile libraries.zxing_core
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ public void onPreviewFrame(byte[] data, Camera camera) {
Camera.Size size = parameters.getPreviewSize();
int width = size.width;
int height = size.height;
int rotationCount = getRotationCount();
if(rotationCount == 1 || rotationCount == 3) {
int tmp = width;
width = height;
height = tmp;
}

data = getRotatedData(data, camera);

Expand Down

0 comments on commit c446d6e

Please sign in to comment.