Skip to content

Commit 9b5e736

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents a756fc1 + e9d722d commit 9b5e736

1 file changed

Lines changed: 108 additions & 5 deletions

File tree

readme.adoc

Lines changed: 108 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Android Document Scanner Library
22

3-
image::https://img.shields.io/badge/version-1.4-green.svg[]
3+
image::https://img.shields.io/badge/version-1.5-green.svg[]
44
image::https://img.shields.io/badge/minSDK-19-blue.svg[]
55
image::https://img.shields.io/badge/license-MIT-yellowgreen.svg[]
66

@@ -37,8 +37,8 @@ Add lines below to your *app* level build.gradle
3737

3838
[source,bourne]
3939
----
40-
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
41-
implementation 'com.github.mayuce:AndroidDocumentScanner:1.4'
40+
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
41+
implementation 'com.github.mayuce:AndroidDocumentScanner:1.5'
4242
----
4343

4444
And Sync the gradle
@@ -85,9 +85,112 @@ You can customize something in layout via ScannerConstants.
8585
public static String cropColor="#6666ff",backColor="#ff0000",progressColor="#331199"; // Default Colors
8686
public static boolean saveStorage=false; // Make it true if you need image in your storage.
8787
----
88+
89+
### (NEW) Version 1.5 Feature - Custom Scanner Activity!
90+
91+
With 1.5 version you have a feature to create your own Document Scanner Activity.
92+
You still can use old customization via ScannerConstants or you can create a new scanner activity for your layout.
93+
94+
#### HOW
95+
96+
* Place Scanner layout to your layout
97+
98+
[source,bourne]
99+
----
100+
<FrameLayout
101+
android:id="@+id/frameLayout"
102+
android:layout_width="match_parent"
103+
android:layout_height="0dp" --- * Set HERE *
104+
android:layout_weight="8" --- * Set HERE *
105+
android:layout_gravity="center"
106+
android:layout_margin="10dp">
107+
108+
<FrameLayout
109+
android:id="@+id/holderImageCrop"
110+
android:layout_width="match_parent"
111+
android:layout_height="match_parent"
112+
android:layout_gravity="center"
113+
android:layout_margin="10dp">
114+
115+
<ImageView
116+
android:id="@+id/imageView"
117+
android:layout_width="wrap_content"
118+
android:layout_height="wrap_content"
119+
android:layout_gravity="center"
120+
android:adjustViewBounds="true"/>
121+
</FrameLayout>
122+
123+
<com.labters.documentscanner.libraries.PolygonView
124+
android:id="@+id/polygonView"
125+
android:layout_width="match_parent"
126+
android:layout_height="match_parent"
127+
android:layout_gravity="center"
128+
android:visibility="gone"/>
129+
</FrameLayout>
130+
131+
----
132+
133+
* Extend your activity from DocumentScannerActivity
134+
* Provide values
135+
136+
[source,java]
137+
----
138+
@Override
139+
protected FrameLayout getHolderImageCrop() {
140+
return holderImageCrop;
141+
}
142+
143+
@Override
144+
protected ImageView getImageView() {
145+
return imageView;
146+
}
147+
148+
@Override
149+
protected PolygonView getPolygonView() {
150+
return polygonView;
151+
}
152+
153+
@Override
154+
protected Bitmap getBitmapImage() {
155+
return cropImage;
156+
}
157+
----
158+
159+
* Override methods
160+
161+
[source,java]
162+
----
163+
@Override
164+
protected void showProgressBar() {
165+
RelativeLayout rlContainer = findViewById(R.id.rlContainer);
166+
setViewInteract(rlContainer, false);
167+
progressBar.setVisibility(View.VISIBLE);
168+
}
169+
170+
@Override
171+
protected void hideProgressBar() {
172+
RelativeLayout rlContainer = findViewById(R.id.rlContainer);
173+
setViewInteract(rlContainer, true);
174+
progressBar.setVisibility(View.GONE);
175+
}
176+
177+
@Override
178+
protected void showError(CropperErrorType errorType) {
179+
switch (errorType) {
180+
case CROP_ERROR:
181+
Toast.makeText(this, ScannerConstants.cropError, Toast.LENGTH_LONG).show();
182+
break;
183+
}
184+
}
185+
----
186+
187+
And *after* setting your view call *startCropping()* method
188+
189+
If you have a trouble you can follow follow com.labters.documentscanner.ImageCropActivity for how to do that.
190+
88191
## TO-DO
89192

90-
Nothing
193+
I already tried it but I’ve lost myself in code and added many features. To make module simple I reverted them. When I have time I need to do some code clean-up.
91194

92195
## Thanks
93196

@@ -100,7 +203,7 @@ and
100203
----
101204
MIT License
102205
103-
Copyright (c) 2019 Muhammet Ali YUCE
206+
Copyright (c) 2020 Muhammet Ali YUCE
104207
105208
Permission is hereby granted, free of charge, to any person obtaining a copy
106209
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)