Skip to content

Commit 7a6a7e1

Browse files
committed
V2.3.9 update
• Improved compatibility with Android 10 (and above versions). • Scanning and image processing engine updates. • Minor demo application and performance improvements.
1 parent 609da5b commit 7a6a7e1

File tree

14 files changed

+187
-156
lines changed

14 files changed

+187
-156
lines changed

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ proguard/
3636
# Android Studio Navigation editor temp files
3737
.navigation/
3838

39+
# Java hprof
40+
*.hprof
41+
3942
# Android Studio captures folder
4043
captures/
4144

@@ -52,11 +55,7 @@ captures/
5255
# Android Studio
5356
**/*.iml
5457
.idea
55-
output.json
56-
57-
#NDK
58-
obj/
59-
.externalNativeBuild
58+
output.json
6059

6160
# Keystore files
6261
# Uncomment the following line if you do not want to check your keystore files in.
@@ -85,3 +84,4 @@ fastlane/readme.md
8584
# license.key
8685

8786
keystore.properties
87+
easyscan.jks

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.0.1'
9+
classpath 'com.android.tools.build:gradle:4.1.2'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files
@@ -27,4 +27,4 @@ allprojects {
2727

2828
task clean(type: Delete) {
2929
delete rootProject.buildDir
30-
}
30+
}

easyScan/build.gradle

Lines changed: 89 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@ android {
4343
storeFile file("${rootDir}/demo.keystore.jks")
4444
storePassword '123456'
4545
}
46-
// Signing config which utilize external file properties
47-
easyscan {
48-
// keyAlias keystoreProperties['keyAlias']
49-
// keyPassword keystoreProperties['keyPassword']
50-
// storeFile file(keystoreProperties['storeFile'])
51-
// storePassword keystoreProperties['storePassword']
52-
}
5346
}
5447

5548
compileSdkVersion 30
@@ -64,7 +57,7 @@ android {
6457
targetSdkVersion 30
6558

6659
versionCode 46
67-
versionName "2.3.8." + versionCode.toString()
60+
versionName "2.3.9." + versionCode.toString()
6861

6962
// Add build version and git hash to bundle (.aab) file name.
7063
setProperty("archivesBaseName", "$project.name-v$versionCode-${gitHash}")
@@ -99,11 +92,62 @@ android {
9992
initWith release
10093
matchingFallbacks = ['release']
10194
// To run release under IDE
102-
signingConfig signingConfigs.easyscan
95+
signingConfig null // Will be override later
96+
}
97+
}
98+
99+
// Define flavors
100+
flavorDimensions 'stage'
101+
productFlavors {
102+
develop {
103+
dimension 'stage'
104+
}
105+
product {
106+
dimension 'stage'
107+
108+
repositories {
109+
maven {
110+
url 'http://repo.pixelnetica.com:8081/artifactory/libs-release'
111+
}
112+
}
113+
114+
// Using external file for app signing
115+
// Create a variable called keystorePropertiesFile, and initialize it to your
116+
// keystore.properties file, in the rootProject folder.
117+
def keystorePropertiesFile = rootProject.file("${projectDir}/keystore.properties")
118+
119+
try {
120+
keystorePropertiesFile.withInputStream { stream ->
121+
println "Configure signing flavor"
122+
123+
// Initialize a new Properties() object called keystoreProperties.
124+
def keystoreProperties = new Properties()
125+
126+
// Load your keystore.properties file into the keystoreProperties object.
127+
keystoreProperties.load(stream)
128+
129+
signingConfig = android.signingConfigs.create("${name}")
130+
signingConfig.keyAlias = keystoreProperties['keyAlias']
131+
signingConfig.keyPassword = keystoreProperties['keyPassword']
132+
signingConfig.storeFile = file(keystoreProperties['storeFile'])
133+
signingConfig.storePassword = keystoreProperties['storePassword']
134+
}
135+
} catch (IOException e) {
136+
println "Cannot read playstore properties"
137+
signingConfig null
138+
}
103139
}
140+
}
104141

142+
variantFilter { variant ->
143+
// To check for a certain build type, use variant.buildType.name == "<buildType>"
144+
if (variant.flavors[0].name == 'develop' && variant.buildType.name == 'playstore') {
145+
// Gradle ignores any variants that satisfy the conditions above.
146+
setIgnore(true)
147+
}
105148
}
106149

150+
107151
// Add build version to apk file name
108152
applicationVariants.all { variant ->
109153
variant.outputs.all {
@@ -112,31 +156,60 @@ android {
112156
}
113157
}
114158

159+
// Raise error of no signing config found
160+
task checkSigningConfig {
161+
doLast {
162+
android.applicationVariants.all { variant ->
163+
assert variant.signingConfig != null
164+
}
165+
}
166+
}
167+
168+
// Check signing configuration only for assembleProductPlaystore variant
169+
project.afterEvaluate {
170+
assembleProductPlaystore.dependsOn checkSigningConfig
171+
}
172+
115173
repositories{
116174
flatDir{
117175
dirs 'libs'
118176
}
119-
maven {
120-
url 'http://repo.pixelnetica.com:8081/artifactory/libs-release'
121-
}
122177
}
123178

124179
// Lookup dynamic libraries changes every 10 minutes
125180
configurations.all {
126181
resolutionStrategy.cacheChangingModulesFor 10, 'minutes'
182+
183+
// we work with the unreleased development version
184+
if (name.contains('develop')) {
185+
resolutionStrategy.dependencySubstitution.all { DependencySubstitution dependency ->
186+
if (dependency.requested instanceof ModuleComponentSelector) {
187+
ModuleComponentSelector selector = (ModuleComponentSelector) dependency.requested
188+
if (selector.group == 'com.pixelnetica.sdk' && selector.module == 'scanning-release') {
189+
def targetProject = findProject(':scanning')
190+
if (targetProject != null) {
191+
println "Substitute mobule for configuration $name"
192+
dependency.useTarget targetProject
193+
}
194+
}
195+
}
196+
}
197+
}
127198
}
128199

129200
// Command to refresh dependencies
130201
// gradlew.bat clean build --refresh-dependencies
131202

132203
dependencies {
133204
// Take release library "-SNAPSHOT" behavior: update every changes, not only version number
134-
implementation('com.pixelnetica.sdk:scanning-release:2.3.8') { changing = true }
205+
implementation('com.pixelnetica.sdk:scanning-release:2.3.9') { changing = true }
206+
207+
// Dependencies for develop stage
208+
developImplementation('androidx.exifinterface:exifinterface:1.3.2')
135209

136210
implementation "androidx.annotation:annotation:1.1.0"
137211
implementation "androidx.appcompat:appcompat:1.2.0"
138-
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
139-
implementation 'androidx.exifinterface:exifinterface:1.2.0'
140-
implementation 'com.google.android.material:material:1.2.1'
212+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
213+
implementation 'com.google.android.material:material:1.3.0'
141214
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
142215
}

easyScan/src/main/java/com/pixelnetica/easyscan/CropData.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,4 +393,3 @@ void expand() {
393393
points[3].y = Math.round(bounds.y);
394394
}
395395
}
396-

easyScan/src/main/java/com/pixelnetica/easyscan/DrawSector.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class DrawSector {
1515
private float startAngle;
1616
private float finishAngle;
1717
private Paint paint;
18-
18+
1919
public DrawSector(PointF center, float radius, float startAngle, float finishAngle, Paint paint)
2020
{
2121
this.center = new PointF();
@@ -25,12 +25,12 @@ public DrawSector(PointF center, float radius, float startAngle, float finishAng
2525
this.finishAngle = finishAngle;
2626
this.paint = paint;
2727
}
28-
28+
2929
public void setPainter(Paint paint)
3030
{
3131
this.paint = paint;
3232
}
33-
33+
3434
public void draw(Canvas canvas)
3535
{
3636
float sweepAngle = finishAngle - startAngle;
@@ -47,7 +47,7 @@ private RectF describedRect()
4747
center.x - radius,
4848
center.y - radius,
4949
center.x + radius,
50-
center.y + radius);
50+
center.y + radius);
5151
}
52-
52+
5353
}

easyScan/src/main/java/com/pixelnetica/easyscan/MainActivity.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -322,24 +322,22 @@ void onOpenImage() {
322322
}
323323

324324
void onTakePhoto() {
325-
final File fileSink = getCacheDir();
325+
final File fileSink = new File(getFilesDir(), "camera_files");
326+
fileSink.mkdirs();
326327

327328
// Query permissions and create directories
328329
RuntimePermissions.instance().runWithPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE,
329330
R.string.permission_query_write_storage,
330-
new RuntimePermissions.Callback() {
331-
@Override
332-
public void permissionRun(String permission, boolean granted) {
333-
if (granted && (fileSink.exists() || fileSink.mkdirs())) {
334-
// Common routine to start camera
335-
Intent intent = CameraActivity.newIntent(
336-
MainActivity.this,
337-
mIdentity.SdkFactory,
338-
fileSink.getAbsolutePath(),
339-
"camera-prefs",
340-
true);
341-
startActivityForResult(intent, TAKE_PHOTO);
342-
}
331+
(permission, granted) -> {
332+
if (granted && (fileSink.exists() || fileSink.mkdirs())) {
333+
// Common routine to start camera
334+
Intent intent = CameraActivity.newIntent(
335+
MainActivity.this,
336+
mIdentity.SdkFactory,
337+
fileSink.getAbsolutePath(),
338+
"camera-prefs",
339+
true);
340+
startActivityForResult(intent, TAKE_PHOTO);
343341
}
344342
});
345343
}

0 commit comments

Comments
 (0)