mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 02:17:43 +03:00
Revert changes for EditImageActivity
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
dea1407c35
commit
f9619b8b1c
1 changed files with 14 additions and 32 deletions
|
@ -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
|
||||
}
|
||||
|
||||
setupCropper()
|
||||
}
|
||||
|
@ -112,10 +105,9 @@ class EditImageActivity :
|
|||
" " + getString(R.string.image_editor_file_edited_suffix) +
|
||||
resultUri?.substring(resultUri.lastIndexOf('.'))
|
||||
|
||||
resultUri?.let {
|
||||
FilesUploadHelper().uploadNewFiles(
|
||||
user = storageManager.user,
|
||||
localPaths = arrayOf(it),
|
||||
localPaths = arrayOf(resultUri!!),
|
||||
remotePaths = arrayOf(file.parentRemotePath + File.separator + newFileName),
|
||||
createRemoteFolder = false,
|
||||
createdBy = UploadFileOperation.CREATED_BY_USER,
|
||||
|
@ -125,7 +117,6 @@ class EditImageActivity :
|
|||
localBehavior = FileUploader.LOCAL_BEHAVIOUR_DELETE
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSetImageUriComplete(view: CropImageView, uri: Uri, error: Exception?) {
|
||||
if (error != null) {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue