Aperture: Reset MultiFormatReader after use

Signed-off-by: Luca Stefani <luca.stefani.ge1@gmail.com>
Change-Id: I374c489d9fa63f33e486ef82a82c787cf65cdb4a
diff --git a/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt b/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt
index 36c46de..1343d27 100644
--- a/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt
+++ b/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt
@@ -76,16 +76,17 @@
     override fun analyze(image: ImageProxy) {
         val source = image.planarYUVLuminanceSource
 
-        val reader = runCatching {
+        val result = runCatching {
             reader.decodeWithState(BinaryBitmap(HybridBinarizer(source)))
         }.getOrNull() ?: runCatching {
             reader.decodeWithState(BinaryBitmap(HybridBinarizer(source.invert())))
         }.getOrNull()
 
-        reader?.let {
+        result?.let {
             showQrDialog(it)
         }
 
+        reader.reset()
         image.close()
     }