Skip to content

Commit b4c9029

Browse files
authored
Merge pull request #66 from Ethereal-Developers-Inc/dev_v2.2.0
v2.2.0
2 parents d609aef + 9b306eb commit b4c9029

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2176
-535
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ app.*.map.json
4444

4545
key.properties
4646
android/app/key.jks
47+
local.properties

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"todo-tree.tree.scanMode": "open files"
3+
}

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# v2.2.0
2+
3+
### Changed
4+
5+
- Reduce margins during PDF export
6+
- Export location by default is Documents/OpenScan/PDF
7+
- Multi image picker UI
8+
- Change default export quality
9+
10+
### Fixed
11+
12+
- Image quality increased with lower file sizes
13+
- Improved edge detection
14+
- BW filter upgraded
15+
- Quick action icons show actual icons instead of generic icons
16+
117
# v2.1.0
218

319
### Changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ An open source app that enables users to scan hardcopies of documents or notes a
88

99
(Build instructions present at the bottom of the file)
1010

11+
<p align="center">
1112
<img src="https://github.com/Ethereal-Developers-Inc/OpenScan/blob/master/assets/scan_g.jpeg" height=400>
13+
</p>
1214

1315
# About this app
1416

@@ -50,17 +52,15 @@ We _differentiate_ our self from the rest of the apps in the market by:
5052
- flutter_scanner_cropper:
5153
- git:
5254
- url: https://github.com/Ethereal-Developers-Inc/flutter-scanner-plugin.git
55+
- ref: master
5356
- path: flutter_scanner_cropper/
5457
- cupertino_icons: ^0.1.3
55-
- flutter_absolute_path: ^1.0.6
56-
- flutter_full_pdf_viewer: ^1.0.6
5758
- flutter_speed_dial: ^1.2.5
5859
- focused_menu: ^1.0.1
59-
- image_picker: ^0.6.4
60-
- multi_image_picker: ^4.8.0
61-
- open_file: ^3.0.3
60+
- image_picker: ^0.8.4
61+
- open_file: ^3.2.1
6262
- path_provider: ^2.0.2
63-
- pdf: ^1.9.0
63+
- pdf: ^3.6.0
6464
- permission_handler: ^8.0.1
6565
- quick_actions: ^0.6.0+2
6666
- reorderables: ^0.3.2

android/app/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ if (flutterRoot == null) {
1313

1414
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1515
if (flutterVersionCode == null) {
16-
flutterVersionCode = '3'
16+
flutterVersionCode = '4'
1717
}
1818

1919
def flutterVersionName = localProperties.getProperty('flutter.versionName')
2020
if (flutterVersionName == null) {
21-
flutterVersionName = '2.1'
21+
flutterVersionName = '2.2'
2222
}
2323

2424
apply plugin: 'com.android.application'
@@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) {
3232
}
3333

3434
android {
35-
compileSdkVersion 29
35+
compileSdkVersion 30
3636

3737
sourceSets {
3838
main.java.srcDirs += 'src/main/kotlin'
@@ -45,7 +45,7 @@ android {
4545
defaultConfig {
4646
applicationId "com.ethereal.openscan"
4747
minSdkVersion 19
48-
targetSdkVersion 29
48+
targetSdkVersion 30
4949
versionCode flutterVersionCode.toInteger()
5050
versionName flutterVersionName
5151
}

android/app/src/main/AndroidManifest.xml

+7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@
3232
<meta-data android:name="flutterEmbedding" android:value="2" />
3333
</application>
3434

35+
<queries>
36+
<intent>
37+
<action android:name="android.media.action.IMAGE_CAPTURE" />
38+
</intent>
39+
</queries>
40+
3541
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
3642
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
3743
<uses-permission android:name="android.permission.CAMERA" />
44+
3845
</manifest>

android/app/src/main/res/raw/keep.xml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://github.com/flutter/flutter/issues/51455 -->
3+
<resources xmlns:tools="http://schemas.android.com/tools"
4+
tools:keep="@mipmap/gallery_action, @mipmap/normal_scan, @mipmap/quick_scan" />

android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.5.0'
9+
classpath 'com.android.tools.build:gradle:4.0.1'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}

android/gradle.properties

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2-
android.enableR8=true
32
android.useAndroidX=true
43
android.enableJetifier=true

android/gradle/wrapper/gradle-wrapper.properties

+1-1
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-5.6.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

android/scanlibrary/build.gradle

+13-42
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,24 @@
11
apply plugin: 'com.android.library'
2+
import org.apache.tools.ant.taskdefs.condition.Os
23

34
android {
4-
compileSdkVersion 29
5+
compileSdkVersion 30
6+
buildToolsVersion "29.0.3"
57

68
defaultConfig {
79
minSdkVersion 19
8-
targetSdkVersion 29
9-
versionCode 1
10-
versionName "1.0"
11-
ndk
12-
{
13-
moduleName "Scanner"
14-
}
15-
}
16-
sourceSets.main
17-
{
18-
jni.srcDirs = []
19-
jniLibs.srcDir 'src/main/libs'
20-
}
21-
buildTypes {
22-
release {
23-
minifyEnabled false
24-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25-
}
26-
}
27-
}
28-
29-
dependencies {
30-
implementation fileTree(include: ['*.jar'], dir: 'libs')
31-
implementation 'com.android.support:appcompat-v7:28.0.0'
32-
implementation 'com.android.support:support-v4:28.0.0'
33-
implementation 'com.android.support:design:28.0.0'
34-
}
35-
apply plugin: 'com.android.library'
36-
37-
android {
38-
compileSdkVersion 28
39-
buildToolsVersion "28.0.3"
40-
41-
defaultConfig {
42-
minSdkVersion 16
43-
targetSdkVersion 28
10+
targetSdkVersion 30
4411
versionCode 1
4512
versionName "1.0"
4613
ndk {
4714
moduleName "Scanner"
4815
}
4916
}
50-
sourceSets.main
51-
{
52-
jni.srcDirs = []
53-
jniLibs.srcDir 'src/main/libs'
54-
}
17+
sourceSets.main {
18+
jni.srcDirs = []
19+
jniLibs.srcDir 'src/main/libs'
20+
}
21+
5522
buildTypes {
5623
release {
5724
minifyEnabled false
@@ -64,4 +31,8 @@ android {
6431

6532
dependencies {
6633
implementation fileTree(dir: 'libs', include: ['*.jar'])
34+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
35+
36+
implementation 'com.github.bumptech.glide:glide:4.12.0'
37+
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
6738
}

android/scanlibrary/src/main/AndroidManifest.xml

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.scanlibrary" >
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.scanlibrary">
43
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
54
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
6-
<application
7-
android:allowBackup="true"
8-
android:largeHeap="true"
9-
android:hardwareAccelerated="true" >
10-
<activity
11-
android:name=".ScanActivity"
12-
android:configChanges="orientation|screenSize"
13-
android:screenOrientation="portrait" >
5+
<application android:allowBackup="true" android:largeHeap="true" android:hardwareAccelerated="true">
6+
<activity android:name=".ScanActivity" android:configChanges="orientation|screenSize" android:screenOrientation="portrait">
147
</activity>
158
</application>
169

android/scanlibrary/src/main/java/com/scanlibrary/ResultFragment.java

+21-20
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import android.content.Intent;
77
import android.graphics.Bitmap;
88
import android.graphics.BitmapFactory;
9-
import android.net.Uri;
109
import android.os.AsyncTask;
1110
import android.os.Bundle;
1211
import android.util.Log;
@@ -15,9 +14,8 @@
1514
import android.view.ViewGroup;
1615
import android.widget.Button;
1716
import android.widget.ImageView;
18-
import android.widget.Toast;
1917

20-
import java.io.IOException;
18+
import com.bumptech.glide.Glide;
2119

2220
/**
2321
* Created by jhansi on 29/03/15.
@@ -55,25 +53,28 @@ private void init() {
5553
grayModeButton.setOnClickListener(new GrayButtonClickListener());
5654
bwButton = (Button) view.findViewById(R.id.BWMode);
5755
bwButton.setOnClickListener(new BWButtonClickListener());
58-
Bitmap bitmap = getBitmap();
59-
original = bitmap;
60-
setScannedImage(bitmap);
56+
original = getBitmap();
6157
doneButton = (Button) view.findViewById(R.id.doneButton);
6258
doneButton.setOnClickListener(new DoneButtonClickListener());
59+
setScannedImage(original);
6360
}
6461

6562
private Bitmap getBitmap() {
66-
Bitmap bitmap = BitmapFactory.decodeFile(getPath());
67-
return bitmap;
63+
return BitmapFactory.decodeFile(getPath());
6864
}
6965

7066
private String getPath() {
71-
String path = getArguments().getString(ScanConstants.SCANNED_RESULT);
72-
return path;
67+
return getArguments().getString(ScanConstants.SCANNED_RESULT);
68+
}
69+
70+
private boolean getShouldCompress() {
71+
String shouldCompressStr = getArguments().getString(ScanConstants.SHOULD_COMPRESS);
72+
boolean shouldCompressBoolean = Boolean.parseBoolean(shouldCompressStr);
73+
return shouldCompressBoolean;
7374
}
7475

7576
public void setScannedImage(Bitmap scannedImage) {
76-
scannedImageView.setImageBitmap(scannedImage);
77+
Glide.with(this).load(scannedImage).into(scannedImageView);
7778
}
7879

7980
private class DoneButtonClickListener implements View.OnClickListener {
@@ -90,8 +91,8 @@ public void run() {
9091
if (bitmap == null) {
9192
bitmap = original;
9293
}
93-
uri = Utils.getUri(bitmap, getPath());
94-
94+
uri = Utils.getUri(bitmap, getPath(), getShouldCompress());
95+
9596
Log.d("onDoneButtonClickUri", uri);
9697
data.putExtra(ScanConstants.SCANNED_RESULT, uri);
9798
getActivity().setResult(Activity.RESULT_OK, data);
@@ -126,7 +127,7 @@ public void run() {
126127
@Override
127128
public void run() {
128129
transformed = original;
129-
scannedImageView.setImageBitmap(original);
130+
setScannedImage(original);
130131
e.printStackTrace();
131132
dismissDialog();
132133
onClick(v);
@@ -136,7 +137,7 @@ public void run() {
136137
getActivity().runOnUiThread(new Runnable() {
137138
@Override
138139
public void run() {
139-
scannedImageView.setImageBitmap(transformed);
140+
setScannedImage(transformed);
140141
dismissDialog();
141142
}
142143
});
@@ -159,7 +160,7 @@ public void run() {
159160
@Override
160161
public void run() {
161162
transformed = original;
162-
scannedImageView.setImageBitmap(original);
163+
setScannedImage(original);
163164
e.printStackTrace();
164165
dismissDialog();
165166
onClick(v);
@@ -169,7 +170,7 @@ public void run() {
169170
getActivity().runOnUiThread(new Runnable() {
170171
@Override
171172
public void run() {
172-
scannedImageView.setImageBitmap(transformed);
173+
setScannedImage(transformed);
173174
dismissDialog();
174175
}
175176
});
@@ -184,7 +185,7 @@ public void onClick(View v) {
184185
try {
185186
showProgressDialog(getResources().getString(R.string.applying_filter));
186187
transformed = original;
187-
scannedImageView.setImageBitmap(original);
188+
setScannedImage(original);
188189
dismissDialog();
189190
} catch (OutOfMemoryError e) {
190191
e.printStackTrace();
@@ -207,7 +208,7 @@ public void run() {
207208
@Override
208209
public void run() {
209210
transformed = original;
210-
scannedImageView.setImageBitmap(original);
211+
setScannedImage(original);
211212
e.printStackTrace();
212213
dismissDialog();
213214
onClick(v);
@@ -217,7 +218,7 @@ public void run() {
217218
getActivity().runOnUiThread(new Runnable() {
218219
@Override
219220
public void run() {
220-
scannedImageView.setImageBitmap(transformed);
221+
setScannedImage(transformed);
221222
dismissDialog();
222223
}
223224
});

android/scanlibrary/src/main/java/com/scanlibrary/ScanActivity.java

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ private void init() {
2626
Bundle bundle = new Bundle();
2727
bundle.putString(ScanConstants.SELECTED_BITMAP, getImagePath());
2828
bundle.putString(ScanConstants.TEMP_DIR, getAppDocDirPath());
29+
bundle.putString(ScanConstants.SHOULD_COMPRESS, getShouldCompress());
2930
fragment.setArguments(bundle);
3031
android.app.FragmentManager fragmentManager = getFragmentManager();
3132
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
@@ -43,13 +44,19 @@ private String getAppDocDirPath() {
4344
Log.d("onGetAppDocDirPath", path);
4445
return path;
4546
}
47+
48+
private String getShouldCompress() {
49+
String shouldCompressStr = getIntent().getStringExtra(ScanConstants.SHOULD_COMPRESS);
50+
return shouldCompressStr;
51+
}
4652

4753
@Override
4854
public void onScanFinish(String path) {
4955
ResultFragment fragment = new ResultFragment();
5056
Bundle bundle = new Bundle();
5157
bundle.putString(ScanConstants.SCANNED_RESULT, path);
5258
bundle.putString(ScanConstants.TEMP_DIR, getAppDocDirPath());
59+
bundle.putString(ScanConstants.SHOULD_COMPRESS, getShouldCompress());
5360
fragment.setArguments(bundle);
5461
android.app.FragmentManager fragmentManager = getFragmentManager();
5562
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

android/scanlibrary/src/main/java/com/scanlibrary/ScanConstants.java

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ public class ScanConstants {
1111
public final static String SELECTED_BITMAP = "selectedBitmap";
1212
public final static String TEMP_DIR = "appDocDir";
1313
public final static String IMAGE_PATH = "imagePath";
14+
public final static String SHOULD_COMPRESS = "shouldCompress";
1415
}

0 commit comments

Comments
 (0)