From f9619b8b1c82e9a48036b926f2c5f40057ced848 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Thu, 9 Nov 2023 16:21:27 +0100 Subject: [PATCH] Revert changes for EditImageActivity Signed-off-by: alperozturk --- .../client/editimage/EditImageActivity.kt | 46 ++++++------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt b/app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt index b8e1469600..3ccadd3ba5 100644 --- a/app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt +++ b/app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt @@ -32,7 +32,6 @@ import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.DrawableCompat import com.canhub.cropper.CropImageView import com.nextcloud.client.di.Injectable -import com.nextcloud.utils.extensions.getParcelableArgument import com.owncloud.android.R import com.owncloud.android.databinding.ActivityEditImageBinding import com.owncloud.android.datamodel.OCFile @@ -81,8 +80,7 @@ class EditImageActivity : binding = ActivityEditImageBinding.inflate(layoutInflater) setContentView(binding.root) - file = intent.extras?.getParcelableArgument(EXTRA_FILE, OCFile::class.java) - ?: throw IllegalArgumentException("Missing file argument") + file = intent.extras?.getParcelable(EXTRA_FILE) ?: throw IllegalArgumentException("Missing file argument") setSupportActionBar(binding.toolbar) supportActionBar?.apply { @@ -92,12 +90,7 @@ class EditImageActivity : window.statusBarColor = ContextCompat.getColor(this, R.color.black) window.navigationBarColor = getColor(R.color.black) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - window.setDecorFitsSystemWindows(false) - } else { - @Suppress("DEPRECATION") - window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN - } + window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN setupCropper() } @@ -112,19 +105,17 @@ class EditImageActivity : " " + getString(R.string.image_editor_file_edited_suffix) + resultUri?.substring(resultUri.lastIndexOf('.')) - resultUri?.let { - FilesUploadHelper().uploadNewFiles( - user = storageManager.user, - localPaths = arrayOf(it), - remotePaths = arrayOf(file.parentRemotePath + File.separator + newFileName), - createRemoteFolder = false, - createdBy = UploadFileOperation.CREATED_BY_USER, - requiresWifi = false, - requiresCharging = false, - nameCollisionPolicy = NameCollisionPolicy.RENAME, - localBehavior = FileUploader.LOCAL_BEHAVIOUR_DELETE - ) - } + FilesUploadHelper().uploadNewFiles( + user = storageManager.user, + localPaths = arrayOf(resultUri!!), + remotePaths = arrayOf(file.parentRemotePath + File.separator + newFileName), + createRemoteFolder = false, + createdBy = UploadFileOperation.CREATED_BY_USER, + requiresWifi = false, + requiresCharging = false, + nameCollisionPolicy = NameCollisionPolicy.RENAME, + localBehavior = FileUploader.LOCAL_BEHAVIOUR_DELETE + ) } override fun onSetImageUriComplete(view: CropImageView, uri: Uri, error: Exception?) { @@ -156,7 +147,6 @@ class EditImageActivity : finish() true } - else -> { finish() true @@ -194,15 +184,7 @@ class EditImageActivity : // determine output file format format = when (file.mimeType) { MimeType.PNG -> Bitmap.CompressFormat.PNG - MimeType.WEBP -> { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - Bitmap.CompressFormat.WEBP_LOSSLESS - } else { - @Suppress("DEPRECATION") - Bitmap.CompressFormat.WEBP - } - } - + MimeType.WEBP -> Bitmap.CompressFormat.WEBP else -> Bitmap.CompressFormat.JPEG } }