v4.3.0 and cleanup.
This commit is contained in:
+14
@@ -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).
|
||||
|
||||
@@ -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
@@ -16,7 +16,7 @@ subprojects {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
version = '4.2.0'
|
||||
version = '4.3.0'
|
||||
group = 'com.journeyapps'
|
||||
|
||||
ext.androidTargetSdk = 30
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user