diff --git a/app/src/main/java/com/ti/m/GoodSoftware.kt b/app/src/main/java/com/ti/m/GoodSoftware.kt index 13908be..2a9758c 100644 --- a/app/src/main/java/com/ti/m/GoodSoftware.kt +++ b/app/src/main/java/com/ti/m/GoodSoftware.kt @@ -15,9 +15,7 @@ import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.lifecycleScope -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext import java.io.BufferedReader import java.io.ByteArrayOutputStream import java.io.InputStreamReader @@ -46,11 +44,11 @@ class GoodSoftware (private val activity: MainActivity) { private val cipher = Cipher.getInstance(CIPHER_TYPE_FOR_RSA) 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 { - 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 { @@ -125,7 +123,7 @@ class GoodSoftware (private val activity: MainActivity) { } 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 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 if (!hasBackCamera() && !hasFrontCamera()) { 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 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( ContextCompat.getMainExecutor(context), imageCapturedListener @@ -273,9 +256,5 @@ class GoodSoftware (private val activity: MainActivity) { object picture { 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 } }