Skip to content

Commit e3d2fbf

Browse files
update
1 parent 56fde55 commit e3d2fbf

File tree

47 files changed

+1201
-262
lines changed

Some content is hidden

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

47 files changed

+1201
-262
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ The following samples aggregate multiple products under `DynamsoftCaptureVision`
6060

6161
## License
6262

63-
- If you want to use an offline license, please contact [Dynamsoft Support](https://www.dynamsoft.com/company/contact/)
64-
- You can also request a 30-day trial license via the [Request a Trial License](https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=github&package=mobile) link.
63+
You can request a 30-day trial license via the [Request a Trial License](https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=mobile) link.
6564

6665
## Contact Us
6766

68-
https://www.dynamsoft.com/company/contact/
67+
For any questions or feedback, you can either [contact us](https://www.dynamsoft.com/company/contact/) or [submit an issue](https://github.com/Dynamsoft/barcode-reader-mobile-samples/issues/new).

android/GeneralSettings/GeneralSettings/src/main/java/com/dynamsoft/dbr/generalsettings/MainActivity.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.app.AlertDialog;
44
import android.os.Bundle;
55
import android.view.Menu;
6+
import android.widget.TextView;
67

78
import androidx.appcompat.app.AppCompatActivity;
89
import androidx.appcompat.widget.Toolbar;
@@ -15,20 +16,20 @@
1516

1617
public class MainActivity extends AppCompatActivity {
1718
private AppBarConfiguration appBarConfiguration;
18-
private static final String LICENSE = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9";
1919

2020
@Override
2121
protected void onCreate(Bundle savedInstanceState) {
2222
super.onCreate(savedInstanceState);
2323
setContentView(R.layout.activity_main);
2424

2525
if (savedInstanceState == null) {
26-
// Initialize license for Dynamsoft Barcode Reader.
27-
// The LICENSE string is defined above. It is a time-limited trial license. Note that network connection is required for this license to work.
28-
// You can also request a 30-day trial license via the Request a Trial License link: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=github&package=android
29-
LicenseManager.initLicense(LICENSE, this, (isSuccess, error) -> {
26+
// Initialize the license.
27+
// The license string here is a trial license. Note that network connection is required for this license to work.
28+
// You can request an extension via the following link: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=android
29+
LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", this, (isSuccess, error) -> {
3030
if (!isSuccess) {
3131
error.printStackTrace();
32+
runOnUiThread(()-> ((TextView) findViewById(R.id.tv_license_error)).setText("License initialization failed: "+error.getMessage()));
3233
}
3334
});
3435
}

android/GeneralSettings/GeneralSettings/src/main/res/layout/activity_main.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,15 @@
3030
app:layout_constraintStart_toStartOf="parent"
3131
app:layout_constraintTop_toBottomOf="@+id/appBarLayout" />
3232

33+
<TextView
34+
android:id="@+id/tv_license_error"
35+
android:textAlignment="center"
36+
android:textColor="#FFFF0000"
37+
android:padding="16dp"
38+
android:layout_marginBottom="24dp"
39+
android:textSize="16sp"
40+
android:layout_width="match_parent"
41+
android:layout_height="wrap_content"
42+
app:layout_constraintBottom_toBottomOf="parent"/>
3343

3444
</androidx.constraintlayout.widget.ConstraintLayout>

android/GeneralSettings/build.gradle

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,32 @@ allprojects {
1212
}
1313
}
1414

15-
def getBranch() {
16-
def branch = ""
17-
def proc = "git rev-parse --abbrev-ref HEAD".execute()
18-
proc.in.eachLine { line -> branch = line }
19-
proc.err.eachLine { line -> branch = line }
20-
proc.waitFor()
21-
return branch
15+
/***For debug***/
16+
import java.util.concurrent.TimeUnit
17+
def getLocalProperty(String name) {
18+
Properties properties = new Properties()
19+
if(project.rootProject.file('local.properties').exists()) {
20+
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream()
21+
properties.load(inputStream)
22+
return properties[name]
23+
} else {
24+
return null
25+
}
2226
}
23-
24-
if(getBranch() == 'develop') {
25-
def local_script_file = rootProject.file('../../../mobile_sample_script/local_dependencies.gradle')
26-
if(local_script_file.exists()) {
27-
apply from: local_script_file
27+
allprojects {
28+
ext {
29+
dynamsoftMaven = getLocalProperty("dynamsoftMaven")
30+
useDynamsoftMaven = dynamsoftMaven != null
31+
}
32+
if(useDynamsoftMaven) {
33+
configurations.all {
34+
resolutionStrategy.cacheChangingModulesFor 0, TimeUnit.SECONDS
35+
}
36+
repositories {
37+
maven {
38+
url dynamsoftMaven
39+
allowInsecureProtocol true
40+
}
41+
}
2842
}
2943
}

android/HelloWorld/DecodeFromAnImage/src/main/java/com/dynamsoft/dbr/decodefromanimage/MainActivity.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ protected void onCreate(Bundle savedInstanceState) {
4040
binding = ActivityMainBinding.inflate(getLayoutInflater());
4141
setContentView(binding.getRoot());
4242
if (savedInstanceState == null) {
43-
// Initialize license for Dynamsoft Barcode Reader.
44-
// The license string here is a time-limited trial license. Note that network connection is required for this license to work.
45-
// You can also request a 30-day trial license via the Request a Trial License link: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=github&package=android
43+
// Initialize the license.
44+
// The license string here is a trial license. Note that network connection is required for this license to work.
45+
// You can request an extension via the following link: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=android
4646
LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", this, (isSuccess, error) -> {
4747
if (!isSuccess) {
4848
error.printStackTrace();
49+
runOnUiThread(()-> binding.tvLicenseError.setText("License initialization failed: "+error.getMessage()));
4950
}
5051
});
5152
}

android/HelloWorld/DecodeFromAnImage/src/main/res/layout/activity_main.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@
2424
android:layout_width="match_parent"
2525
android:layout_height="match_parent"/>
2626

27+
<TextView
28+
android:id="@+id/tv_license_error"
29+
android:textAlignment="center"
30+
android:textColor="#FFFF0000"
31+
android:background="#BFFFFFFF"
32+
android:padding="16dp"
33+
android:layout_marginBottom="24dp"
34+
android:textSize="16sp"
35+
android:layout_width="match_parent"
36+
android:layout_height="wrap_content"
37+
app:layout_constraintBottom_toTopOf="@+id/btn_decode"/>
38+
39+
2740
<Button
2841
android:id="@+id/btn_decode"
2942
android:layout_width="wrap_content"

android/HelloWorld/DecodeFromAnImageKt/src/main/java/com/dynamsoft/decodefromanimagekt/MainActivity.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ class MainActivity : AppCompatActivity() {
3131
mDecodeThreadExecutor = Executors.newSingleThreadExecutor()
3232

3333
if (savedInstanceState == null) {
34-
// Initialize license for Dynamsoft Barcode Reader.
35-
// The license string here is a time-limited trial license. Note that network connection is required for this license to work.
36-
// You can also request a 30-day trial license via the Request a Trial License link: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=github&package=android
34+
// Initialize the license.
35+
// The license string here is a trial license. Note that network connection is required for this license to work.
36+
// You can request an extension via the following link: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=android
3737
LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", this) { isSuccess, error ->
3838
if (!isSuccess) {
3939
error?.printStackTrace()
40+
runOnUiThread { binding.tvLicenseError.text = "License initialization failed: ${error?.message}" }
4041
}
4142
}
4243
}

android/HelloWorld/DecodeFromAnImageKt/src/main/res/layout/activity_main.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424
android:layout_width="match_parent"
2525
android:layout_height="match_parent"/>
2626

27+
<TextView
28+
android:id="@+id/tv_license_error"
29+
android:textAlignment="center"
30+
android:background="#BFFFFFFF"
31+
android:textColor="#FFFF0000"
32+
android:padding="16dp"
33+
android:layout_marginBottom="24dp"
34+
android:textSize="16sp"
35+
android:layout_width="match_parent"
36+
android:layout_height="wrap_content"
37+
app:layout_constraintBottom_toTopOf="@+id/btn_decode"/>
38+
2739
<Button
2840
android:id="@+id/btn_decode"
2941
android:layout_width="wrap_content"

android/HelloWorld/DecodeWithCameraEnhancer/src/main/java/com/dynamsoft/dbr/decodewithcameraenhancer/MainActivity.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.app.AlertDialog;
44
import android.os.Bundle;
5+
import android.widget.TextView;
56

67
import androidx.appcompat.app.AppCompatActivity;
78

@@ -33,12 +34,13 @@ protected void onCreate(Bundle savedInstanceState) {
3334
super.onCreate(savedInstanceState);
3435
setContentView(R.layout.activity_main);
3536
if (savedInstanceState == null) {
36-
// Initialize license for Dynamsoft Barcode Reader.
37-
// The license string here is a time-limited trial license. Note that network connection is required for this license to work.
38-
// You can also request a 30-day trial license via the Request a Trial License link: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=github&package=android
37+
// Initialize the license.
38+
// The license string here is a trial license. Note that network connection is required for this license to work.
39+
// You can request an extension via the following link: https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=samples&package=android
3940
LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", this, (isSuccess, error) -> {
4041
if (!isSuccess) {
4142
error.printStackTrace();
43+
runOnUiThread(()-> ((TextView) findViewById(R.id.tv_license_error)).setText("License initialization failed: "+error.getMessage()));
4244
}
4345
});
4446
}

android/HelloWorld/DecodeWithCameraEnhancer/src/main/res/layout/activity_main.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,15 @@
1111
android:layout_width="match_parent"
1212
android:layout_height="match_parent"/>
1313

14+
<TextView
15+
android:id="@+id/tv_license_error"
16+
android:textAlignment="center"
17+
android:textColor="#FFFF0000"
18+
android:padding="16dp"
19+
android:layout_marginBottom="24dp"
20+
android:textSize="16sp"
21+
android:layout_width="match_parent"
22+
android:layout_height="wrap_content"
23+
app:layout_constraintBottom_toBottomOf="parent"/>
24+
1425
</androidx.constraintlayout.widget.ConstraintLayout>

0 commit comments

Comments
 (0)