Merge https://github.com/GrapheneOS/Camera into leaf-2.0

Change-Id: I645061333390d38e34ed8f32c66a42d436307184
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index e9969a1..7b46144 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -14,7 +14,6 @@
             <option value="$PROJECT_DIR$/app" />
           </set>
         </option>
-        <option name="resolveModulePerSourceSet" value="false" />
       </GradleProjectSettings>
     </option>
   </component>
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 13517fb..1ea4cca 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -40,7 +40,7 @@
         applicationId = "app.grapheneos.camera"
         minSdk = 29
         targetSdk = 32
-        versionCode = 39
+        versionCode = 45
         versionName = versionCode.toString()
     }
 
@@ -82,19 +82,24 @@
     buildFeatures {
         viewBinding = true
     }
+
+    lintOptions {
+        disable("LintError")
+    }
 }
 
 dependencies {
-    implementation("androidx.appcompat:appcompat:1.4.1")
-    implementation("com.google.android.material:material:1.6.0")
-    implementation("androidx.constraintlayout:constraintlayout:2.1.3")
+    implementation("androidx.appcompat:appcompat:1.4.2")
+    implementation("com.google.android.material:material:1.6.1")
+    implementation("androidx.constraintlayout:constraintlayout:2.1.4")
 
-    implementation("androidx.camera:camera-core:1.1.0-rc01")
-    implementation("androidx.camera:camera-camera2:1.1.0-rc01")
-    implementation("androidx.camera:camera-lifecycle:1.1.0-rc01")
-    implementation("androidx.camera:camera-video:1.1.0-rc01")
-    implementation("androidx.camera:camera-view:1.1.0-rc01")
-    implementation("androidx.camera:camera-extensions:1.1.0-rc01")
+    val cameraVersion = "1.2.0-alpha04"
+    implementation("androidx.camera:camera-core:$cameraVersion")
+    implementation("androidx.camera:camera-camera2:$cameraVersion")
+    implementation("androidx.camera:camera-lifecycle:$cameraVersion")
+    implementation("androidx.camera:camera-video:$cameraVersion")
+    implementation("androidx.camera:camera-view:$cameraVersion")
+    implementation("androidx.camera:camera-extensions:$cameraVersion")
 
     implementation("com.google.zxing:core:3.5.0")
 }
diff --git a/app/src/main/java/app/grapheneos/camera/CamConfig.kt b/app/src/main/java/app/grapheneos/camera/CamConfig.kt
index 91085ff..285414a 100644
--- a/app/src/main/java/app/grapheneos/camera/CamConfig.kt
+++ b/app/src/main/java/app/grapheneos/camera/CamConfig.kt
@@ -62,6 +62,7 @@
     VIDEO(ExtensionMode.NONE, R.string.video),
 }
 
+@SuppressLint("UnsafeOptInUsageError")
 class CamConfig(private val mActivity: MainActivity) {
 
     enum class GridType {
@@ -103,6 +104,8 @@
 
             const val CAMERA_SOUNDS = "camera_sounds"
 
+            const val ENABLE_ZSL = "enable_zsl"
+
             // const val IMAGE_FILE_FORMAT = "image_quality"
             // const val VIDEO_FILE_FORMAT = "video_quality"
         }
@@ -114,6 +117,8 @@
 
             const val ASPECT_RATIO = AspectRatio.RATIO_4_3
 
+            val VIDEO_QUALITY = Quality.HIGHEST
+
             const val SELF_ILLUMINATION = false
 
             const val GEO_TAGGING = false
@@ -142,6 +147,8 @@
 
             const val CAMERA_SOUNDS = true
 
+            const val ENABLE_ZSL = false
+
             // const val IMAGE_FILE_FORMAT = ""
             // const val VIDEO_FILE_FORMAT = ""
         }
@@ -301,14 +308,14 @@
             field = value
         }
 
-    var videoQuality: Quality? = null
+    var videoQuality: Quality = SettingValues.Default.VIDEO_QUALITY
         get() {
             return if (modePref.contains(videoQualityKey)) {
                 mActivity.settingsDialog.titleToQuality(
                     modePref.getString(videoQualityKey, "")!!
                 )
             } else {
-                null
+                SettingValues.Default.VIDEO_QUALITY
             }
         }
         set(value) {
@@ -429,6 +436,19 @@
             mActivity.settingsDialog.enableEISToggle.isChecked = value
         }
 
+    var enableZsl: Boolean
+        get() {
+            return commonPref.getBoolean(
+                SettingValues.Key.ENABLE_ZSL,
+                SettingValues.Default.ENABLE_ZSL
+            )
+        }
+        set(value) {
+            val editor = commonPref.edit()
+            editor.putBoolean(SettingValues.Key.ENABLE_ZSL, value)
+            editor.apply()
+        }
+
     var saveImageAsPreviewed: Boolean
         get() {
             return commonPref.getBoolean(
@@ -505,6 +525,10 @@
             editor.apply()
         }
 
+    val isZslSupported : Boolean by lazy {
+        camera!!.cameraInfo.isZslSupported
+    }
+
     fun shouldShowGyroscope(): Boolean {
         return isInPhotoMode && gSuggestions
     }
@@ -644,16 +668,7 @@
             }
 
             if (isVideoMode) {
-
-                if (!modePref.contains(videoQualityKey)) {
-                    mActivity.settingsDialog.reloadQualities()
-                    val option = mActivity.settingsDialog.videoQualitySpinner.selectedItem as String?
-                    putString(videoQualityKey, option)
-                } else {
-                    modePref.getString(videoQualityKey, null)?.let {
-                        mActivity.settingsDialog.reloadQualities(it)
-                    }
-                }
+                mActivity.settingsDialog.reloadQualities()
             }
 
             if (lensFacing == CameraSelector.LENS_FACING_FRONT) {
@@ -1009,7 +1024,13 @@
             iAnalyzer = mIAnalyzer
             mIAnalyzer.setAnalyzer(cameraExecutor, analyzer)
             cameraSelector = CameraSelector.Builder()
-                .requireLensFacing(CameraSelector.LENS_FACING_BACK)
+                .requireLensFacing(
+                    if (isLensFacingSupported(CameraSelector.LENS_FACING_BACK)) {
+                        CameraSelector.LENS_FACING_BACK
+                    } else {
+                        mActivity.showMessage(R.string.qr_rear_camera_unavailable)
+                        CameraSelector.LENS_FACING_FRONT
+                    })
                 .build()
             useCaseGroupBuilder.addUseCase(mIAnalyzer)
 
@@ -1023,20 +1044,12 @@
                         View.VISIBLE
                     }
 
-                // QualitySelector fallback doesn't work correctly so we can only set a known
-                // supported quality configured via the setting previously
-                // https://issuetracker.google.com/issues/230651237
-                val videoQuality = videoQuality
-                if (videoQuality != null) {
-                    videoCapture =
-                        VideoCapture.withOutput(
-                            Recorder.Builder()
-                                .setQualitySelector(QualitySelector.from(videoQuality))
-                                .build()
-                        )
-                } else {
-                    videoCapture = VideoCapture.withOutput(Recorder.Builder().build())
-                }
+                videoCapture =
+                    VideoCapture.withOutput(
+                        Recorder.Builder()
+                            .setQualitySelector(QualitySelector.from(videoQuality))
+                            .build()
+                    )
 
                 useCaseGroupBuilder.addUseCase(videoCapture!!)
             }
@@ -1047,7 +1060,11 @@
                         if (emphasisQuality) {
                             ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY
                         } else {
-                            ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY
+                            if (enableZsl) {
+                                ImageCapture.CAPTURE_MODE_ZERO_SHUTTER_LAG
+                            } else {
+                                ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY
+                            }
                         }
                     )
 
@@ -1156,16 +1173,6 @@
 
         if (selfIlluminate) {
 
-            mActivity.mainOverlay.layoutParams =
-                (mActivity.mainOverlay.layoutParams as FrameLayout.LayoutParams).apply {
-                    this.setMargins(
-                        leftMargin,
-                        0, // topMargin
-                        rightMargin,
-                        0 // bottomMargin
-                    )
-                }
-
             val animation: Animation = AlphaAnimation(0f, 0.8f)
             animation.duration = PREVIEW_SL_OVERLAY_DUR
             animation.interpolator = LinearInterpolator()
@@ -1206,7 +1213,6 @@
                     override fun onAnimationEnd(p0: Animation?) {
                         mActivity.mainOverlay.visibility = View.INVISIBLE
                         mActivity.mainOverlay.setImageResource(android.R.color.transparent)
-                        mActivity.updateLastFrame()
                     }
 
                     override fun onAnimationRepeat(p0: Animation?) {}
diff --git a/app/src/main/java/app/grapheneos/camera/capturer/ImageCapturer.kt b/app/src/main/java/app/grapheneos/camera/capturer/ImageCapturer.kt
index 99c3b75..4100306 100644
--- a/app/src/main/java/app/grapheneos/camera/capturer/ImageCapturer.kt
+++ b/app/src/main/java/app/grapheneos/camera/capturer/ImageCapturer.kt
@@ -29,6 +29,28 @@
 class ImageCapturer(val mActivity: MainActivity) {
     val camConfig = mActivity.camConfig
 
+    private fun fadeCaptureButton() {
+        mActivity.captureButton.isEnabled = false
+
+        val animation: Animation = AlphaAnimation(mActivity.captureButton.alpha, 0.6f)
+        animation.duration = 200
+        animation.interpolator = LinearInterpolator()
+        animation.fillAfter = true
+
+        mActivity.captureButton.startAnimation(animation)
+    }
+
+    private fun unfadeCaptureButton() {
+        mActivity.captureButton.isEnabled = true
+
+        val animation: Animation = AlphaAnimation(mActivity.captureButton.alpha, 1f)
+        animation.duration = 200
+        animation.interpolator = LinearInterpolator()
+        animation.fillAfter = true
+
+        mActivity.captureButton.startAnimation(animation)
+    }
+
     @SuppressLint("RestrictedApi")
     fun takePicture() {
         if (camConfig.camera == null) {
@@ -41,7 +63,6 @@
         }
 
         if (isTakingPicture) {
-            mActivity.showMessage(R.string.image_processing_pending)
             return
         }
 
@@ -77,9 +98,11 @@
         isTakingPicture = true
 
         imageCapture.takePicture(ImageSaver.imageCaptureCallbackExecutor, imageSaver)
+        fadeCaptureButton()
     }
 
     fun onCaptureSuccess() {
+        unfadeCaptureButton()
         isTakingPicture = false
 
         camConfig.mPlayer.playShutterSound()
@@ -104,17 +127,6 @@
                     override fun onAnimationEnd(p0: Animation?) {
                         mActivity.mainOverlay.visibility = View.INVISIBLE
                         mActivity.mainOverlay.setImageResource(android.R.color.transparent)
-                        mActivity.updateLastFrame()
-
-                        mActivity.mainOverlay.layoutParams =
-                            (mActivity.mainOverlay.layoutParams as FrameLayout.LayoutParams).apply {
-                                this.setMargins(
-                                    leftMargin,
-                                    (46 * mActivity.resources.displayMetrics.density).toInt(), // topMargin
-                                    rightMargin,
-                                    (40 * mActivity.resources.displayMetrics.density).toInt() // bottomMargin
-                                )
-                            }
                     }
 
                     override fun onAnimationRepeat(p0: Animation?) {}
@@ -129,6 +141,7 @@
     fun onCaptureError(exception: ImageCaptureException) {
         Log.e(TAG, "onCaptureError", exception)
 
+        unfadeCaptureButton()
         isTakingPicture = false
         mActivity.previewLoader.visibility = View.GONE
 
diff --git a/app/src/main/java/app/grapheneos/camera/capturer/VideoCapturer.kt b/app/src/main/java/app/grapheneos/camera/capturer/VideoCapturer.kt
index 35f9052..5a6817a 100644
--- a/app/src/main/java/app/grapheneos/camera/capturer/VideoCapturer.kt
+++ b/app/src/main/java/app/grapheneos/camera/capturer/VideoCapturer.kt
@@ -266,6 +266,7 @@
 
         mActivity.settingsDialog.includeAudioToggle.isEnabled = false
         mActivity.settingsDialog.videoQualitySpinner.isEnabled = false
+        mActivity.settingsDialog.enableEISToggle.isEnabled = false
 
         mActivity.flipCamIcon.setImageResource(R.drawable.pause)
         isPaused = false
@@ -304,6 +305,7 @@
 
         mActivity.settingsDialog.includeAudioToggle.isEnabled = true
         mActivity.settingsDialog.videoQualitySpinner.isEnabled = true
+        mActivity.settingsDialog.enableEISToggle.isEnabled = true
 
         if (mActivity !is VideoCaptureActivity) {
             mActivity.thirdOption.visibility = View.VISIBLE
diff --git a/app/src/main/java/app/grapheneos/camera/ui/QROverlay.kt b/app/src/main/java/app/grapheneos/camera/ui/QROverlay.kt
index 51a9085..a5d7b6b 100644
--- a/app/src/main/java/app/grapheneos/camera/ui/QROverlay.kt
+++ b/app/src/main/java/app/grapheneos/camera/ui/QROverlay.kt
@@ -12,6 +12,9 @@
 import android.view.View
 
 class QROverlay(context: Context, attrs: AttributeSet) : View(context, attrs) {
+    companion object {
+        const val RATIO = 0.6f
+    }
 
     private val boxPaint: Paint = Paint().apply {
         color = 0Xffffff
@@ -40,7 +43,7 @@
         val overlayWidth = width.toFloat()
         val overlayHeight = height.toFloat()
 
-        size = overlayHeight.coerceAtMost(overlayWidth) * 0.6f
+        size = overlayHeight.coerceAtMost(overlayWidth) * RATIO
 
         val cx = overlayWidth / 2
         val cy = overlayHeight / 2
@@ -65,4 +68,4 @@
         }
     }
 
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/app/grapheneos/camera/ui/SettingsDialog.kt b/app/src/main/java/app/grapheneos/camera/ui/SettingsDialog.kt
index 393f899..372de90 100644
--- a/app/src/main/java/app/grapheneos/camera/ui/SettingsDialog.kt
+++ b/app/src/main/java/app/grapheneos/camera/ui/SettingsDialog.kt
@@ -3,7 +3,6 @@
 import android.animation.ArgbEvaluator
 import android.animation.ValueAnimator
 import android.app.Dialog
-import android.content.Intent
 import android.graphics.Color
 import android.hardware.camera2.CameraCharacteristics
 import android.hardware.camera2.CameraMetadata
@@ -32,7 +31,6 @@
 import androidx.appcompat.widget.SwitchCompat
 import androidx.camera.camera2.interop.Camera2CameraInfo
 import androidx.camera.core.AspectRatio
-import androidx.camera.core.CameraInfo
 import androidx.camera.core.CameraSelector
 import androidx.camera.core.ImageCapture
 import androidx.camera.video.Quality
@@ -40,12 +38,8 @@
 import app.grapheneos.camera.CamConfig
 import app.grapheneos.camera.R
 import app.grapheneos.camera.databinding.SettingsBinding
-import app.grapheneos.camera.ui.activities.CaptureActivity
 import app.grapheneos.camera.ui.activities.MainActivity
 import app.grapheneos.camera.ui.activities.MoreSettings
-import app.grapheneos.camera.ui.activities.SecureActivity
-import app.grapheneos.camera.ui.activities.SecureMainActivity
-import app.grapheneos.camera.ui.activities.VideoCaptureActivity
 
 class SettingsDialog(val mActivity: MainActivity) :
     Dialog(mActivity, R.style.Theme_App) {
@@ -619,11 +613,11 @@
     }
 
     private fun slideDialogDown() {
-        dialog.startAnimation(slideDownAnimation)
+        settingsFrame.startAnimation(slideDownAnimation)
     }
 
     fun slideDialogUp() {
-        dialog.startAnimation(slideUpAnimation)
+        settingsFrame.startAnimation(slideUpAnimation)
     }
 
     private fun getAvailableQualities(): List<Quality> {
@@ -633,7 +627,6 @@
     }
 
     private fun getAvailableQTitles(): List<String> {
-
         val titles = arrayListOf<String>()
 
         getAvailableQualities().forEach {
@@ -641,7 +634,6 @@
         }
 
         return titles
-
     }
 
     private fun getTitleFor(quality: Quality): String {
@@ -705,7 +697,7 @@
         slideDialogDown()
     }
 
-    fun reloadQualities(qualityText: String = "") {
+    fun reloadQualities() {
 
         val titles = getAvailableQTitles()
 
@@ -721,10 +713,8 @@
 
         videoQualitySpinner.adapter = vQAdapter
 
-        val qt = qualityText.ifEmpty {
-            camConfig.videoQuality?.let { getTitleFor(it) }
+        if (camConfig.videoQuality != Quality.HIGHEST) {
+            videoQualitySpinner.setSelection(titles.indexOf(getTitleFor(camConfig.videoQuality)))
         }
-
-        videoQualitySpinner.setSelection(titles.indexOf(qt))
     }
 }
diff --git a/app/src/main/java/app/grapheneos/camera/ui/ZoomableImageView.kt b/app/src/main/java/app/grapheneos/camera/ui/ZoomableImageView.kt
index 7479ae1..471cadb 100644
--- a/app/src/main/java/app/grapheneos/camera/ui/ZoomableImageView.kt
+++ b/app/src/main/java/app/grapheneos/camera/ui/ZoomableImageView.kt
@@ -9,7 +9,6 @@
 
 import android.graphics.PointF
 import android.util.AttributeSet
-import android.util.Log
 import android.view.ScaleGestureDetector.SimpleOnScaleGestureListener
 
 import androidx.appcompat.widget.AppCompatImageView
diff --git a/app/src/main/java/app/grapheneos/camera/ui/activities/MainActivity.kt b/app/src/main/java/app/grapheneos/camera/ui/activities/MainActivity.kt
index a7e6848..90c07f0 100644
--- a/app/src/main/java/app/grapheneos/camera/ui/activities/MainActivity.kt
+++ b/app/src/main/java/app/grapheneos/camera/ui/activities/MainActivity.kt
@@ -204,22 +204,10 @@
             previewView.width.toFloat(), previewView.height.toFloat()
         )
 
-        val shouldUseFocusRegion = when (Build.PRODUCT) {
-            "OnePlus6", "OnePlus6T" -> false
-            else -> true
-        }
-
-        val autoFocusPoint = if (shouldUseFocusRegion) {
-            factory.createPoint(
-                previewView.width / 2.0f,
-                previewView.height / 2.0f, qrOverlay.size
-            )
-        } else {
-            factory.createPoint(
-                previewView.width / 2.0f,
-                previewView.height / 2.0f
-            )
-        }
+        val autoFocusPoint = factory.createPoint(
+            previewView.width / 2.0f,
+            previewView.height / 2.0f, QROverlay.RATIO
+        )
 
         camConfig.camera?.cameraControl?.startFocusAndMetering(
             FocusMeteringAction.Builder(autoFocusPoint).disableAutoCancel().build()
@@ -887,7 +875,7 @@
                     (mainFrame.layoutParams as ViewGroup.MarginLayoutParams).let {
                         it.setMargins(
                             it.leftMargin,
-                            insets.top,
+                            (8 * resources.displayMetrics.density.toInt()) + insets.top,
                             it.rightMargin,
                             it.bottomMargin,
                         )
@@ -1008,16 +996,11 @@
 
                     val previewHeight169 = previewContainer.width * 16 / 9
 
-                    val previewHeight43 = previewContainer.width * 4 / 3
-
                     val extraHeight169 = previewContainer.height -
                             previewHeight169 -
                             tabLayout.height -
                             10 * resources.displayMetrics.density.toInt()
 
-                    val halfOfExtraHeight = (previewContainer.height -
-                            previewHeight43) / 2
-
                     tabLayout.layoutParams =
                         (tabLayout.layoutParams as ViewGroup.MarginLayoutParams).let {
 
@@ -1035,14 +1018,6 @@
                             it
                         }
 
-                    qrScanToggles.layoutParams =
-                        (qrScanToggles.layoutParams as ViewGroup.MarginLayoutParams).let {
-
-                            it.height = halfOfExtraHeight
-
-                            it
-                        }
-
                     return true
                 }
 
diff --git a/app/src/main/java/app/grapheneos/camera/ui/activities/MoreSettings.kt b/app/src/main/java/app/grapheneos/camera/ui/activities/MoreSettings.kt
index 940af4f..c49e321 100644
--- a/app/src/main/java/app/grapheneos/camera/ui/activities/MoreSettings.kt
+++ b/app/src/main/java/app/grapheneos/camera/ui/activities/MoreSettings.kt
@@ -1,5 +1,6 @@
 package app.grapheneos.camera.ui.activities
 
+import android.annotation.SuppressLint
 import android.content.Context
 import android.content.Intent
 import android.graphics.Rect
@@ -132,13 +133,6 @@
             dialog.show()
         }
 
-        val sLS = binding.storageLocationSetting
-        sLS.visibility = if (showStorageSettings) {
-            View.VISIBLE
-        } else {
-            View.GONE
-        }
-
         pQField = binding.photoQuality
 
         if (camConfig.photoQuality != 0) {
@@ -206,9 +200,29 @@
             sIAPToggle.performClick()
         }
 
+        val sLS = binding.storageLocationSetting
         sLS.setOnClickListener {
             sLField.performClick()
         }
+
+        val zslSetting = binding.zslSetting
+        if (camConfig.isZslSupported) {
+            zslSetting.visibility = View.VISIBLE
+
+            val zslToggle = binding.zslSettingToggle
+            zslToggle.isChecked = camConfig.enableZsl
+            zslToggle.setOnClickListener {
+                camConfig.enableZsl = !camConfig.enableZsl
+            }
+
+            zslSetting.setOnClickListener {
+                zslToggle.performClick()
+            }
+        }
+
+        if (!showStorageSettings) {
+            binding.storageLocationSettings.visibility = View.GONE
+        }
     }
 
     override fun dispatchTouchEvent(event: MotionEvent): Boolean {
diff --git a/app/src/main/res/anim/slide_down.xml b/app/src/main/res/anim/slide_down.xml
index d2279b1..aa5e55f 100644
--- a/app/src/main/res/anim/slide_down.xml
+++ b/app/src/main/res/anim/slide_down.xml
@@ -6,8 +6,8 @@
 
     <scale
         android:duration="@android:integer/config_shortAnimTime"
-        android:fromXScale="0.0"
-        android:fromYScale="0.0"
+        android:fromXScale="-2.0"
+        android:fromYScale="-2.0"
         android:pivotX="50%"
         android:pivotY="0%"
         android:toXScale="1.0"
diff --git a/app/src/main/res/anim/slide_up.xml b/app/src/main/res/anim/slide_up.xml
index c6555b1..775aedc 100644
--- a/app/src/main/res/anim/slide_up.xml
+++ b/app/src/main/res/anim/slide_up.xml
@@ -10,8 +10,8 @@
         android:fromYScale="1.0"
         android:pivotX="50%"
         android:pivotY="0%"
-        android:toXScale="0.0"
-        android:toYScale="0.0"/>
+        android:toXScale="-2.0"
+        android:toYScale="-2.0"/>
 
     <translate
         android:duration="@android:integer/config_shortAnimTime"
diff --git a/app/src/main/res/drawable/add.xml b/app/src/main/res/drawable/add.xml
deleted file mode 100644
index 4c69dbd..0000000
--- a/app/src/main/res/drawable/add.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<vector
-    android:height="24dp"
-    android:tint="?android:textColorPrimary"
-    android:viewportHeight="24"
-    android:viewportWidth="24"
-    android:width="24dp"
-    xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <path
-        android:fillColor="@android:color/white"
-        android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
-</vector>
diff --git a/app/src/main/res/drawable/remove.xml b/app/src/main/res/drawable/remove.xml
deleted file mode 100644
index 4dc92ec..0000000
--- a/app/src/main/res/drawable/remove.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<vector
-    android:height="24dp"
-    android:tint="?android:textColorPrimary"
-    android:viewportHeight="24"
-    android:viewportWidth="24"
-    android:width="24dp"
-    xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <path
-        android:fillColor="?android:textColorPrimary"
-        android:pathData="M19,13H5v-2h14v2z"/>
-</vector>
diff --git a/app/src/main/res/drawable/zsl.xml b/app/src/main/res/drawable/zsl.xml
new file mode 100644
index 0000000..2b62257
--- /dev/null
+++ b/app/src/main/res/drawable/zsl.xml
@@ -0,0 +1,13 @@
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="24dp"
+    android:tint="?android:textColorPrimary"
+    android:viewportHeight="24"
+    android:viewportWidth="24"
+    android:width="24dp">
+
+    <path
+        android:fillColor="?android:textColorPrimary"
+        android:pathData="M1,5h2v14L1,19zM5,5h2v14L5,19zM22,5L10,5c-0.55,0 -1,0.45 -1,1v12c0,0.55 0.45,1 1,1h12c0.55,0 1,-0.45 1,-1L23,6c0,-0.55 -0.45,-1 -1,-1zM11,17l2.5,-3.15L15.29,16l2.5,-3.22L21,17L11,17z"/>
+
+</vector>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index f4ea36a..5eb227f 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -17,8 +17,7 @@
         <FrameLayout
             android:id="@+id/main_frame"
             android:layout_height="match_parent"
-            android:layout_width="match_parent"
-            android:paddingTop="8dp">
+            android:layout_width="match_parent">
 
             <androidx.constraintlayout.widget.ConstraintLayout
                 android:id="@+id/preview_container"
@@ -125,12 +124,22 @@
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"/>
 
-            <app.grapheneos.camera.ui.QROverlay
-                android:id="@+id/qr_overlay"
-                android:visibility="invisible"
-                android:layout_width="match_parent"
+            <androidx.constraintlayout.widget.ConstraintLayout
                 android:layout_height="match_parent"
-                android:layerType="software"/>
+                android:layout_width="match_parent">
+
+                <app.grapheneos.camera.ui.QROverlay
+                    android:id="@+id/qr_overlay"
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:visibility="invisible"
+                    app:layout_constraintDimensionRatio="H,9:16"
+                    app:layout_constraintTop_toTopOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    android:layerType="software"/>
+
+            </androidx.constraintlayout.widget.ConstraintLayout>
 
             <ImageView
                 android:layout_width="84dp"
@@ -142,6 +151,7 @@
 
             <ImageView
                 android:id="@+id/main_overlay"
+                android:scaleType="fitStart"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:contentDescription="@string/loading_camera"/>
@@ -424,24 +434,6 @@
         <FrameLayout
             android:layout_height="26dp"
             android:layout_width="26dp"
-            android:layout_marginStart="12dp"
-            android:layout_marginTop="12dp"
-            android:layout_alignParentTop="true"
-            android:layout_alignParentStart="true">
-
-            <androidx.viewpager2.widget.ViewPager2
-                android:id="@+id/flash_pager"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:background="?actionBarItemBackground"
-                android:orientation="vertical"
-                android:contentDescription="@string/flash_mode"/>
-
-        </FrameLayout>
-
-        <FrameLayout
-            android:layout_height="26dp"
-            android:layout_width="26dp"
             android:layout_marginEnd="16dp"
             android:layout_marginTop="16dp"
             android:layout_alignParentTop="true"
diff --git a/app/src/main/res/layout/more_settings.xml b/app/src/main/res/layout/more_settings.xml
index e3cddb4..4ca6f52 100644
--- a/app/src/main/res/layout/more_settings.xml
+++ b/app/src/main/res/layout/more_settings.xml
@@ -15,550 +15,634 @@
         android:orientation="vertical"
         android:paddingTop="?actionBarSize">
 
-        <TextView
-            android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
-            android:text="@string/general"
-            android:textColor="?android:colorAccent"
-            android:layout_marginStart="68dp"
-            android:layout_marginVertical="12dp"
-            android:textSize="14sp"
-            android:textStyle="bold"/>
-
         <LinearLayout
-            android:id="@+id/gyroscope_setting"
+            android:id="@+id/general_settings"
+            android:layout_height="match_parent"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:background="?android:attr/selectableItemBackground"
-            android:focusable="true"
-            android:clickable="true"
-            android:orientation="horizontal"
-            android:paddingTop="8dp"
-            android:paddingBottom="10dp"
-            android:paddingStart="10dp"
-            android:paddingEnd="6dp">
+            android:orientation="vertical">
 
-            <ImageView
-                android:id="@+id/gyroscope_setting_icon"
-                android:src="@drawable/straighten"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
-                android:contentDescription="@string/save_image_as_previewed"
-                android:paddingStart="4dp"
-                android:paddingEnd="8dp"/>
-
-            <LinearLayout
-                android:layout_width="0dp"
+            <TextView
                 android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_marginEnd="4dp"
-                android:orientation="vertical">
-
-                <TextView
-                    android:id="@+id/gyroscope_setting_title"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/gyroscope_suggestions"
-                    android:layout_marginStart="10dp"
-                    android:paddingBottom="2dp"
-                    android:textColor="?android:textColorPrimary"
-                    android:textSize="16sp"/>
-
-                <TextView
-                    android:id="@+id/gyroscope_setting_description"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/gyroscope_setting_desc"
-                    android:paddingStart="10dp"
-                    android:textSize="14sp"
-                    tools:ignore="RtlSymmetry"/>
-
-            </LinearLayout>
-
-            <androidx.appcompat.widget.SwitchCompat
-                android:id="@+id/gyroscope_setting_switch"
                 android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="end|center_vertical"
-                android:layout_marginEnd="0dp"/>
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/camera_sounds_setting"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:background="?android:attr/selectableItemBackground"
-            android:paddingTop="8dp"
-            android:paddingBottom="10dp"
-            android:paddingStart="10dp"
-            android:paddingEnd="6dp"
-            android:clickable="true"
-            android:focusable="true">
-
-            <ImageView
-                android:id="@+id/camera_sounds_icon"
-                android:src="@drawable/volume_up"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
-                android:contentDescription="@string/camera_sounds"
-                android:paddingStart="4dp"
-                android:paddingEnd="8dp"/>
+                android:text="@string/general"
+                android:textColor="?android:colorAccent"
+                android:layout_marginStart="68dp"
+                android:layout_marginVertical="12dp"
+                android:textSize="14sp"
+                android:textStyle="bold"/>
 
             <LinearLayout
-                android:layout_width="0dp"
+                android:id="@+id/gyroscope_setting"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_marginEnd="4dp"
-                android:orientation="vertical">
+                android:background="?android:attr/selectableItemBackground"
+                android:focusable="true"
+                android:clickable="true"
+                android:orientation="horizontal"
+                android:paddingTop="8dp"
+                android:paddingBottom="10dp"
+                android:paddingStart="10dp"
+                android:paddingEnd="6dp">
 
-                <TextView
-                    android:id="@+id/camera_sounds_title"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/camera_sounds"
-                    android:layout_marginStart="10dp"
-                    android:paddingBottom="2dp"
-                    android:textColor="?android:textColorPrimary"
-                    android:textSize="16sp"/>
-
-                <TextView
-                    android:id="@+id/camera_sounds_description"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/camera_sounds_desc"
-                    android:paddingStart="10dp"
-                    android:textSize="14sp"
-                    tools:ignore="RtlSymmetry"/>
-
-            </LinearLayout>
-
-            <androidx.appcompat.widget.SwitchCompat
-                android:id="@+id/camera_sounds_switch"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="end|center_vertical"
-                android:layout_marginEnd="0dp"/>
-
-        </LinearLayout>
-
-        <TextView
-            android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
-            android:text="@string/photo"
-            android:textColor="?android:colorAccent"
-            android:layout_marginStart="68dp"
-            android:layout_marginVertical="12dp"
-            android:textSize="14sp"
-            android:textStyle="bold"/>
-
-        <LinearLayout
-            android:id="@+id/save_image_as_preview_setting"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:background="?android:attr/selectableItemBackground"
-            android:paddingTop="8dp"
-            android:paddingBottom="10dp"
-            android:paddingStart="10dp"
-            android:paddingEnd="6dp"
-            android:clickable="true"
-            android:focusable="true">
-
-            <ImageView
-                android:id="@+id/save_image_as_preview_icon"
-                android:src="@drawable/selfie_preview"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
-                android:contentDescription="@string/save_image_as_previewed"
-                android:paddingStart="4dp"
-                android:paddingEnd="8dp"/>
-
-            <LinearLayout
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_marginEnd="4dp"
-                android:orientation="vertical">
-
-                <TextView
-                    android:id="@+id/save_image_as_preview_title"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/save_image_as_previewed"
-                    android:layout_marginStart="10dp"
-                    android:paddingBottom="2dp"
-                    android:textColor="?android:textColorPrimary"
-                    android:textSize="16sp"/>
-
-                <TextView
-                    android:id="@+id/save_image_as_preview_subtitle"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/save_as_image_preview_desc"
-                    android:paddingStart="10dp"
-                    android:textSize="14sp"
-                    tools:ignore="RtlSymmetry"/>
-
-            </LinearLayout>
-
-            <androidx.appcompat.widget.SwitchCompat
-                android:id="@+id/save_image_as_preview_toggle"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="end|center_vertical"
-                android:layout_marginEnd="0dp"/>
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/photo_quality_setting"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:background="?android:attr/selectableItemBackground"
-            android:paddingTop="8dp"
-            android:paddingBottom="10dp"
-            android:paddingStart="10dp"
-            android:paddingEnd="6dp"
-            android:clickable="true"
-            android:focusable="true">
-
-            <ImageView
-                android:id="@+id/photo_quality_icon"
-                android:src="@drawable/image_quality"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
-                android:contentDescription="@string/image_quality"
-                android:paddingStart="4dp"
-                android:paddingEnd="8dp"/>
-
-            <LinearLayout
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_marginEnd="4dp"
-                android:orientation="vertical">
-
-                <TextView
-                    android:id="@+id/photo_quality_title"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/image_quality"
-                    android:layout_marginStart="10dp"
-                    android:paddingBottom="2dp"
-                    android:textColor="?android:textColorPrimary"
-                    android:textSize="16sp"/>
-
-                <TextView
-                    android:id="@+id/photo_quality_subtitle"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/image_quality_desc"
-                    android:paddingStart="10dp"
-                    android:textSize="14sp"
-                    tools:ignore="RtlSymmetry"/>
-
-            </LinearLayout>
-
-            <LinearLayout
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:orientation="horizontal">
-
-                <com.google.android.material.textfield.TextInputLayout
-                    android:layout_height="match_parent"
-                    android:layout_width="wrap_content"
-                    android:gravity="center"
-                    android:layout_gravity="center"
-                    app:boxBackgroundMode="none"
-                    android:clickable="true"
-                    android:focusableInTouchMode="true">
-
-                    <EditText
-                        android:id="@+id/photo_quality"
-                        android:layout_width="36dp"
-                        android:layout_height="wrap_content"
-                        android:layout_marginStart="2dp"
-                        android:paddingTop="15dp"
-                        android:textSize="16sp"
-                        android:maxLength="3"
-                        android:labelFor="@id/photo_quality_setting"
-                        android:textAlignment="center"
-                        android:layout_gravity="center"
-                        android:importantForAutofill="no"
-                        android:inputType="number"
-                        android:imeOptions="actionDone"/>
-
-                </com.google.android.material.textfield.TextInputLayout>
-
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/percent_symbol"
-                    android:textSize="16sp"
-                    android:paddingTop="16dp"
-                    android:layout_gravity="center"
-                    android:layout_marginEnd="4dp"/>
-
-            </LinearLayout>
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/remove_exif_setting"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:background="?android:attr/selectableItemBackground"
-            android:paddingTop="8dp"
-            android:paddingBottom="10dp"
-            android:paddingStart="10dp"
-            android:paddingEnd="6dp"
-            android:clickable="true"
-            android:focusable="true">
-
-            <ImageView
-                android:id="@+id/remove_exif_icon"
-                android:src="@drawable/info_adaptable"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
-                android:contentDescription="@string/save_image_as_previewed"
-                android:paddingStart="4dp"
-                android:paddingEnd="8dp"/>
-
-            <LinearLayout
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_marginEnd="4dp"
-                android:orientation="vertical">
-
-                <TextView
-                    android:id="@+id/remove_exif_title"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/remove_exif_title"
-                    android:layout_marginStart="10dp"
-                    android:paddingBottom="2dp"
-                    android:textColor="?android:textColorPrimary"
-                    android:textSize="16sp"/>
-
-                <TextView
-                    android:id="@+id/remove_exif_subtitle"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/remove_exif_subtitle"
-                    android:paddingStart="10dp"
-                    android:textSize="14sp"
-                    tools:ignore="RtlSymmetry"/>
-
-            </LinearLayout>
-
-            <androidx.appcompat.widget.SwitchCompat
-                android:id="@+id/remove_exif_toggle"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="end|center_vertical"
-                android:layout_marginEnd="0dp"/>
-
-        </LinearLayout>
-
-        <TextView
-            android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
-            android:text="@string/storage"
-            android:textColor="?android:colorAccent"
-            android:layout_marginStart="68dp"
-            android:layout_marginVertical="12dp"
-            android:textSize="14sp"
-            android:textStyle="bold"/>
-
-        <LinearLayout
-            android:id="@+id/storage_location_setting"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:background="?android:attr/selectableItemBackground"
-            android:focusable="true"
-            android:clickable="true"
-            android:orientation="horizontal"
-            android:paddingTop="8dp"
-            android:paddingBottom="10dp"
-            android:paddingStart="10dp"
-            android:paddingEnd="6dp">
-
-            <ImageView
-                android:id="@+id/storage_location_icon"
-                android:src="@drawable/storage"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
-                android:contentDescription="@string/save_image_as_previewed"
-                android:paddingStart="4dp"
-                android:paddingEnd="8dp"/>
-
-            <LinearLayout
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_marginEnd="4dp"
-                android:orientation="vertical">
-
-                <TextView
-                    android:id="@+id/storage_location_title"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/storage_location"
-                    android:layout_marginStart="10dp"
-                    android:textColor="?android:textColorPrimary"
-                    android:textSize="16sp"/>
+                <ImageView
+                    android:id="@+id/gyroscope_setting_icon"
+                    android:src="@drawable/straighten"
+                    android:layout_width="48dp"
+                    android:layout_height="48dp"
+                    android:contentDescription="@string/save_image_as_previewed"
+                    android:paddingStart="4dp"
+                    android:paddingEnd="8dp"/>
 
                 <LinearLayout
-                    android:layout_width="match_parent"
+                    android:layout_width="0dp"
                     android:layout_height="wrap_content"
-                    android:orientation="horizontal">
+                    android:layout_weight="1"
+                    android:layout_marginEnd="4dp"
+                    android:orientation="vertical">
 
-                    <EditText
-                        android:layout_weight="1"
-                        android:id="@+id/storage_location_field"
-                        android:hint="@string/storage_location"
-                        android:layout_width="0dp"
-                        android:cursorVisible="false"
-                        android:layout_height="wrap_content"
-                        android:focusable="false"
-                        android:paddingStart="10dp"
-                        android:paddingEnd="0dp"
-                        android:textSize="14sp"
-                        android:drawableStart="@drawable/folder"
-                        android:drawablePadding="6dp"
-                        android:importantForAutofill="no"
-                        android:inputType="textNoSuggestions"/>
-
-                    <ImageButton
-                        android:id="@+id/refresh_storage_location"
+                    <TextView
+                        android:id="@+id/gyroscope_setting_title"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:src="@drawable/refresh"
-                        android:layout_gravity="center_vertical"
-                        android:contentDescription="@string/revert_back_to_dcim"/>
+                        android:text="@string/gyroscope_suggestions"
+                        android:layout_marginStart="10dp"
+                        android:paddingBottom="2dp"
+                        android:textColor="?android:textColorPrimary"
+                        android:textSize="16sp"/>
+
+                    <TextView
+                        android:id="@+id/gyroscope_setting_description"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/gyroscope_setting_desc"
+                        android:paddingStart="10dp"
+                        android:textSize="14sp"
+                        tools:ignore="RtlSymmetry"/>
+
+                </LinearLayout>
+
+                <androidx.appcompat.widget.SwitchCompat
+                    android:id="@+id/gyroscope_setting_switch"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="end|center_vertical"
+                    android:layout_marginEnd="0dp"/>
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/camera_sounds_setting"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:background="?android:attr/selectableItemBackground"
+                android:paddingTop="8dp"
+                android:paddingBottom="10dp"
+                android:paddingStart="10dp"
+                android:paddingEnd="6dp"
+                android:clickable="true"
+                android:focusable="true">
+
+                <ImageView
+                    android:id="@+id/camera_sounds_icon"
+                    android:src="@drawable/volume_up"
+                    android:layout_width="48dp"
+                    android:layout_height="48dp"
+                    android:contentDescription="@string/camera_sounds"
+                    android:paddingStart="4dp"
+                    android:paddingEnd="8dp"/>
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:layout_marginEnd="4dp"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:id="@+id/camera_sounds_title"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/camera_sounds"
+                        android:layout_marginStart="10dp"
+                        android:paddingBottom="2dp"
+                        android:textColor="?android:textColorPrimary"
+                        android:textSize="16sp"/>
+
+                    <TextView
+                        android:id="@+id/camera_sounds_description"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/camera_sounds_desc"
+                        android:paddingStart="10dp"
+                        android:textSize="14sp"
+                        tools:ignore="RtlSymmetry"/>
+
+                </LinearLayout>
+
+                <androidx.appcompat.widget.SwitchCompat
+                    android:id="@+id/camera_sounds_switch"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="end|center_vertical"
+                    android:layout_marginEnd="0dp"/>
+
+            </LinearLayout>
+
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/photo_settings"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical">
+
+            <TextView
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/photo"
+                android:textColor="?android:colorAccent"
+                android:layout_marginStart="68dp"
+                android:layout_marginVertical="12dp"
+                android:textSize="14sp"
+                android:textStyle="bold"/>
+
+            <LinearLayout
+                android:id="@+id/zsl_setting"
+                android:visibility="gone"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:background="?android:attr/selectableItemBackground"
+                android:paddingTop="8dp"
+                android:paddingBottom="10dp"
+                android:paddingStart="10dp"
+                android:paddingEnd="6dp"
+                android:clickable="true"
+                android:focusable="true">
+
+                <ImageView
+                    android:id="@+id/zsl_icon"
+                    android:src="@drawable/zsl"
+                    android:layout_width="48dp"
+                    android:layout_height="48dp"
+                    android:contentDescription="@string/zsl_setting_title"
+                    android:paddingStart="4dp"
+                    android:paddingEnd="8dp"/>
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:layout_marginEnd="4dp"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:id="@+id/zsl_setting_title"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/zsl_setting_title"
+                        android:layout_marginStart="10dp"
+                        android:paddingBottom="2dp"
+                        android:textColor="?android:textColorPrimary"
+                        android:textSize="16sp"/>
+
+                    <TextView
+                        android:id="@+id/zsl_setting_subtitle"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/zsl_setting_desc"
+                        android:paddingStart="10dp"
+                        android:textSize="14sp"
+                        tools:ignore="RtlSymmetry"/>
+
+                </LinearLayout>
+
+                <androidx.appcompat.widget.SwitchCompat
+                    android:id="@+id/zsl_setting_toggle"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="end|center_vertical"
+                    android:layout_marginEnd="0dp"/>
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/save_image_as_preview_setting"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:background="?android:attr/selectableItemBackground"
+                android:paddingTop="8dp"
+                android:paddingBottom="10dp"
+                android:paddingStart="10dp"
+                android:paddingEnd="6dp"
+                android:clickable="true"
+                android:focusable="true">
+
+                <ImageView
+                    android:id="@+id/save_image_as_preview_icon"
+                    android:src="@drawable/selfie_preview"
+                    android:layout_width="48dp"
+                    android:layout_height="48dp"
+                    android:contentDescription="@string/save_image_as_previewed"
+                    android:paddingStart="4dp"
+                    android:paddingEnd="8dp"/>
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:layout_marginEnd="4dp"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:id="@+id/save_image_as_preview_title"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/save_image_as_previewed"
+                        android:layout_marginStart="10dp"
+                        android:paddingBottom="2dp"
+                        android:textColor="?android:textColorPrimary"
+                        android:textSize="16sp"/>
+
+                    <TextView
+                        android:id="@+id/save_image_as_preview_subtitle"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/save_as_image_preview_desc"
+                        android:paddingStart="10dp"
+                        android:textSize="14sp"
+                        tools:ignore="RtlSymmetry"/>
+
+                </LinearLayout>
+
+                <androidx.appcompat.widget.SwitchCompat
+                    android:id="@+id/save_image_as_preview_toggle"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="end|center_vertical"
+                    android:layout_marginEnd="0dp"/>
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/photo_quality_setting"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:background="?android:attr/selectableItemBackground"
+                android:paddingTop="8dp"
+                android:paddingBottom="10dp"
+                android:paddingStart="10dp"
+                android:paddingEnd="6dp"
+                android:clickable="true"
+                android:focusable="true">
+
+                <ImageView
+                    android:id="@+id/photo_quality_icon"
+                    android:src="@drawable/image_quality"
+                    android:layout_width="48dp"
+                    android:layout_height="48dp"
+                    android:contentDescription="@string/image_quality"
+                    android:paddingStart="4dp"
+                    android:paddingEnd="8dp"/>
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:layout_marginEnd="4dp"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:id="@+id/photo_quality_title"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/image_quality"
+                        android:layout_marginStart="10dp"
+                        android:paddingBottom="2dp"
+                        android:textColor="?android:textColorPrimary"
+                        android:textSize="16sp"/>
+
+                    <TextView
+                        android:id="@+id/photo_quality_subtitle"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/image_quality_desc"
+                        android:paddingStart="10dp"
+                        android:textSize="14sp"
+                        tools:ignore="RtlSymmetry"/>
+
+                </LinearLayout>
+
+                <LinearLayout
+                    android:layout_width="wrap_content"
+                    android:layout_height="match_parent"
+                    android:orientation="horizontal">
+
+                    <com.google.android.material.textfield.TextInputLayout
+                        android:layout_height="match_parent"
+                        android:layout_width="wrap_content"
+                        android:gravity="center"
+                        android:layout_gravity="center"
+                        app:boxBackgroundMode="none"
+                        android:clickable="true"
+                        android:focusableInTouchMode="true">
+
+                        <EditText
+                            android:id="@+id/photo_quality"
+                            android:layout_width="36dp"
+                            android:layout_height="wrap_content"
+                            android:layout_marginStart="2dp"
+                            android:paddingTop="15dp"
+                            android:textSize="16sp"
+                            android:maxLength="3"
+                            android:labelFor="@id/photo_quality_setting"
+                            android:textAlignment="center"
+                            android:layout_gravity="center"
+                            android:importantForAutofill="no"
+                            android:inputType="number"
+                            android:imeOptions="actionDone"/>
+
+                    </com.google.android.material.textfield.TextInputLayout>
+
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/percent_symbol"
+                        android:textSize="16sp"
+                        android:paddingTop="16dp"
+                        android:layout_gravity="center"
+                        android:layout_marginEnd="4dp"/>
 
                 </LinearLayout>
 
             </LinearLayout>
 
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/image_format_setting"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:background="?android:attr/selectableItemBackground"
-            android:paddingTop="8dp"
-            android:paddingBottom="10dp"
-            android:paddingStart="10dp"
-            android:paddingEnd="6dp"
-            android:clickable="true"
-            android:focusable="true"
-            android:visibility="gone">
-
-            <ImageView
-                android:id="@+id/image_format_setting_icon"
-                android:src="@drawable/rename"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
-                android:contentDescription="@string/image_file_name_format"
-                android:paddingStart="4dp"
-                android:paddingEnd="8dp"/>
-
             <LinearLayout
-                android:layout_width="0dp"
+                android:id="@+id/remove_exif_setting"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_marginEnd="4dp"
-                android:orientation="vertical">
+                android:orientation="horizontal"
+                android:background="?android:attr/selectableItemBackground"
+                android:paddingTop="8dp"
+                android:paddingBottom="10dp"
+                android:paddingStart="10dp"
+                android:paddingEnd="6dp"
+                android:clickable="true"
+                android:focusable="true">
 
-                <TextView
-                    android:id="@+id/image_format_setting_title"
+                <ImageView
+                    android:id="@+id/remove_exif_icon"
+                    android:src="@drawable/info_adaptable"
+                    android:layout_width="48dp"
+                    android:layout_height="48dp"
+                    android:contentDescription="@string/save_image_as_previewed"
+                    android:paddingStart="4dp"
+                    android:paddingEnd="8dp"/>
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:layout_marginEnd="4dp"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:id="@+id/remove_exif_title"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/remove_exif_title"
+                        android:layout_marginStart="10dp"
+                        android:paddingBottom="2dp"
+                        android:textColor="?android:textColorPrimary"
+                        android:textSize="16sp"/>
+
+                    <TextView
+                        android:id="@+id/remove_exif_subtitle"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/remove_exif_subtitle"
+                        android:paddingStart="10dp"
+                        android:textSize="14sp"
+                        tools:ignore="RtlSymmetry"/>
+
+                </LinearLayout>
+
+                <androidx.appcompat.widget.SwitchCompat
+                    android:id="@+id/remove_exif_toggle"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:text="@string/image_file_name_format"
-                    android:layout_marginStart="10dp"
-                    android:paddingBottom="2dp"
-                    android:textColor="?android:textColorPrimary"
-                    android:textSize="16sp"/>
-
-                <AutoCompleteTextView
-                    android:id="@+id/image_format_setting_field"
-                    android:importantForAutofill="no"
-                    android:inputType="text"
-                    android:labelFor="@id/image_format_setting_title"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:paddingStart="10dp"
-                    android:paddingEnd="0dp"
-                    android:textSize="14sp"
-                    android:imeOptions="actionDone"
-                    tools:ignore="LabelFor"/>
+                    android:layout_gravity="end|center_vertical"
+                    android:layout_marginEnd="0dp"/>
 
             </LinearLayout>
 
         </LinearLayout>
 
         <LinearLayout
-            android:id="@+id/video_format_setting"
+            android:id="@+id/storage_location_settings"
+            android:layout_height="match_parent"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal"
-            android:background="?android:attr/selectableItemBackground"
-            android:paddingTop="8dp"
-            android:paddingBottom="10dp"
-            android:paddingStart="10dp"
-            android:paddingEnd="6dp"
-            android:clickable="true"
-            android:focusable="true"
-            android:visibility="gone">
+            android:orientation="vertical">
 
-            <ImageView
-                android:id="@+id/video_format_setting_icon"
-                android:src="@drawable/rename"
-                android:layout_width="48dp"
-                android:layout_height="48dp"
-                android:contentDescription="@string/video_file_name_format"
-                android:paddingStart="4dp"
-                android:paddingEnd="8dp"/>
+            <TextView
+                android:layout_height="wrap_content"
+                android:layout_width="wrap_content"
+                android:text="@string/storage"
+                android:textColor="?android:colorAccent"
+                android:layout_marginStart="68dp"
+                android:layout_marginVertical="12dp"
+                android:textSize="14sp"
+                android:textStyle="bold"/>
 
             <LinearLayout
-                android:layout_width="0dp"
+                android:id="@+id/storage_location_setting"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:layout_marginEnd="4dp"
-                android:orientation="vertical">
+                android:background="?android:attr/selectableItemBackground"
+                android:focusable="true"
+                android:clickable="true"
+                android:orientation="horizontal"
+                android:paddingTop="8dp"
+                android:paddingBottom="10dp"
+                android:paddingStart="10dp"
+                android:paddingEnd="6dp">
 
-                <TextView
-                    android:id="@+id/video_format_setting_title"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/video_file_name_format"
-                    android:layout_marginStart="10dp"
-                    android:paddingBottom="2dp"
-                    android:textColor="?android:textColorPrimary"
-                    android:textSize="16sp"/>
+                <ImageView
+                    android:id="@+id/storage_location_icon"
+                    android:src="@drawable/storage"
+                    android:layout_width="48dp"
+                    android:layout_height="48dp"
+                    android:contentDescription="@string/save_image_as_previewed"
+                    android:paddingStart="4dp"
+                    android:paddingEnd="8dp"/>
 
-                <AutoCompleteTextView
-                    android:id="@+id/video_format_setting_field"
-                    android:layout_width="match_parent"
+                <LinearLayout
+                    android:layout_width="0dp"
                     android:layout_height="wrap_content"
-                    android:labelFor="@id/video_format_setting_title"
-                    android:importantForAutofill="no"
-                    android:inputType="text"
-                    android:paddingStart="10dp"
-                    android:paddingEnd="0dp"
-                    android:textSize="14sp"
-                    android:imeOptions="actionDone"
-                    tools:ignore="LabelFor"/>
+                    android:layout_weight="1"
+                    android:layout_marginEnd="4dp"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:id="@+id/storage_location_title"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/storage_location"
+                        android:layout_marginStart="10dp"
+                        android:textColor="?android:textColorPrimary"
+                        android:textSize="16sp"/>
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:orientation="horizontal">
+
+                        <EditText
+                            android:layout_weight="1"
+                            android:id="@+id/storage_location_field"
+                            android:hint="@string/storage_location"
+                            android:layout_width="0dp"
+                            android:cursorVisible="false"
+                            android:layout_height="wrap_content"
+                            android:focusable="false"
+                            android:paddingStart="10dp"
+                            android:paddingEnd="0dp"
+                            android:textSize="14sp"
+                            android:drawableStart="@drawable/folder"
+                            android:drawablePadding="6dp"
+                            android:importantForAutofill="no"
+                            android:inputType="textNoSuggestions"/>
+
+                        <ImageButton
+                            android:id="@+id/refresh_storage_location"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:src="@drawable/refresh"
+                            android:layout_gravity="center_vertical"
+                            android:contentDescription="@string/revert_back_to_dcim"/>
+
+                    </LinearLayout>
+
+                </LinearLayout>
 
             </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/image_format_setting"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:background="?android:attr/selectableItemBackground"
+                android:paddingTop="8dp"
+                android:paddingBottom="10dp"
+                android:paddingStart="10dp"
+                android:paddingEnd="6dp"
+                android:clickable="true"
+                android:focusable="true"
+                android:visibility="gone">
+
+                <ImageView
+                    android:id="@+id/image_format_setting_icon"
+                    android:src="@drawable/rename"
+                    android:layout_width="48dp"
+                    android:layout_height="48dp"
+                    android:contentDescription="@string/image_file_name_format"
+                    android:paddingStart="4dp"
+                    android:paddingEnd="8dp"/>
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:layout_marginEnd="4dp"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:id="@+id/image_format_setting_title"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/image_file_name_format"
+                        android:layout_marginStart="10dp"
+                        android:paddingBottom="2dp"
+                        android:textColor="?android:textColorPrimary"
+                        android:textSize="16sp"/>
+
+                    <AutoCompleteTextView
+                        android:id="@+id/image_format_setting_field"
+                        android:importantForAutofill="no"
+                        android:inputType="text"
+                        android:labelFor="@id/image_format_setting_title"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:paddingStart="10dp"
+                        android:paddingEnd="0dp"
+                        android:textSize="14sp"
+                        android:imeOptions="actionDone"
+                        tools:ignore="LabelFor"/>
+
+                </LinearLayout>
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/video_format_setting"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:background="?android:attr/selectableItemBackground"
+                android:paddingTop="8dp"
+                android:paddingBottom="10dp"
+                android:paddingStart="10dp"
+                android:paddingEnd="6dp"
+                android:clickable="true"
+                android:focusable="true"
+                android:visibility="gone">
+
+                <ImageView
+                    android:id="@+id/video_format_setting_icon"
+                    android:src="@drawable/rename"
+                    android:layout_width="48dp"
+                    android:layout_height="48dp"
+                    android:contentDescription="@string/video_file_name_format"
+                    android:paddingStart="4dp"
+                    android:paddingEnd="8dp"/>
+
+                <LinearLayout
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1"
+                    android:layout_marginEnd="4dp"
+                    android:orientation="vertical">
+
+                    <TextView
+                        android:id="@+id/video_format_setting_title"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="@string/video_file_name_format"
+                        android:layout_marginStart="10dp"
+                        android:paddingBottom="2dp"
+                        android:textColor="?android:textColorPrimary"
+                        android:textSize="16sp"/>
+
+                    <AutoCompleteTextView
+                        android:id="@+id/video_format_setting_field"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:labelFor="@id/video_format_setting_title"
+                        android:importantForAutofill="no"
+                        android:inputType="text"
+                        android:paddingStart="10dp"
+                        android:paddingEnd="0dp"
+                        android:textSize="14sp"
+                        android:imeOptions="actionDone"
+                        tools:ignore="LabelFor"/>
+
+                </LinearLayout>
+            </LinearLayout>
+
         </LinearLayout>
 
     </LinearLayout>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e458b18..781e139 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,4 +1,4 @@
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools">
     <string name="camera_permission_dialog_title">Camera permission required</string>
     <string name="camera_permission_dialog_message">
         The app needs permission to access the camera to function. Please provide the required permission via Settings in order to use this app.
@@ -85,8 +85,6 @@
     <string name="image_quality">Image Quality</string>
     <string name="image_quality_desc" formatted="false">Adjust the quality of an image captured by the app from 1% to 100%. This field can be left empty to avoid explicitly setting the image quality.</string>
     <string name="photo">Photo</string>
-    <string name="increase_quality">Increase Quality</string>
-    <string name="decrease_quality">Decrease Quality</string>
     <string name="remove_exif_title">Remove EXIF data after capture</string>
     <string name="remove_exif_subtitle">Note: Geo-tagging/Location option is independent of this setting</string>
     <string name="degree_format">%d°</string>
@@ -104,7 +102,6 @@
 
     <string name="editing_permission_error">Could not read the image due to the editor not providing read access.</string>
     <string name="editing_unexpected_error">An unexpected error occurred after editing.</string>
-    <string name="unexpected_error">An unexpected error occurred after editing.</string>
 
     <string name="unable_to_obtain_file_details">Unable to obtain file details</string>
 
@@ -134,6 +131,7 @@
     <string name="flash_unavailable_in_selected_mode">Flash is unavailable for the current mode.</string>
     <string name="front_camera_unavailable">Could not detect front camera. Please try again later!</string>
     <string name="rear_camera_unavailable">Could not detect rear camera. Please try again later!</string>
+    <string name="qr_rear_camera_unavailable">The rear camera seems to be unavailable. Using front camera for QR mode instead.</string>
     <string name="folder_not_found">Storage location not found</string>
     <string name="reverting_to_default_folder">Reverting back to default DCIM directory since the custom storage location that was previously selected seems to have been deleted. Please change the storage location to another folder (if required).</string>
     <string name="more_settings_unavailable_during_recording">Cannot switch activities when recording</string>
@@ -143,7 +141,6 @@
     <string name="four_by_three_unsupported_in_video">4:3 is not supported in video mode</string>
     <string name="flash_unavailable_in_current_mode">Flash/Torch is unavailable for this mode</string>
     <string name="unexpected_error_while_setting_focus_timeout">An unexpected error occurred while setting focus timeout</string>
-    <string name="unexpected_error_while_opening_gallery">An unexpected error occurred while opening the gallery</string>
     <string name="storage_location_updated">Storage location successfully updated to %s</string>
     <string name="no_directory_selected">No directory was selected by the picker</string>
     <string name="choose_storage_location">Choose storage location</string>
@@ -152,7 +149,7 @@
     <string name="reverted_to_default_directory">Switched back to the default storage location</string>
     <string name="already_using_default_directory">Already using the default storage location</string>
     <string name="photo_quality_was_set_to_auto">Photo quality was set to auto mode</string>
-    <string name="photo_quality_number_limit">Photo quality can only be between %1$d and %2$d</string>
+    <string name="photo_quality_number_limit" tools:ignore="PluralsCandidate">Photo quality can only be between %1$d and %2$d</string>
     <string name="image_taken_in_this_mode_does_not_contain_extra_data">Images taken in this mode don\'t contain extra EXIF data</string>
     <string name="file_already_exists">File exists at %s</string>
     <string name="file_does_not_exist">File does not exist at %s</string>
@@ -186,4 +183,6 @@
 
     <string name="main_storage">Main storage</string>
 
+    <string name="zsl_setting_title">Use ZSL in Latency mode</string>
+    <string name="zsl_setting_desc">Uses Zero Shutter Lag (ZSL) in Latency mode for faster capture. Certain devices may have a buggy implementation for this.</string>
 </resources>
diff --git a/build.gradle.kts b/build.gradle.kts
index 860101c..19356fa 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,11 +1,17 @@
 buildscript {
     repositories {
-        google()
-        mavenCentral()
+        // dependabot cannot handle google()
+        maven {
+            url = uri("https://dl.google.com/dl/android/maven2")
+        }
+        // dependabot cannot handle mavenCentral()
+        maven {
+            url = uri("https://repo.maven.apache.org/maven2")
+        }
     }
     dependencies {
-        classpath("com.android.tools.build:gradle:7.1.3")
-        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
+        classpath("com.android.tools.build:gradle:7.2.2")
+        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")
     }
 }
 
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 41d9927..249e583 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 5c51a4a..b916c04 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionSha256Sum=29e49b10984e585d8118b7d0bc452f944e386458df27371b49b4ac1dec4b7fda
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
+distributionSha256Sum=f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 1b6c787..a69d9cb 100755
--- a/gradlew
+++ b/gradlew
@@ -205,6 +205,12 @@
         org.gradle.wrapper.GradleWrapperMain \
         "$@"
 
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+    die "xargs is not available"
+fi
+
 # Use "xargs" to parse quoted args.
 #
 # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
diff --git a/gradlew.bat b/gradlew.bat
index ac1b06f..53a6b23 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -14,7 +14,7 @@
 @rem limitations under the License.

 @rem

 

-@if "%DEBUG%" == "" @echo off

+@if "%DEBUG%"=="" @echo off

 @rem ##########################################################################

 @rem

 @rem  Gradle startup script for Windows

@@ -25,7 +25,7 @@
 if "%OS%"=="Windows_NT" setlocal

 

 set DIRNAME=%~dp0

-if "%DIRNAME%" == "" set DIRNAME=.

+if "%DIRNAME%"=="" set DIRNAME=.

 set APP_BASE_NAME=%~n0

 set APP_HOME=%DIRNAME%

 

@@ -40,7 +40,7 @@
 

 set JAVA_EXE=java.exe

 %JAVA_EXE% -version >NUL 2>&1

-if "%ERRORLEVEL%" == "0" goto execute

+if %ERRORLEVEL% equ 0 goto execute

 

 echo.

 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

@@ -75,13 +75,15 @@
 

 :end

 @rem End local scope for the variables with windows NT shell

-if "%ERRORLEVEL%"=="0" goto mainEnd

+if %ERRORLEVEL% equ 0 goto mainEnd

 

 :fail

 rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of

 rem the _cmd.exe /c_ return code!

-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1

-exit /b 1

+set EXIT_CODE=%ERRORLEVEL%

+if %EXIT_CODE% equ 0 set EXIT_CODE=1

+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%

+exit /b %EXIT_CODE%

 

 :mainEnd

 if "%OS%"=="Windows_NT" endlocal