Skip to content

Commit 8c56e46

Browse files
committed
use compileOnly in mlkit
1 parent f5e67bf commit 8c56e46

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

mlkit/build.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ dependencies {
3232
api("androidx.camera:camera-lifecycle:1.1.0")
3333
api("androidx.camera:camera-view:1.1.0")
3434

35-
api("com.google.mlkit:barcode-scanning:17.0.2") // 3.2 MB
36-
api("com.google.mlkit:text-recognition:16.0.0-beta6") // 4 MB
37-
api("com.google.mlkit:image-labeling-custom:17.0.1") // 3.8 MB
35+
compileOnly("com.google.mlkit:barcode-scanning:17.0.2") // 3.2 MB
36+
compileOnly("com.google.mlkit:text-recognition:16.0.0-beta6") // 4 MB
37+
compileOnly("com.google.mlkit:image-labeling-custom:17.0.1") // 3.8 MB
3838
}
3939

4040
publishing {

mlkit/src/main/java/it/localhostsoftware/mlkit/vision/barcode/BarcodeScanner.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import com.google.mlkit.vision.barcode.common.Barcode
66
import com.google.mlkit.vision.common.InputImage
77
import it.localhostsoftware.mlkit.vision.AbstractImageAnalyzer
88

9+
/**
10+
To use this class add this dependency
11+
implementation("com.google.mlkit:barcode-scanning:17.0.2")
12+
*/
913
class BarcodeScanner : AbstractImageAnalyzer<List<Barcode>>() {
1014
override fun process(image: Image, rotationDegrees: Int) =
11-
BarcodeScanning.getClient().process(InputImage.fromMediaImage(image, rotationDegrees))
15+
BarcodeScanning.getClient().process(InputImage.fromMediaImage(image, rotationDegrees))
1216
}

mlkit/src/main/java/it/localhostsoftware/mlkit/vision/label/ImageLabeler.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import com.google.mlkit.vision.label.ImageLabelerOptionsBase
77
import com.google.mlkit.vision.label.ImageLabeling
88
import it.localhostsoftware.mlkit.vision.AbstractImageAnalyzer
99

10+
/**
11+
To use this class add this dependency
12+
implementation("com.google.mlkit:image-labeling-custom:17.0.1")
13+
*/
1014
class ImageLabeler(private val options: ImageLabelerOptionsBase) : AbstractImageAnalyzer<List<ImageLabel>>() {
1115
override fun process(image: Image, rotationDegrees: Int) =
12-
ImageLabeling.getClient(options).process(InputImage.fromMediaImage(image, rotationDegrees))
16+
ImageLabeling.getClient(options).process(InputImage.fromMediaImage(image, rotationDegrees))
1317
}

mlkit/src/main/java/it/localhostsoftware/mlkit/vision/text/TextRecognizer.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import com.google.mlkit.vision.text.TextRecognition
77
import com.google.mlkit.vision.text.latin.TextRecognizerOptions
88
import it.localhostsoftware.mlkit.vision.AbstractImageAnalyzer
99

10+
/**
11+
To use this class add this dependency
12+
implementation("com.google.mlkit:text-recognition:16.0.0-beta6")
13+
*/
1014
class TextRecognizer : AbstractImageAnalyzer<Text>() {
1115
override fun process(image: Image, rotationDegrees: Int) =
12-
TextRecognition.getClient(TextRecognizerOptions.DEFAULT_OPTIONS).process(InputImage.fromMediaImage(image, rotationDegrees))
16+
TextRecognition.getClient(TextRecognizerOptions.DEFAULT_OPTIONS).process(InputImage.fromMediaImage(image, rotationDegrees))
1317
}

0 commit comments

Comments
 (0)