From ad19b9e645b4f302096fb7842208d2f395274ca8 Mon Sep 17 00:00:00 2001 From: Hardcore Sushi Date: Mon, 8 May 2023 20:58:54 +0200 Subject: [PATCH] Update dependencies --- TODO.md | 2 +- app/build.gradle | 2 +- app/libgocryptfs | 2 +- .../sushi/hardcore/droidfs/CameraActivity.kt | 30 ++++++++----------- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/TODO.md b/TODO.md index 8af66e8..5f96c46 100644 --- a/TODO.md +++ b/TODO.md @@ -14,7 +14,7 @@ Here's a list of features that it would be nice to have in DroidFS. As this is a ## Encryption software support - [Shufflecake](https://shufflecake.net): plausible deniability for multiple hidden filesystems on Linux (would be absolutely awesome to have but quite difficult) -- [eCryptfs](https://www.kernel.org/doc/html/latest/filesystems/ecryptfs.html): filesystem encryption at the kernel level +- [fscrypt](https://www.kernel.org/doc/html/latest/filesystems/fscrypt.html): filesystem encryption at the kernel level ## Health - F-Droid ABI split diff --git a/app/build.gradle b/app/build.gradle index a039c1a..0611865 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -109,7 +109,7 @@ dependencies { implementation "androidx.sqlite:sqlite-ktx:2.3.1" implementation "androidx.preference:preference-ktx:1.2.0" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" - implementation 'com.google.android.material:material:1.8.0' + implementation 'com.google.android.material:material:1.9.0' implementation 'com.github.bumptech.glide:glide:4.15.1' implementation "androidx.biometric:biometric-ktx:1.2.0-alpha05" diff --git a/app/libgocryptfs b/app/libgocryptfs index 6308adf..ab3e788 160000 --- a/app/libgocryptfs +++ b/app/libgocryptfs @@ -1 +1 @@ -Subproject commit 6308adf8e57379e1136f4f55ff0d7737c0d0a33b +Subproject commit ab3e7886767d31f32baebcd72ebe5f098a70d65b diff --git a/app/src/main/java/sushi/hardcore/droidfs/CameraActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/CameraActivity.kt index 77c1613..1b2c8cb 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/CameraActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/CameraActivity.kt @@ -2,10 +2,7 @@ package sushi.hardcore.droidfs import android.Manifest import android.annotation.SuppressLint -import android.content.Context import android.content.pm.PackageManager -import android.hardware.camera2.CameraCharacteristics -import android.hardware.camera2.CameraManager import android.os.Build import android.os.Bundle import android.text.InputType @@ -14,12 +11,10 @@ import android.view.* import android.view.animation.Animation import android.view.animation.LinearInterpolator import android.view.animation.RotateAnimation -import android.widget.ImageButton import android.widget.ImageView import android.widget.RelativeLayout import android.widget.Toast import androidx.annotation.RequiresApi -import androidx.camera.camera2.interop.Camera2CameraInfo import androidx.camera.core.AspectRatio import androidx.camera.core.Camera import androidx.camera.core.CameraSelector @@ -28,6 +23,7 @@ import androidx.camera.core.ImageCapture import androidx.camera.core.ImageCaptureException import androidx.camera.core.Preview import androidx.camera.core.UseCase +import androidx.camera.core.resolutionselector.ResolutionSelector import androidx.camera.extensions.ExtensionMode import androidx.camera.extensions.ExtensionsManager import androidx.camera.lifecycle.ProcessCameraProvider @@ -57,6 +53,8 @@ import java.io.ByteArrayOutputStream import java.text.SimpleDateFormat import java.util.* import java.util.concurrent.Executor +import kotlin.math.pow +import kotlin.math.sqrt @SuppressLint("RestrictedApi") class CameraActivity : BaseActivity(), SensorOrientationListener.Listener { @@ -381,11 +379,17 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener { imageCapture = ImageCapture.Builder() .setCaptureMode(captureMode) .setFlashMode(imageCapture?.flashMode ?: ImageCapture.FLASH_MODE_AUTO) - .apply { - currentResolution?.let { - setTargetResolution(it) + .setResolutionSelector(ResolutionSelector.Builder().setResolutionFilter { supportedSizes, _ -> + resolutions = supportedSizes.sortedBy { + -it.width*it.height } - } + currentResolution?.let { targetResolution -> + return@setResolutionFilter supportedSizes.sortedBy { + sqrt((it.width - targetResolution.width).toDouble().pow(2) + (it.height - targetResolution.height).toDouble().pow(2)) + } + } + supportedSizes + }.build()) .build() } @@ -412,14 +416,6 @@ class CameraActivity : BaseActivity(), SensorOrientationListener.Listener { } else { refreshImageCapture() camera = cameraProvider.bindToLifecycle(this, cameraSelector, cameraPreview, imageCapture) - if (resolutions == null) { - val info = Camera2CameraInfo.from(camera!!.cameraInfo) - val cameraManager = getSystemService(Context.CAMERA_SERVICE) as CameraManager - val characteristics = cameraManager.getCameraCharacteristics(info.cameraId) - characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)?.let { streamConfigurationMap -> - resolutions = streamConfigurationMap.getOutputSizes(imageCapture!!.imageFormat).map { it.swap() } - } - } imageCapture })!! adaptPreviewSize(currentUseCase.attachedSurfaceResolution!!.swap())