Aperture: Deduplicate camerax annotations

We can just set them for the whole MainActivity instead of having to
repeat them for every function.

Change-Id: I07a77328f6130dfc57c2f3f8e818c563dd090ba6
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index 67ee242..87934c5 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -77,6 +77,9 @@
 import java.util.Timer
 import java.util.TimerTask
 
+@androidx.camera.camera2.interop.ExperimentalCamera2Interop
+@androidx.camera.core.ExperimentalZeroShutterLag
+@androidx.camera.view.video.ExperimentalVideo
 class MainActivity : AppCompatActivity() {
     private val aspectRatioButton by lazy { findViewById<ToggleButton>(R.id.aspectRatioButton) }
     private val bottomButtonsLayout by lazy { findViewById<ConstraintLayout>(R.id.bottomButtonsLayout) }
@@ -183,8 +186,6 @@
     }
 
     @SuppressLint("ClickableViewAccessibility")
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
-    @androidx.camera.view.video.ExperimentalVideo
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
 
@@ -340,7 +341,6 @@
         cameraExecutor = Executors.newSingleThreadExecutor()
     }
 
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
     override fun onResume() {
         super.onResume()
 
@@ -434,7 +434,6 @@
         )
     }
 
-    @androidx.camera.view.video.ExperimentalVideo
     private suspend fun captureVideo() {
         if (cameraController.isRecording) {
             // Stop the current recording session.
@@ -485,7 +484,6 @@
     /**
      * Check if we can reinitialize the camera use cases
      */
-    @androidx.camera.view.video.ExperimentalVideo
     private fun canRestartCamera() = when (cameraMode) {
         // Disallow camera restart if we're taking a photo or if timer is running
         CameraMode.PHOTO -> !isTakingPhoto && !timerChip.isVisible
@@ -498,9 +496,6 @@
     /**
      * Rebind cameraProvider use cases
      */
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
-    @androidx.camera.core.ExperimentalZeroShutterLag
-    @androidx.camera.view.video.ExperimentalVideo
     private fun bindCameraUseCases() {
         // Unbind previous use cases
         cameraController.unbind()
@@ -606,8 +601,6 @@
     /**
      * Change the current camera mode and restarts the stream
      */
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
-    @androidx.camera.view.video.ExperimentalVideo
     private fun changeCameraMode(cameraMode: CameraMode) {
         if (!canRestartCamera()) {
             return
@@ -624,8 +617,6 @@
     /**
      * Cycle between cameras
      */
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
-    @androidx.camera.view.video.ExperimentalVideo
     private fun flipCamera() {
         if (!canRestartCamera()) {
             return
@@ -653,8 +644,6 @@
         videoModeButton.isEnabled = cameraMode != CameraMode.VIDEO
     }
 
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
-    @androidx.camera.view.video.ExperimentalVideo
     private fun cycleAspectRatio() {
         if (!canRestartCamera()) {
             return
@@ -767,7 +756,6 @@
     /**
      * Update the flash mode button icon based on the value set in imageCapture
      */
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
     private fun updateFlashModeIcon() {
         flashButton.isVisible = cameraMode == CameraMode.PHOTO && camera.hasFlashUnit()
         flashButton.setImageDrawable(
@@ -786,7 +774,6 @@
     /**
      * Set the specified flash mode, saving the value to shared prefs and updating the icon
      */
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
     private fun setFlashMode(flashMode: Int) {
         cameraController.imageCaptureFlashMode = flashMode
         updateFlashModeIcon()
@@ -797,7 +784,6 @@
     /**
      * Cycle flash mode between auto, on and off
      */
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
     private fun cycleFlashMode() {
         setFlashMode(
             when (cameraController.imageCaptureFlashMode) {
@@ -809,12 +795,10 @@
         )
     }
 
-    @androidx.camera.view.video.ExperimentalVideo
     private fun toggleRecordingChipVisibility() {
         recordChip.isVisible = cameraController.isRecording
     }
 
-    @androidx.camera.view.video.ExperimentalVideo
     private fun startRecordingTimer() {
         recordingTime = 0
         toggleRecordingChipVisibility()
@@ -829,7 +813,6 @@
         }, 1000, 1000)
     }
 
-    @androidx.camera.view.video.ExperimentalVideo
     private fun stopRecordingTimer() {
         recordingTimer.cancel()
         runOnUiThread {
@@ -840,8 +823,6 @@
     /**
      * Set a photo effect and restart the camera if required
      */
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
-    @androidx.camera.view.video.ExperimentalVideo
     private fun setExtensionMode(extensionMode: Int) {
         if (!canRestartCamera()) {
             return
@@ -880,8 +861,6 @@
     /**
      * Cycle between supported photo camera effects
      */
-    @androidx.camera.camera2.interop.ExperimentalCamera2Interop
-    @androidx.camera.view.video.ExperimentalVideo
     private fun cyclePhotoEffects() {
         if (!canRestartCamera()) {
             return
@@ -985,7 +964,6 @@
         }
     }
 
-    @androidx.camera.view.video.ExperimentalVideo
     private fun openSettings() {
         if (!canRestartCamera()) {
             return
@@ -1016,7 +994,6 @@
         }
     }
 
-    @androidx.camera.view.video.ExperimentalVideo
     private fun startTimerAndRun(runnable: () -> Unit) {
         if (sharedPreferences.timerMode <= 0 || !canRestartCamera()) {
             runnable()