mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Update deprecated API usage
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
618745fa42
commit
c76803fe62
1 changed files with 16 additions and 3 deletions
|
@ -32,6 +32,7 @@ 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
|
||||
|
@ -80,7 +81,7 @@ class EditImageActivity :
|
|||
binding = ActivityEditImageBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
file = intent.extras?.getParcelable(EXTRA_FILE) ?: throw IllegalArgumentException("Missing file argument")
|
||||
file = intent.extras?.getParcelableArgument(EXTRA_FILE, OCFile::class.java) ?: throw IllegalArgumentException("Missing file argument")
|
||||
|
||||
setSupportActionBar(binding.toolbar)
|
||||
supportActionBar?.apply {
|
||||
|
@ -90,7 +91,12 @@ class EditImageActivity :
|
|||
|
||||
window.statusBarColor = ContextCompat.getColor(this, R.color.black)
|
||||
window.navigationBarColor = getColor(R.color.black)
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.setDecorFitsSystemWindows(false)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
}
|
||||
|
||||
setupCropper()
|
||||
}
|
||||
|
@ -184,7 +190,14 @@ class EditImageActivity :
|
|||
// determine output file format
|
||||
format = when (file.mimeType) {
|
||||
MimeType.PNG -> Bitmap.CompressFormat.PNG
|
||||
MimeType.WEBP -> Bitmap.CompressFormat.WEBP
|
||||
MimeType.WEBP -> {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
Bitmap.CompressFormat.WEBP_LOSSLESS
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
Bitmap.CompressFormat.WEBP
|
||||
}
|
||||
}
|
||||
else -> Bitmap.CompressFormat.JPEG
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue