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 androidx.core.graphics.drawable.DrawableCompat
|
||||||
import com.canhub.cropper.CropImageView
|
import com.canhub.cropper.CropImageView
|
||||||
import com.nextcloud.client.di.Injectable
|
import com.nextcloud.client.di.Injectable
|
||||||
import com.nextcloud.utils.extensions.getParcelableArgument
|
|
||||||
import com.owncloud.android.R
|
import com.owncloud.android.R
|
||||||
import com.owncloud.android.databinding.ActivityEditImageBinding
|
import com.owncloud.android.databinding.ActivityEditImageBinding
|
||||||
import com.owncloud.android.datamodel.OCFile
|
import com.owncloud.android.datamodel.OCFile
|
||||||
|
@ -81,8 +80,7 @@ class EditImageActivity :
|
||||||
binding = ActivityEditImageBinding.inflate(layoutInflater)
|
binding = ActivityEditImageBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
file = intent.extras?.getParcelableArgument(EXTRA_FILE, OCFile::class.java)
|
file = intent.extras?.getParcelable(EXTRA_FILE) ?: throw IllegalArgumentException("Missing file argument")
|
||||||
?: throw IllegalArgumentException("Missing file argument")
|
|
||||||
|
|
||||||
setSupportActionBar(binding.toolbar)
|
setSupportActionBar(binding.toolbar)
|
||||||
supportActionBar?.apply {
|
supportActionBar?.apply {
|
||||||
|
@ -92,12 +90,7 @@ class EditImageActivity :
|
||||||
|
|
||||||
window.statusBarColor = ContextCompat.getColor(this, R.color.black)
|
window.statusBarColor = ContextCompat.getColor(this, R.color.black)
|
||||||
window.navigationBarColor = getColor(R.color.black)
|
window.navigationBarColor = getColor(R.color.black)
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
window.setDecorFitsSystemWindows(false)
|
|
||||||
} else {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
|
|
||||||
}
|
|
||||||
|
|
||||||
setupCropper()
|
setupCropper()
|
||||||
}
|
}
|
||||||
|
@ -112,19 +105,17 @@ class EditImageActivity :
|
||||||
" " + getString(R.string.image_editor_file_edited_suffix) +
|
" " + getString(R.string.image_editor_file_edited_suffix) +
|
||||||
resultUri?.substring(resultUri.lastIndexOf('.'))
|
resultUri?.substring(resultUri.lastIndexOf('.'))
|
||||||
|
|
||||||
resultUri?.let {
|
FilesUploadHelper().uploadNewFiles(
|
||||||
FilesUploadHelper().uploadNewFiles(
|
user = storageManager.user,
|
||||||
user = storageManager.user,
|
localPaths = arrayOf(resultUri!!),
|
||||||
localPaths = arrayOf(it),
|
remotePaths = arrayOf(file.parentRemotePath + File.separator + newFileName),
|
||||||
remotePaths = arrayOf(file.parentRemotePath + File.separator + newFileName),
|
createRemoteFolder = false,
|
||||||
createRemoteFolder = false,
|
createdBy = UploadFileOperation.CREATED_BY_USER,
|
||||||
createdBy = UploadFileOperation.CREATED_BY_USER,
|
requiresWifi = false,
|
||||||
requiresWifi = false,
|
requiresCharging = false,
|
||||||
requiresCharging = false,
|
nameCollisionPolicy = NameCollisionPolicy.RENAME,
|
||||||
nameCollisionPolicy = NameCollisionPolicy.RENAME,
|
localBehavior = FileUploader.LOCAL_BEHAVIOUR_DELETE
|
||||||
localBehavior = FileUploader.LOCAL_BEHAVIOUR_DELETE
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSetImageUriComplete(view: CropImageView, uri: Uri, error: Exception?) {
|
override fun onSetImageUriComplete(view: CropImageView, uri: Uri, error: Exception?) {
|
||||||
|
@ -156,7 +147,6 @@ class EditImageActivity :
|
||||||
finish()
|
finish()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
finish()
|
finish()
|
||||||
true
|
true
|
||||||
|
@ -194,15 +184,7 @@ class EditImageActivity :
|
||||||
// determine output file format
|
// determine output file format
|
||||||
format = when (file.mimeType) {
|
format = when (file.mimeType) {
|
||||||
MimeType.PNG -> Bitmap.CompressFormat.PNG
|
MimeType.PNG -> Bitmap.CompressFormat.PNG
|
||||||
MimeType.WEBP -> {
|
MimeType.WEBP -> Bitmap.CompressFormat.WEBP
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
||||||
Bitmap.CompressFormat.WEBP_LOSSLESS
|
|
||||||
} else {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
Bitmap.CompressFormat.WEBP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> Bitmap.CompressFormat.JPEG
|
else -> Bitmap.CompressFormat.JPEG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue