Aperture: Reformat text classifier thread

Change-Id: I2708f5115b39b5a21d052bac46fe67280a36e498
diff --git a/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt b/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt
index e427eb8..1bcafb7 100644
--- a/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt
+++ b/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt
@@ -15,9 +15,6 @@
 import android.text.method.LinkMovementMethod
 import android.view.View
 import android.view.textclassifier.TextLinks
-import android.view.textclassifier.TextLinks.APPLY_STRATEGY_REPLACE
-import android.view.textclassifier.TextLinks.STATUS_LINKS_APPLIED
-import android.view.textclassifier.TextLinks.STATUS_NO_LINKS_APPLIED
 import android.widget.AdapterView
 import android.widget.ImageButton
 import android.widget.Spinner
@@ -94,21 +91,18 @@
             val span = SpannableString(result.text)
             bottomSheetDialogText?.text = span
             Thread {
-                val textLinks = bottomSheetDialogText?.textClassifier?.generateLinks(
+                val status = bottomSheetDialogText?.textClassifier?.generateLinks(
                     TextLinks.Request.Builder(result.text).build()
-                )
-                val status = textLinks?.apply(
-                    span,
-                    APPLY_STRATEGY_REPLACE,
-                    null
-                ) ?: STATUS_NO_LINKS_APPLIED
-                activity.runOnUiThread {
-                    if (status == STATUS_LINKS_APPLIED) {
+                )?.apply(span, TextLinks.APPLY_STRATEGY_REPLACE, null)
+
+                if (status == TextLinks.STATUS_LINKS_APPLIED) {
+                    activity.runOnUiThread {
                         bottomSheetDialogText?.text = span
                     }
                 }
             }.start()
 
+            // Make links clickable if not on locked keyguard
             bottomSheetDialogText?.movementMethod =
                 if (!keyguardManager.isKeyguardLocked) LinkMovementMethod.getInstance()
                 else null