v4.3.0 and cleanup.

This commit is contained in:
Ralf Kistner
2021-10-25 15:22:01 +02:00
parent a13ce2b161
commit cc12c103e0
4 changed files with 32 additions and 29 deletions
+14
View File
@@ -1,3 +1,17 @@
### 4.3.0 (2021-10-25)
* Minimum SDK version 19, but requires additional config (see readme) for < 24 compatibility.
* Add ScanOptions and ScanContract for use with `registerForActivityResult()`.
* Deprecates IntentIntegrator.
* Use minimal AndroidX libraries.
### 4.2.0 (2021-03-15)
* Fix MediaPlayer warnings (#587).
* Prevent CameraConfigurationUtils clash (#609).
* Add licenses to POM (#556).
* Bug: Crashes on SDK versions older than 21 (#645).
### 4.1.0 (2020-01-07)
* Ability to hide the laser in ViewfinderView (#503).
+16 -28
View File
@@ -27,13 +27,8 @@ repositories {
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:4.2.0'
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
}
android {
buildToolsVersion '28.0.3' // Older versions may give compile errors
}
```
## Older SDK versions
@@ -51,16 +46,12 @@ repositories {
}
dependencies {
implementation('com.journeyapps:zxing-android-embedded:4.2.0') { transitive = false }
implementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
implementation 'com.google.zxing:core:3.3.0'
}
android {
buildToolsVersion '28.0.3'
}
```
### Option 2: Desugaring
### Option 2: Desugaring (Advanced)
This option does not require changing library versions, but may complicate the build process.
@@ -108,23 +99,20 @@ See for details: https://developer.android.com/training/basics/intents/result
`startActivityForResult` can still be used via `IntentIntegrator`, but that is not recommended anymore.
```java
// Note: startActivityForResult is deprecated, so this example uses registerForActivityResult instead.
// See for details: https://developer.android.com/training/basics/intents/result
// Register the launcher and result handler
private final ActivityResultLauncher<ScanOptions> barcodeLauncher = registerForActivityResult(new ScanContract(),
result -> {
if(result.getContents() == null) {
Toast.makeText(MyActivity.this, "Cancelled", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MyActivity.this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
}
});
// Register the launcher and result handler
private final ActivityResultLauncher<ScanOptions> barcodeLauncher = registerForActivityResult(new ScanContract(),
result -> {
if(result.getContents() == null) {
Toast.makeText(MyActivity.this, "Cancelled", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MyActivity.this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
}
});
// Launch
public void onButtonClick(View view) {
barcodeLauncher.launch(new ScanOptions());
}
// Launch
public void onButtonClick(View view) {
barcodeLauncher.launch(new ScanOptions());
}
```
Customize options:
+1 -1
View File
@@ -16,7 +16,7 @@ subprojects {
mavenCentral()
}
version = '4.2.0'
version = '4.3.0'
group = 'com.journeyapps'
ext.androidTargetSdk = 30
+1
View File
@@ -70,6 +70,7 @@ android {
// We test with primitives such as Rect, and rely on their default behaviour working.
unitTests.returnDefaultValues = true
}
defaultConfig {
minSdkVersion 19
}