Aperture: Disable primary bar buttons on activity
Change-Id: I648f68d35c928b38afb60c5537d67fb687141e93
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index 7fadbf5..8737839 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -135,6 +135,7 @@
set(value) {
field = value
updateSecondaryBarButtons(value)
+ updatePrimaryBarButtons(value)
}
private lateinit var camera: PhysicalCamera
@@ -862,6 +863,17 @@
}
}
+ /**
+ * Enable or disable primary bar buttons
+ */
+ private fun updatePrimaryBarButtons(cameraState: CameraState) {
+ runOnUiThread {
+ galleryButton.isEnabled = cameraState == CameraState.IDLE
+ // Shutter button must stay enabled
+ flipCameraButton.isEnabled = cameraState == CameraState.IDLE
+ }
+ }
+
private fun cycleAspectRatio() {
if (!canRestartCamera()) {
return