mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 06:05:42 +03:00
Revert changes for EditImageActivity
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
f67470b0ad
commit
1ab8055cd4
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
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue