Skip to content

Commit 9788679

Browse files
authored
Version 21.3 (#8)
* Version 21.3 generated
1 parent 89a11f1 commit 9788679

File tree

3 files changed

+16
-79
lines changed

3 files changed

+16
-79
lines changed

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ dependencies {
3434
implementation 'androidx.core:core-ktx:1.3.2'
3535
implementation 'androidx.appcompat:appcompat:1.2.0'
3636
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
37-
implementation 'com.aspose:aspose-barcode-cloud:21.2.0'
38-
implementation 'com.google.android.material:material:1.2.1'
39-
testImplementation 'junit:junit:4.13.1'
37+
implementation 'com.aspose:aspose-barcode-cloud:21.3.0'
38+
implementation 'com.google.android.material:material:1.3.0'
39+
testImplementation 'junit:junit:4.13.2'
4040
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
4141
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
4242
}

app/src/main/java/com/example/asposebarcodecloud/MainActivity.kt

Lines changed: 11 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ import com.aspose.barcode.cloud.ApiException
4949
import com.aspose.barcode.cloud.api.BarcodeApi
5050
import com.aspose.barcode.cloud.model.EncodeBarcodeType
5151
import com.aspose.barcode.cloud.model.PresetType
52+
import com.aspose.barcode.cloud.requests.GetBarcodeGenerateRequest
53+
import com.aspose.barcode.cloud.requests.PostBarcodeRecognizeFromUrlOrContentRequest
5254
import com.google.android.material.snackbar.Snackbar
5355
import java.io.File
5456
import java.io.FileOutputStream
@@ -214,45 +216,12 @@ class MainActivity : AppCompatActivity() {
214216
smallerBmp.compress(Bitmap.CompressFormat.PNG, 100, output)
215217
}
216218

219+
val recognizeRequest = PostBarcodeRecognizeFromUrlOrContentRequest()
220+
recognizeRequest.preset = PresetType.HIGHPERFORMANCE.value
221+
recognizeRequest.image = tmpFile
217222
Thread {
218223
try {
219-
val recognized = api.postBarcodeRecognizeFromUrlOrContent(
220-
null,
221-
null,
222-
null,
223-
PresetType.HIGHPERFORMANCE.value,
224-
null,
225-
null,
226-
null,
227-
null,
228-
null,
229-
null,
230-
null,
231-
null,
232-
null,
233-
null,
234-
null,
235-
null,
236-
null,
237-
null,
238-
null,
239-
null,
240-
null,
241-
null,
242-
null,
243-
null,
244-
null,
245-
null,
246-
null,
247-
null,
248-
null,
249-
null,
250-
null,
251-
null,
252-
null,
253-
null,
254-
tmpFile
255-
)
224+
val recognized = api.postBarcodeRecognizeFromUrlOrContent(recognizeRequest)
256225

257226
runOnUiThread {
258227
stopRecognizeAnimation()
@@ -301,45 +270,13 @@ class MainActivity : AppCompatActivity() {
301270

302271
fun onBtnGenerateClick(@Suppress("UNUSED_PARAMETER") view: View) {
303272
val type: String = barcodeTypeSpinner.selectedItem.toString()
273+
val barcodeRequest = GetBarcodeGenerateRequest(type, barcodeTextEdit.text.toString())
274+
barcodeRequest.imageHeight = barcodeImgView.measuredHeight.toDouble()
275+
barcodeRequest.imageWidth = barcodeImgView.measuredWidth.toDouble()
276+
barcodeRequest.format = "png"
304277
Thread {
305278
try {
306-
val generated: File? = api.getBarcodeGenerate(
307-
type,
308-
barcodeTextEdit.text.toString(),
309-
null,
310-
null,
311-
null,
312-
null,
313-
null,
314-
null,
315-
null,
316-
null,
317-
null,
318-
null,
319-
null,
320-
null,
321-
null,
322-
null,
323-
barcodeImgView.measuredHeight.toDouble(),
324-
barcodeImgView.measuredWidth.toDouble(),
325-
null,
326-
null,
327-
null,
328-
null,
329-
null,
330-
null,
331-
null,
332-
null,
333-
null,
334-
null,
335-
null,
336-
null,
337-
null,
338-
null,
339-
null,
340-
null,
341-
"png"
342-
)
279+
val generated: File? = api.getBarcodeGenerate(barcodeRequest)
343280
runOnUiThread {
344281
val bitmap = BitmapFactory.decodeFile(generated!!.absolutePath)
345282
barcodeImgView.setImageBitmap(bitmap)

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
ext.kotlin_version = '1.4.30'
3+
ext.kotlin_version = '1.4.31'
44
repositories {
55
google()
66
jcenter()
77
}
88
dependencies {
99
classpath 'com.android.tools.build:gradle:4.1.2'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
10+
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version'
1111

1212
// NOTE: Do not place your application dependencies here; they belong
1313
// in the individual module build.gradle files

0 commit comments

Comments
 (0)