Skip to content

Commit 353b19b

Browse files
committed
* release 1.0.19
* translation of About window to italian (Claudio Arseni) * Out-of-memory bug in image viewer on some devices - fix #27 * asynchronous loading of images on the full screen viewer
1 parent 518d43a commit 353b19b

File tree

9 files changed

+124
-65
lines changed

9 files changed

+124
-65
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
Change Log
22
==========
33

4+
version 1.0.19
5+
--------------
6+
7+
* translation of About window to italian (Claudio Arseni)
8+
* Out-of-memory bug in image viewer on some devices
9+
* asynchronous loading of images on the full screen viewer
10+
11+
version 1.0.18
12+
--------------
13+
14+
* translation of interface messages to italian (Claudio Arseni)
15+
* quick fix of UI bug
16+
417
version 1.0.17
518
--------------
619

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This little application provides a way on scanning handwritten notes and printed
55

66
It automatically detect the edge of the paper over a contrastant surface.
77

8-
If you have RocketBook Wave notebook or home printed pages it automatically detects the qrcode printed on the bottom right corner and scans the page immediately.
8+
When using the [printed special page template](https://github.com/ctodobom/OpenNoteScanner/raw/master/Page%20Templates/A4%20with%202%20pages.pdf) it automatically detects the QR Code printed on the bottom right corner and scans the page immediately.
99

1010
After the page is detected, it compensates any perspective from the image adjusting it to a 90 degree top view and saves it on a folder on the device.
1111

@@ -95,7 +95,26 @@ Contributing
9595

9696
If you have any idea, feel free to fork it and submit your changes back to me.
9797

98-
It is possible to backport this project to [OpenCV 2.4.8](https://github.com/vRallev/OpenCV) in a way that it can run on Android 4.4.2 (KitKat), this will demand a lot of rework on user interface code. If you know how to do it, it is a great contribution.
98+
Thanks
99+
------
100+
101+
### Contributors
102+
103+
As an open source application, contribution are always welcome. Everyone that submits any code will be listed here.
104+
105+
* Nicolas Raoul - English corrections
106+
* Claudio Arseni - Italian translation
107+
108+
Other people helped submitting [Issue Reports](https://github.com/ctodobom/OpenNoteScanner/issues) and giving info through the [Telegram Group](https://telegram.me/joinchat/CGzsxQgjl8CyAZNrTG0qZg). Their help is appreciated as well.
109+
110+
### External code
111+
112+
This application wouldn't be possible without the great material produced by the community. I would like to give special thanks to the authors of essencial parts I've got on the internet and used in the code:
113+
114+
* [Android-er / GridView code sample](http://android-er.blogspot.com.br/2012/07/gridview-loading-photos-from-sd-card.html)
115+
* [Android Hive / Full Screen Image pager](http://www.androidhive.info/2013/09/android-fullscreen-image-slider-with-swipe-and-pinch-zoom-gestures/)
116+
* [Adrian Rosebrock from pyimagesearch.com for the excellent tutorial on how to handle the images](http://www.pyimagesearch.com/2014/09/01/build-kick-ass-mobile-document-scanner-just-5-minutes/)
117+
* [Gabriele Mariotti / On how to implement sections in the RecyclerView](https://gist.github.com/gabrielemariotti/e81e126227f8a4bb339c)
99118

100119

101120
License

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "com.todobom.opennotescanner"
88
minSdkVersion 21
99
targetSdkVersion 23
10-
versionCode 18
11-
versionName '1.0.18'
10+
versionCode 19
11+
versionName '1.0.19'
1212
}
1313
buildTypes {
1414
release {

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
<!-- <android:uses-permission android:name="android.permission.READ_PHONE_STATE" /> -->
2323
<application
24+
android:largeHeap="true"
2425
android:allowBackup="true"
2526
android:icon="@mipmap/ic_launcher"
2627
android:label="@string/app_name"

app/src/main/assets/about-it.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Informazioni su Open Note Scanner
33

44
**© 20XX [Claudemir Todo Bom](http://todobom.com)**
55

6-
Questa applicazione offre una rapida soluzione per acquisire e archiviare note scritte a mano e disegni, oltre a liste della spesa e altri documenti. Supporta anche l'acquisizione automatica di immagini su una pagina pre-formattata.
6+
Questa applicazione offre una rapida soluzione per acquisire e archiviare note scritte a mano e disegni, oltre a liste della spesa e altri documenti. Supporta anche l'acquisizione automatica di immagini su una [pagina pre-formattata](https://github.com/ctodobom/OpenNoteScanner/raw/master/Page%20Templates/A4%20with%202%20pages.pdf).
77

88

99
Licenza
@@ -41,6 +41,17 @@ Questa applicazione contiene codice dai seguenti progetti esterni:
4141
Ringraziamenti
4242
--------------
4343

44+
### Contributori
45+
46+
Come applicazione open source, contributo sono sempre i benvenuti. Ognuno che presenta alcun codice saranno elencati qui.
47+
48+
* Nicolas Raoul - correzioni in inglese
49+
* Claudio Arseni - traduzione in italiano
50+
51+
Altre persone hanno aiutato la presentazione [Report Issue] (https://github.com/ctodobom/OpenNoteScanner/issues) e dando informazioni attraverso il [Gruppo Telegram] (https://telegram.me/joinchat/CGzsxQgjl8CyAZNrTG0qZg). Il loro aiuto è apprezzato pure.
52+
53+
### Codice esterno
54+
4455
Questa applicazione non sarebbe stata realizzabile senza il grande materiale prodotto dalla comunità. Uno speciale ringraziamento agli autori di parti essenziali che ho trovato su internet e di cui ho utilizzato il codice:
4556

4657
* [Android-er / esempi di codice per GridView](http://android-er.blogspot.com.br/2012/07/gridview-loading-photos-from-sd-card.html)

app/src/main/assets/about-pt.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Sobre o Open Note Scanner
33

44
**© 20XX [Claudemir Todo Bom](http://todobom.com)**
55

6-
Este aplicativo fornece uma maneira rápida para escanear e armazenar anotações, artes e também recibos e outros documentos. Ele também suporta a captura automática a partir de uma página pré-formatada.
6+
Este aplicativo fornece uma maneira rápida para escanear e armazenar anotações, artes e também recibos e outros documentos. Ele também suporta a captura automática a partir de uma [página pré-formatada](https://github.com/ctodobom/OpenNoteScanner/raw/master/Page%20Templates/A4%20with%202%20pages.pdf).
77

88
Licença
99
-------
@@ -40,6 +40,17 @@ O aplicativo inclui código das seguintes fontes:
4040
Agradecimentos
4141
--------------
4242

43+
### Colaboradores
44+
45+
Como uma aplicaçao de código aberto, contribuições são sempre bem vindas. Todos que contribuírem com código serão listados aqui:.
46+
47+
* Nicolas Raoul - Correções em Inglês
48+
* Claudio Arseni - Tradução para Italiano
49+
50+
Other people helped submitting [Issue Reports](https://github.com/ctodobom/OpenNoteScanner/issues) and giving info through the [Telegram Group](https://telegram.me/joinchat/CGzsxQgjl8CyAZNrTG0qZg). Their help is appreciated as well.
51+
52+
### Código de terceiros
53+
4354
Este aplicativo não seria possível sem o ótimo material produzido pela comunidade. Eu gostaria de dar agradecimentos especiais para os autores de partes essenciais que encontrei na internet e utilizei no código:
4455

4556
* [Android-er / Exemplo do código GridVew](http://android-er.blogspot.com.br/2012/07/gridview-loading-photos-from-sd-card.html)

app/src/main/assets/about.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ About Open Note Scanner
33

44
**© 20XX [Claudemir Todo Bom](http://todobom.com)**
55

6-
This application provides a quick way to scan and store hand written notes and arts, and also shopping receipts and other documents. It also supports automatic capture of images on a pre-formatted page.
6+
This application provides a quick way to scan and store hand written notes and arts, and also shopping receipts and other documents. It also supports automatic capture of images on a [pre-formatted page](https://github.com/ctodobom/OpenNoteScanner/raw/master/Page%20Templates/A4%20with%202%20pages.pdf).
77

88

99
License
@@ -41,6 +41,17 @@ Binary builds include code from these external projects:
4141
Thanks
4242
------
4343

44+
### Contributors
45+
46+
As an open source application, contribution are always welcome. Everyone that submits any code will be listed here.
47+
48+
* Nicolas Raoul - English corrections
49+
* Claudio Arseni - Italian translation
50+
51+
Other people helped submitting [Issue Reports](https://github.com/ctodobom/OpenNoteScanner/issues) and giving info through the [Telegram Group](https://telegram.me/joinchat/CGzsxQgjl8CyAZNrTG0qZg). Their help is appreciated as well.
52+
53+
### External code
54+
4455
This application wouldn't be possible without the great material produced by the community. I would like to give special thanks to the authors of essencial parts I've got on the internet and used in the code:
4556

4657
* [Android-er / GridView code sample](http://android-er.blogspot.com.br/2012/07/gridview-loading-photos-from-sd-card.html)

app/src/main/java/com/todobom/opennotescanner/FullScreenImageAdapter.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66

77
import android.app.Activity;
88
import android.content.Context;
9-
import android.graphics.Bitmap;
10-
import android.graphics.BitmapFactory;
119
import android.support.v4.view.PagerAdapter;
12-
import android.util.Log;
1310
import android.view.LayoutInflater;
1411
import android.view.View;
1512
import android.view.ViewGroup;
1613
import android.widget.RelativeLayout;
1714

15+
import com.nostra13.universalimageloader.core.ImageLoader;
16+
import com.nostra13.universalimageloader.core.assist.ImageSize;
1817
import com.todobom.opennotescanner.views.TouchImageView;
1918

2019
import java.util.ArrayList;
@@ -25,6 +24,8 @@ public class FullScreenImageAdapter extends PagerAdapter {
2524
private Activity _activity;
2625
private ArrayList<String> _imagePaths;
2726
private int maxTexture;
27+
private ImageLoader mImageLoader;
28+
private ImageSize mTargetSize;
2829

2930
// constructor
3031
public FullScreenImageAdapter(Activity activity,
@@ -54,9 +55,10 @@ public Object instantiateItem(ViewGroup container, int position) {
5455

5556
imgDisplay = (TouchImageView) viewLayout.findViewById(R.id.imgDisplay);
5657

58+
String imagePath = _imagePaths.get(position);
59+
/*
5760
BitmapFactory.Options options = new BitmapFactory.Options();
5861
options.inJustDecodeBounds = true;
59-
String imagePath = _imagePaths.get(position);
6062
BitmapFactory.decodeFile(imagePath, options);
6163
6264
int maxSize=Math.max(options.outHeight,options.outWidth);
@@ -75,8 +77,11 @@ public Object instantiateItem(ViewGroup container, int position) {
7577
7678
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
7779
Bitmap bitmap = BitmapFactory.decodeFile(imagePath, options);
80+
*/
81+
82+
// imgDisplay.setImageBitmap(bitmap);
83+
mImageLoader.displayImage("file:///"+imagePath, imgDisplay, mTargetSize);
7884

79-
imgDisplay.setImageBitmap(bitmap);
8085

8186
container.addView(viewLayout);
8287

@@ -96,7 +101,12 @@ public void destroyItem(ViewGroup container, int position, Object object) {
96101
container.removeView((RelativeLayout) object);
97102
}
98103

99-
public void setMaxTexture(int maxTexture) {
104+
public void setMaxTexture(int maxTexture, ImageSize targetSize) {
100105
this.maxTexture = maxTexture;
106+
mTargetSize = targetSize;
107+
}
108+
109+
public void setImageLoader(ImageLoader imageLoader) {
110+
mImageLoader = imageLoader;
101111
}
102112
}

app/src/main/java/com/todobom/opennotescanner/FullScreenViewActivity.java

Lines changed: 35 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -13,91 +13,74 @@
1313
import android.view.Menu;
1414
import android.view.MenuItem;
1515

16+
import com.nostra13.universalimageloader.core.ImageLoader;
17+
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
18+
import com.nostra13.universalimageloader.core.assist.ImageSize;
1619
import com.todobom.opennotescanner.helpers.AboutFragment;
1720
import com.todobom.opennotescanner.helpers.Utils;
1821

1922
import java.io.File;
2023

21-
2224
public class FullScreenViewActivity extends AppCompatActivity {
2325

2426
private Utils utils;
25-
private FullScreenImageAdapter adapter;
26-
private ViewPager viewPager;
27+
private FullScreenImageAdapter mAdapter;
28+
private ViewPager mViewPager;
2729
private AlertDialog.Builder deleteConfirmBuilder;
28-
// private Toolbar mToolbar;
30+
private ImageLoader mImageLoader;
31+
private ImageSize mTargetSize;
32+
private int mMaxTexture;
2933

3034
@Override
3135
protected void onCreate(Bundle savedInstanceState) {
3236
super.onCreate(savedInstanceState);
3337
setContentView(R.layout.activity_fullscreen_view);
3438

35-
viewPager = (ViewPager) findViewById(R.id.pager);
36-
37-
// mToolbar = (Toolbar) findViewById(R.id.FullImageViewToolbar);
38-
39-
// setDisplayHomeAsUpEnabled(true);
40-
41-
// setSupportActionBar(mToolbar);
39+
mViewPager = (ViewPager) findViewById(R.id.pager);
4240

4341
ActionBar actionBar = getSupportActionBar();
4442
actionBar.setDisplayShowHomeEnabled(true);
4543
actionBar.setTitle(null);
4644
actionBar.setDisplayHomeAsUpEnabled(true);
4745
actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_24dp);
4846

49-
/*
50-
51-
// close button click event
52-
Button btnClose = (Button) findViewById(R.id.btnClose);
53-
btnClose.setOnClickListener(new View.OnClickListener() {
54-
@Override
55-
public void onClick(View v) {
56-
FullScreenViewActivity.this.finish();
57-
}
58-
});
59-
60-
// */
61-
6247
utils = new Utils(getApplicationContext());
6348

6449
Intent i = getIntent();
6550
int position = i.getIntExtra("position", 0);
6651

67-
adapter = new FullScreenImageAdapter(FullScreenViewActivity.this,
68-
utils.getFilePaths());
69-
52+
// initialize Universal Image Loader
53+
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build();
54+
mImageLoader = ImageLoader.getInstance();
55+
mImageLoader.init(config);
7056

71-
int maxTexture = Utils.getMaxTextureSize();
57+
mMaxTexture = Utils.getMaxTextureSize();
58+
Log.d("FullScreenViewActivity", "gl resolution: " + mMaxTexture);
59+
mTargetSize = new ImageSize(mMaxTexture, mMaxTexture);
7260

73-
Log.d("FullScreenViewActivity", "gl resolution: " + maxTexture);
74-
75-
adapter.setMaxTexture(maxTexture);
76-
77-
viewPager.setAdapter(adapter);
61+
loadAdapter();
7862

7963
// displaying selected image first
80-
viewPager.setCurrentItem(position);
64+
mViewPager.setCurrentItem(position);
8165

82-
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
66+
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
8367
@Override
8468
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
8569
Log.d("fullview", "scrolled position " + position + " offset " + positionOffset);
86-
Log.d("fullview", "pager " + FullScreenViewActivity.this.viewPager.getCurrentItem());
70+
Log.d("fullview", "pager " + FullScreenViewActivity.this.mViewPager.getCurrentItem());
8771
}
8872

8973
@Override
9074
public void onPageSelected(int position) {
9175
Log.d("fullview", "selected");
92-
Log.d("fullview", "item" + FullScreenViewActivity.this.viewPager.getCurrentItem());
76+
Log.d("fullview", "item" + FullScreenViewActivity.this.mViewPager.getCurrentItem());
9377
}
9478

9579
@Override
9680
public void onPageScrollStateChanged(int state) {
9781
Log.d("fullview", "state changed");
9882
}
9983

100-
10184
});
10285

10386
deleteConfirmBuilder = new AlertDialog.Builder(this);
@@ -124,6 +107,14 @@ public void onClick(DialogInterface dialog, int which) {
124107

125108
}
126109

110+
private void loadAdapter() {
111+
mViewPager.setAdapter(null);
112+
mAdapter = new FullScreenImageAdapter(FullScreenViewActivity.this,
113+
utils.getFilePaths());
114+
mAdapter.setImageLoader(mImageLoader);
115+
mAdapter.setMaxTexture(mMaxTexture, mTargetSize);
116+
mViewPager.setAdapter(mAdapter);
117+
}
127118

128119
@Override
129120
public boolean onCreateOptionsMenu(Menu menu) {
@@ -159,36 +150,28 @@ public boolean onOptionsItemSelected(MenuItem item) {
159150
break;
160151
}
161152

162-
163153
return super.onOptionsItemSelected(item);
164154
}
165155

166156
private void deleteImage() {
167-
ViewPager pager = FullScreenViewActivity.this.viewPager;
168-
int item = pager.getCurrentItem();
169-
170-
final File photoFile = new File(adapter.getPath(item));
157+
int item = mViewPager.getCurrentItem();
171158

172-
// pager.removeViewAt(item);
159+
final File photoFile = new File(mAdapter.getPath(item));
173160

174161
photoFile.delete();
175162

176-
pager.setAdapter(null);
177-
adapter = new FullScreenImageAdapter(FullScreenViewActivity.this,
178-
utils.getFilePaths());
179-
180-
pager.setAdapter(adapter);
181-
163+
loadAdapter();
164+
mViewPager.setCurrentItem(item);
182165
}
183166

184167
public void shareImage() {
185168

186-
ViewPager pager = FullScreenViewActivity.this.viewPager;
169+
ViewPager pager = FullScreenViewActivity.this.mViewPager;
187170
int item = pager.getCurrentItem();
188171

189172
final Intent shareIntent = new Intent(Intent.ACTION_SEND);
190173
shareIntent.setType("image/jpg");
191-
final File photoFile = new File(adapter.getPath(item));
174+
final File photoFile = new File(mAdapter.getPath(item));
192175
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(photoFile));
193176
Log.d("Fullscreen","uri "+Uri.fromFile(photoFile));
194177
startActivity(Intent.createChooser(shareIntent, getString(R.string.share_snackbar)));

0 commit comments

Comments
 (0)