Aperture: Inflate count down view content by its own

Change-Id: Ia88ecc1d623b2b1e115ab6ad69db800b6c412bb4
diff --git a/app/src/main/java/org/lineageos/aperture/ui/CountDownView.kt b/app/src/main/java/org/lineageos/aperture/ui/CountDownView.kt
index 5f04e17..fe2a7f3 100644
--- a/app/src/main/java/org/lineageos/aperture/ui/CountDownView.kt
+++ b/app/src/main/java/org/lineageos/aperture/ui/CountDownView.kt
@@ -12,6 +12,7 @@
 import android.os.Looper
 import android.os.Message
 import android.util.AttributeSet
+import android.view.LayoutInflater
 import android.widget.FrameLayout
 import android.widget.TextView
 import androidx.annotation.IntRange
@@ -29,9 +30,14 @@
 class CountDownView(context: Context, attrs: AttributeSet?) : FrameLayout(
     context, attrs
 ) {
+    // Views
     private val remainingSecondsView by lazy {
         findViewById<TextView>(R.id.remainingSeconds)
     }
+
+    // System services
+    private val layoutInflater = context.getSystemService(LayoutInflater::class.java)
+
     private var remainingSeconds = 0
     private lateinit var listener: () -> Unit
     private val previewArea = Rect()
@@ -69,6 +75,10 @@
             }
         }
 
+    init {
+        layoutInflater.inflate(R.layout.count_down_view, this)
+    }
+
     /**
      * Responds to preview area change by centering the countdown UI in the new
      * preview area.
diff --git a/app/src/main/res/layout/activity_camera.xml b/app/src/main/res/layout/activity_camera.xml
index 2327140..91015aa 100644
--- a/app/src/main/res/layout/activity_camera.xml
+++ b/app/src/main/res/layout/activity_camera.xml
@@ -70,16 +70,7 @@
         android:layout_height="match_parent"
         android:visibility="invisible"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="parent">
-
-        <TextView
-            android:id="@+id/remainingSeconds"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="center"
-            android:textColor="@android:color/white"
-            android:textSize="125sp" />
-    </org.lineageos.aperture.ui.CountDownView>
+        app:layout_constraintTop_toTopOf="parent" />
 
     <org.lineageos.aperture.ui.HorizontalSlider
         android:id="@+id/zoomLevel"
diff --git a/app/src/main/res/layout/count_down_view.xml b/app/src/main/res/layout/count_down_view.xml
new file mode 100644
index 0000000..e255dd2
--- /dev/null
+++ b/app/src/main/res/layout/count_down_view.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     SPDX-FileCopyrightText: 2023 The LineageOS Project
+     SPDX-License-Identifier: Apache-2.0
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <TextView
+        android:id="@+id/remainingSeconds"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:gravity="center"
+        android:textColor="@android:color/white"
+        android:textSize="125sp" />
+
+</FrameLayout>