Skip to content

Commit

Permalink
Merge branch 'release/1.5.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
G00fY2 committed Oct 27, 2022
2 parents 92002d0 + 3010007 commit d3d625d
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 49 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
## Download [![Maven Central](https://img.shields.io/maven-central/v/io.github.g00fy2.quickie/quickie-unbundled)](https://search.maven.org/search?q=g:io.github.g00fy2.quickie)
There are two different flavors available on `mavenCentral()`:

| Bundled | Unbundled |
| ----------------------------------- | ------------------------------------------------- |
| ML Kit model is bundled inside app (independent of Google Services) | ML Kit model will be automatically downloaded via Play Services (once while installing/updating the app) |
| About 2.5 MB app size increase per ABI (you should use App Bundle or ABI splitting) | About 550 KB app size increase |
| V3 model is used (faster, more accurate) | Currently V1 model will be downloaded
| Bundled | Unbundled |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| ML Kit model is bundled inside app (independent of Google Services) | ML Kit model will be automatically downloaded via Play Services (once while installing/updating the app) |
| About 2.5 MB app size increase per ABI (you should use App Bundle or ABI splitting) | About 550 KB app size increase |
| V3 model is used (faster, more accurate) | Currently V1 model will be downloaded |

```kotlin
// bundled:
implementation("io.github.g00fy2.quickie:quickie-bundled:1.5.1")
implementation("io.github.g00fy2.quickie:quickie-bundled:1.5.2")

// unbundled:
implementation("io.github.g00fy2.quickie:quickie-unbundled:1.5.1")
implementation("io.github.g00fy2.quickie:quickie-unbundled:1.5.2")
```

## Quick Start
Expand Down Expand Up @@ -125,7 +126,7 @@ override fun onCreate(savedInstanceState: Bundle?) {
fun handleResult(result: QRResult) {
```
:bulb: You can optionally [pass in an ActivityOptionsCompat object](https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#launch(I,%20androidx.core.app.ActivityOptionsCompat)) when launching the ActivityResultLauncher to control the scanner launch animation.
> **Note**: You can optionally [pass in an ActivityOptionsCompat object](https://developer.android.com/reference/androidx/activity/result/ActivityResultLauncher#launch(I,%20androidx.core.app.ActivityOptionsCompat)) when launching the ActivityResultLauncher to control the scanner launch animation.
## Screenshots / Sample App
You can find the sample app APKs inside the [release](https://github.com/G00fY2/quickie/releases) assets.
Expand Down
9 changes: 6 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.BasePlugin
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.androidGradle) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.kotlin.dokka) apply false
alias(libs.plugins.misc.detekt) apply false
alias(libs.plugins.misc.gradleVersions)
Expand All @@ -33,10 +36,10 @@ subprojects {
"-progressive",
"-Xexplicit-api=strict".takeIf { (this@subprojects.name != "sample") },
)
jvmTarget = "11"
jvmTarget = JavaVersion.VERSION_11.toString()
}
}
afterEvaluate {
plugins.withType<BasePlugin>().configureEach {
extensions.configure<BaseExtension> {
compileSdkVersion(libs.versions.androidconfig.compileSdk.get().toInt())
buildToolsVersion(libs.versions.androidconfig.buildTools.get())
Expand Down
23 changes: 11 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
[versions]
quickie = "1.5.1"
quickie = "1.5.2"

androidconfig-minSdk = "21"
androidconfig-compileSdk = "32"
androidconfig-targetSdk = "32"
androidconfig-buildTools = "32.0.0"

androidGradle = "7.2.2"
kotlin = "1.7.10"
androidGradle = "7.3.1"
kotlin = "1.7.20"

appcompat = "1.5.0"
appcompat = "1.5.1"

cameraX = "1.1.0"

barcodeScanning = "17.0.2"
barcodeScanningGms = "18.0.0"
barcodeScanningGms = "18.1.0"

materialDesign = "1.6.1"
materialDesign = "1.7.0"

detekt = "1.21.0"
gradleVersions = "0.42.0"
dokka = "1.7.10"
gradleVersions = "0.43.0"
dokka = "1.7.20"

junit = "5.9.0"
junit = "5.9.1"

[libraries]
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
Expand All @@ -44,9 +44,8 @@ misc-detektFormatting = { module = "io.gitlab.arturbosch.detekt:detekt-formattin
android-application = { id = "com.android.application", version.ref = "androidGradle" }
android-library = { id = "com.android.library", version.ref = "androidGradle" }

kotlin-androidGradle = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-android = { id = "kotlin-android", version.ref = "kotlin" }
kotlin-parcelize = { id = "kotlin-parcelize", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }

misc-detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
Expand Down
7 changes: 4 additions & 3 deletions quickie/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id(libs.plugins.android.library.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
id(libs.plugins.kotlin.parcelize.get().pluginId)
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.kotlin.dokka)
`maven-publish`
signing
}

android {
namespace = "io.github.g00fy2.quickie"
resourcePrefix = "quickie"
buildFeatures {
viewBinding = true
Expand Down
5 changes: 3 additions & 2 deletions quickie/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.g00fy2.quickie">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-feature
android:name="android.hardware.camera"
Expand All @@ -14,5 +13,7 @@
android:name=".QRScannerActivity"
android:screenOrientation="behind"
android:theme="@style/QuickieScannerActivity"/>

</application>

</manifest>
31 changes: 19 additions & 12 deletions quickie/src/main/kotlin/io/github/g00fy2/quickie/QRCodeAnalyzer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ internal class QRCodeAnalyzer(
} else {
BarcodeScannerOptions.Builder().setBarcodeFormats(barcodeFormats.firstOrNull() ?: Barcode.FORMAT_UNKNOWN)
}
BarcodeScanning.getClient(optionsBuilder.build())
try {
BarcodeScanning.getClient(optionsBuilder.build())
} catch (e: Exception) { // catch if for some reason MlKitContext has not been initialized
onFailure(e)
null
}
}

@Volatile
Expand All @@ -39,17 +44,19 @@ internal class QRCodeAnalyzer(
}

failureOccurred = false
barcodeScanner.process(imageProxy.toInputImage())
.addOnSuccessListener { codes -> codes.mapNotNull { it }.firstOrNull()?.let { onSuccess(it) } }
.addOnFailureListener {
failureOccurred = true
failureTimestamp = System.currentTimeMillis()
onFailure(it)
}
.addOnCompleteListener {
onPassCompleted(failureOccurred)
imageProxy.close()
}
barcodeScanner?.let { scanner ->
scanner.process(imageProxy.toInputImage())
.addOnSuccessListener { codes -> codes.firstNotNullOfOrNull { it }?.let { onSuccess(it) } }
.addOnFailureListener {
failureOccurred = true
failureTimestamp = System.currentTimeMillis()
onFailure(it)
}
.addOnCompleteListener {
onPassCompleted(failureOccurred)
imageProxy.close()
}
}
}

@ExperimentalGetImage
Expand Down
3 changes: 1 addition & 2 deletions quickie/src/unbundled/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.g00fy2.quickie">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<meta-data
Expand Down
5 changes: 3 additions & 2 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id(libs.plugins.android.application.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
}

android {
namespace = "io.github.g00fy2.quickiesample"
defaultConfig {
applicationId = "io.github.g00fy2.quickiesample"
versionCode = 1
Expand Down
9 changes: 5 additions & 4 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.g00fy2.quickiesample">
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".SampleApp"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Material3.DayNight">
android:theme="@style/Theme.Material3.DayNight"
tools:ignore="DataExtractionRules">

<activity
android:name=".MainActivity"
Expand All @@ -20,7 +21,7 @@
</intent-filter>
</activity>

<!--optional service to allow launching the sample app from the quick settings -->
<!--optional service to allow launching the sample app from the quick settings-->
<service
android:name=".quicksettingstile.QuickieTileService"
android:icon="@drawable/ic_qs_qrcode"
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/res/drawable/ic_qs_qrcode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
android:viewportWidth="24"
android:width="32dp">
<path
android:fillColor="@color/quickie_white"
android:fillColor="#ffffff"
android:pathData="M3,9h6V3H3V9zM5,5h2v2H5V5zM15,3v6h6V3H15zM19,7h-2V5h2V7zM3,21h6v-6H3V21zM5,17h2v2H5V17zM13,15v2h-2v-2v-2v-2h2v2h2v-2h2v2v2H13zM17,19h4v2h-4h-2v-2v-2h2V19zM19,11h2v6h-2V11zM7,11h2v2H7V11zM11,19h2v2h-2V19zM5,13H3v-2h2V13zM13,9h-2V3h2V9z"/>
</vector>

0 comments on commit d3d625d

Please sign in to comment.