Skip to content

Commit 6723e04

Browse files
Release 23.1 (#19)
* Update base project for demo_app Update dependencies * Fix getting images for recognition * Cleanup manifest * Update version to 23.1 * Add blog.aspose.cloud to good url * Gitignore cleanup --------- Co-authored-by: Denis Averin <[email protected]>
1 parent 7cc1e1c commit 6723e04

File tree

17 files changed

+411
-66
lines changed

17 files changed

+411
-66
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# macOS
2+
.DS_Store
3+
14
# Built application files
25
*.apk
36
*.ap_
@@ -33,6 +36,7 @@ proguard/
3336
captures/
3437

3538
# Intellij
39+
.idea/
3640
*.iml
3741

3842
# Keystore files

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Aspose Pty Ltd
3+
Copyright (c) 2023 Aspose Pty Ltd
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ All Aspose.BarCode for Cloud SDKs, helper scripts and templates are licensed und
101101
| [GitHub](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-dotnet) | [GitHub](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java) | [GitHub](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php) | [GitHub](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-python) | [GitHub](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-node) | [GitHub](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-android) |[GitHub](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-go)|
102102
| [NuGet](https://www.nuget.org/packages/Aspose.barcode-Cloud/) | [Maven](https://repository.aspose.cloud/webapp/#/artifacts/browse/tree/General/repo/com/aspose/aspose-barcode-cloud) | [Composer](https://packagist.org/packages/aspose/barcode-cloud-php) | [PIP](https://pypi.org/project/aspose-barcode-cloud/) | [NPM](https://www.npmjs.com/package/aspose-barcode-cloud-node) | [Maven](https://repository.aspose.cloud/webapp/#/artifacts/browse/tree/General/repo/com/aspose/aspose-barcode-cloud) |[Go.Dev](https://pkg.go.dev/github.com/aspose-barcode-cloud/aspose-barcode-cloud-go/) |
103103

104-
[Product Page](https://products.aspose.cloud/barcode/) | [Documentation](https://docs.aspose.cloud/display/barcodecloud/Home) | [API Reference](https://apireference.aspose.cloud/barcode/) | [Code Samples](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-android) | [Blog](https://blog.aspose.cloud/category/barcode/) | [Free Support](https://forum.aspose.cloud/c/barcode) | [Free Trial](https://dashboard.aspose.cloud/#/apps)
104+
[Product Page](https://products.aspose.cloud/barcode/) | [Documentation](https://docs.aspose.cloud/display/barcodecloud/Home) | [API Reference](https://apireference.aspose.cloud/barcode/) | [Code Samples](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-android) | [Blog](https://blog.aspose.cloud/categories/aspose.barcode-cloud-product-family/) | [Free Support](https://forum.aspose.cloud/c/barcode) | [Free Trial](https://dashboard.aspose.cloud/#/apps)

app/build.gradle

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
apply plugin: 'com.android.application'
2-
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
}
45

56
android {
6-
compileSdkVersion 30
7-
buildToolsVersion "30.0.1"
7+
namespace 'com.aspose.barcode.cloud.demo_app'
8+
compileSdk 33
89

910
defaultConfig {
10-
applicationId "com.example.asposebarcodecloud"
11-
minSdkVersion 23
12-
targetSdkVersion 30
11+
applicationId "com.aspose.barcode.cloud.demo_app"
12+
minSdk 23
13+
targetSdk 33
1314
versionCode 1
1415
versionName "1.0"
1516

@@ -22,21 +23,29 @@ android {
2223
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2324
}
2425
}
26+
compileOptions {
27+
sourceCompatibility JavaVersion.VERSION_1_8
28+
targetCompatibility JavaVersion.VERSION_1_8
29+
}
30+
kotlinOptions {
31+
jvmTarget = '1.8'
2532
}
26-
27-
repositories {
28-
maven { url 'https://repository.aspose.cloud/repo/' }
33+
buildFeatures {
34+
viewBinding true
35+
}
2936
}
3037

3138
dependencies {
32-
implementation fileTree(dir: "libs", include: ["*.jar"])
39+
implementation fileTree(dir: "libs", include: ["*.jar"])
3340
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
34-
implementation 'androidx.core:core-ktx:1.3.2'
35-
implementation 'androidx.appcompat:appcompat:1.2.0'
36-
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
37-
implementation 'com.aspose:aspose-barcode-cloud:22.8.0'
38-
implementation 'com.google.android.material:material:1.3.0'
41+
implementation 'androidx.core:core-ktx:1.9.0'
42+
implementation 'androidx.appcompat:appcompat:1.6.0'
43+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
44+
implementation 'com.aspose:aspose-barcode-cloud:23.1.0'
45+
implementation 'com.google.android.material:material:1.8.0'
46+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
47+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
3948
testImplementation 'junit:junit:4.13.2'
40-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
41-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
49+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
50+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
4251
}

app/src/main/AndroidManifest.xml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.example.asposebarcodecloud">
3+
package="com.aspose.barcode.cloud.demo_app">
44

55
<uses-permission android:name="android.permission.INTERNET" />
6-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
6+
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
7+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
8+
android:maxSdkVersion="32" />
79

8-
<uses-feature
9-
android:name="android.hardware.camera"
10-
android:required="false" />
10+
<queries>
11+
<!-- Camera -->
12+
<intent>
13+
<action android:name="android.media.action.IMAGE_CAPTURE" />
14+
</intent>
15+
16+
<!-- Gallery -->
17+
<intent>
18+
<action android:name="android.intent.action.GET_CONTENT" />
19+
</intent>
20+
</queries>
1121

1222
<application
1323
android:allowBackup="true"
@@ -17,7 +27,8 @@
1727
android:roundIcon="@mipmap/ic_launcher_round"
1828
android:supportsRtl="true"
1929
android:theme="@style/AppTheme">
20-
<activity android:name=".MainActivity">
30+
<activity android:name=".MainActivity"
31+
android:exported="true">
2132
<intent-filter>
2233
<action android:name="android.intent.action.MAIN" />
2334

@@ -26,4 +37,4 @@
2637
</activity>
2738
</application>
2839

29-
</manifest>
40+
</manifest>

app/src/main/java/com/example/asposebarcodecloud/MainActivity.kt renamed to app/src/main/java/com/aspose/barcode/cloud/demo_app/MainActivity.kt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* --------------------------------------------------------------------------------
33
* <copyright company="Aspose">
4-
* Copyright (c) 2022 Aspose.BarCode for Cloud
4+
* Copyright (c) 2023 Aspose.BarCode for Cloud
55
* </copyright>
66
* <summary>
77
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -25,7 +25,7 @@
2525
* --------------------------------------------------------------------------------
2626
*/
2727

28-
package com.example.asposebarcodecloud
28+
package com.aspose.barcode.cloud.demo_app
2929

3030
import android.Manifest
3131
import android.app.Activity
@@ -56,6 +56,7 @@ import java.io.File
5656
import java.io.FileOutputStream
5757
import kotlin.math.floor
5858

59+
5960
class MainActivity : AppCompatActivity() {
6061
companion object {
6162
const val PERMISSION_REQUEST_CALLBACK_CODE = 1
@@ -150,11 +151,12 @@ class MainActivity : AppCompatActivity() {
150151
requestCode: Int,
151152
permissions: Array<String>, grantResults: IntArray
152153
) {
154+
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
153155
when (requestCode) {
154156
PERMISSION_REQUEST_CALLBACK_CODE -> {
155157
// If request is cancelled, the result arrays are empty.
156158
if ((grantResults.isNotEmpty() &&
157-
grantResults[0] == PackageManager.PERMISSION_GRANTED)
159+
grantResults[0] == PackageManager.PERMISSION_GRANTED)
158160
) {
159161
// Permission is granted. Continue the action or workflow
160162
// in your app.
@@ -178,6 +180,7 @@ class MainActivity : AppCompatActivity() {
178180
}
179181
}
180182

183+
181184
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
182185
super.onActivityResult(requestCode, resultCode, data)
183186

@@ -194,15 +197,16 @@ class MainActivity : AppCompatActivity() {
194197
if (resultCode == RESULT_OK) {
195198
val bmpImage = data?.extras?.get("data") as Bitmap
196199
recognizeBarcode(bmpImage)
200+
}
197201
}
198-
}
199202

200203
else -> {
201204
showErrorMessage("No file selected")
202205
}
203206
}
204207
}
205208

209+
206210
private fun recognizeBarcode(image: Bitmap) {
207211
try {
208212
val smallerBmp = reduceBitmapSize(image)
@@ -312,8 +316,12 @@ class MainActivity : AppCompatActivity() {
312316
private fun pickFile() {
313317
val getContentIntent = Intent(Intent.ACTION_GET_CONTENT)
314318
getContentIntent.type = "image/*"
315-
if (getContentIntent.resolveActivity(packageManager) != null) {
316-
startActivityForResult(getContentIntent, ACTION_GET_CONTENT_CALLBACK_CODE)
319+
getContentIntent.addCategory(Intent.CATEGORY_OPENABLE)
320+
try {
321+
startActivityForResult(Intent.createChooser(getContentIntent, "Select an Image to Recognize"), ACTION_GET_CONTENT_CALLBACK_CODE)
322+
} catch (ex: java.lang.Exception) {
323+
showErrorMessage("Unable to start file selector")
317324
}
325+
318326
}
319327
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@drawable/ic_launcher_background" />
4+
<foreground android:drawable="@drawable/ic_launcher_foreground" />
5+
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
6+
</adaptive-icon>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
Sample backup rules file; uncomment and customize as necessary.
3+
See https://developer.android.com/guide/topics/data/autobackup
4+
for details.
5+
Note: This file is ignored for devices older that API 31
6+
See https://developer.android.com/about/versions/12/backup-restore
7+
-->
8+
<full-backup-content>
9+
<!--
10+
<include domain="sharedpref" path="."/>
11+
<exclude domain="sharedpref" path="device.xml"/>
12+
-->
13+
</full-backup-content>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
Sample data extraction rules file; uncomment and customize as necessary.
3+
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
4+
for details.
5+
-->
6+
<data-extraction-rules>
7+
<cloud-backup>
8+
<!-- TODO: Use <include> and <exclude> to control what is backed up.
9+
<include .../>
10+
<exclude .../>
11+
-->
12+
</cloud-backup>
13+
<!--
14+
<device-transfer>
15+
<include .../>
16+
<exclude .../>
17+
</device-transfer>
18+
-->
19+
</data-extraction-rules>

build.gradle

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
buildscript {
3-
ext.kotlin_version = '1.4.31'
4-
repositories {
5-
google()
6-
mavenCentral()
7-
}
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.2.2'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
12-
// NOTE: Do not place your application dependencies here; they belong
13-
// in the individual module build.gradle files
14-
}
15-
}
16-
17-
allprojects {
18-
repositories {
19-
google()
20-
mavenCentral()
21-
}
22-
}
23-
24-
task clean(type: Delete) {
25-
delete rootProject.buildDir
2+
plugins {
3+
id 'com.android.application' version '7.4.0' apply false
4+
id 'com.android.library' version '7.4.0' apply false
5+
id 'org.jetbrains.kotlin.android' version '1.7.21' apply false
266
}
7+
ext.kotlin_version = '1.7.21'

0 commit comments

Comments
 (0)