Aperture: Move thumb cx,cy,radius calculation to separate function

Change-Id: I1b3b2ad3d2d0e82c73abbb4e5474e052a6f6f2a7
diff --git a/app/src/main/java/org/lineageos/aperture/ui/VerticalSlider.kt b/app/src/main/java/org/lineageos/aperture/ui/VerticalSlider.kt
index d1dfa4e..91ca542 100644
--- a/app/src/main/java/org/lineageos/aperture/ui/VerticalSlider.kt
+++ b/app/src/main/java/org/lineageos/aperture/ui/VerticalSlider.kt
@@ -115,11 +115,10 @@
         canvas.drawRoundRect(track, trackRadius, trackRadius, trackPaint)
     }
 
-    private fun drawThumb(canvas: Canvas) {
+    private fun thumb(): Triple<Float, Float, Float> {
         val track = track()
         val trackHeight = track.height()
 
-        // Draw circle
         val cx = width / 2f
         val cy = if (steps > 0) {
             val progress = Int.mapToRange(Range(0, steps), progress).toFloat() / steps
@@ -127,7 +126,14 @@
         } else {
             (trackHeight - (trackHeight * progress)) + track.top
         }
-        canvas.drawCircle(cx, cy, width / 2.15f, thumbPaint)
+
+        return Triple(cx, cy, width / 2.15f)
+    }
+
+    private fun drawThumb(canvas: Canvas) {
+        // Draw circle
+        val thumb = thumb()
+        canvas.drawCircle(thumb.first, thumb.second, thumb.third, thumbPaint)
 
         // Draw text
         val text = textFormatter(progress)
@@ -135,7 +141,10 @@
             thumbTextPaint.getTextBounds(text, 0, text.length, this)
         }
         canvas.drawText(
-            text, (width - textBounds.width()) / 2f, cy + (textBounds.height() / 2), thumbTextPaint
+            text,
+            thumb.first - (textBounds.width() / 2),
+            thumb.second + (textBounds.height() / 2),
+            thumbTextPaint
         )
     }
 }