lets set the minimal required OS version to Android 10
This commit is contained in:
parent
77458cc759
commit
196f477d3e
|
@ -13,7 +13,7 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
applicationId "com.simplemobiletools.camera"
|
||||
minSdkVersion 21
|
||||
minSdkVersion 29
|
||||
targetSdkVersion 31
|
||||
versionCode 77
|
||||
versionName "5.3.1"
|
||||
|
|
|
@ -46,10 +46,12 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
|||
var mLastHandledOrientation = 0
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
|
||||
window.addFlags(
|
||||
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
|
||||
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
)
|
||||
|
||||
useDynamicTheme = false
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -194,7 +196,12 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
|||
setContentView(R.layout.activity_main)
|
||||
initButtons()
|
||||
|
||||
(btn_holder.layoutParams as RelativeLayout.LayoutParams).setMargins(0, 0, 0, (navigationBarHeight + resources.getDimension(R.dimen.activity_margin)).toInt())
|
||||
(btn_holder.layoutParams as RelativeLayout.LayoutParams).setMargins(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
(navigationBarHeight + resources.getDimension(R.dimen.activity_margin)).toInt()
|
||||
)
|
||||
|
||||
checkVideoCaptureIntent()
|
||||
mPreview = CameraPreview(this, camera_texture_view, mIsInPhotoMode)
|
||||
|
@ -202,7 +209,8 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
|||
checkImageCaptureIntent()
|
||||
mPreview?.setIsImageCaptureIntent(isImageCaptureIntent())
|
||||
|
||||
val imageDrawable = if (config.lastUsedCamera == mCameraImpl.getBackCameraId().toString()) R.drawable.ic_camera_front_vector else R.drawable.ic_camera_rear_vector
|
||||
val imageDrawable =
|
||||
if (config.lastUsedCamera == mCameraImpl.getBackCameraId().toString()) R.drawable.ic_camera_front_vector else R.drawable.ic_camera_rear_vector
|
||||
toggle_camera.setImageResource(imageDrawable)
|
||||
|
||||
mFocusCircleView = FocusCircleView(applicationContext)
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package com.simplemobiletools.camera.helpers
|
||||
|
||||
import android.annotation.TargetApi
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Matrix
|
||||
import android.net.Uri
|
||||
import android.os.AsyncTask
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import androidx.exifinterface.media.ExifInterface
|
||||
import com.simplemobiletools.camera.R
|
||||
|
@ -14,17 +12,17 @@ import com.simplemobiletools.camera.activities.MainActivity
|
|||
import com.simplemobiletools.camera.extensions.config
|
||||
import com.simplemobiletools.camera.extensions.getOutputMediaFile
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.isNougatPlus
|
||||
import java.io.File
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.FileOutputStream
|
||||
import java.io.OutputStream
|
||||
|
||||
class PhotoProcessor(val activity: MainActivity, val saveUri: Uri?, val deviceOrientation: Int, val previewRotation: Int, val isUsingFrontCamera: Boolean,
|
||||
val isThirdPartyIntent: Boolean) :
|
||||
class PhotoProcessor(
|
||||
val activity: MainActivity, val saveUri: Uri?, val deviceOrientation: Int, val previewRotation: Int, val isUsingFrontCamera: Boolean,
|
||||
val isThirdPartyIntent: Boolean
|
||||
) :
|
||||
AsyncTask<ByteArray, Void, String>() {
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.N)
|
||||
override fun doInBackground(vararg params: ByteArray): String {
|
||||
var fos: OutputStream? = null
|
||||
val path: String
|
||||
|
@ -86,9 +84,7 @@ class PhotoProcessor(val activity: MainActivity, val saveUri: Uri?, val deviceOr
|
|||
var image = BitmapFactory.decodeByteArray(data, 0, data.size)
|
||||
val totalRotation = (imageRot + deviceRot + previewRotation) % 360
|
||||
|
||||
if (path.startsWith(activity.internalStoragePath) || isNougatPlus() && !isThirdPartyIntent) {
|
||||
// do not rotate the image itself in these cases, rotate it by exif only
|
||||
} else {
|
||||
if (isThirdPartyIntent) {
|
||||
// make sure the image itself is rotated at third party intents
|
||||
image = rotate(image, totalRotation)
|
||||
}
|
||||
|
@ -109,7 +105,7 @@ class PhotoProcessor(val activity: MainActivity, val saveUri: Uri?, val deviceOr
|
|||
|
||||
try {
|
||||
image.compress(Bitmap.CompressFormat.JPEG, activity.config.photoQuality, fos)
|
||||
if (!isThirdPartyIntent && isNougatPlus()) {
|
||||
if (!isThirdPartyIntent) {
|
||||
activity.saveImageRotation(path, totalRotation)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
@ -118,7 +114,7 @@ class PhotoProcessor(val activity: MainActivity, val saveUri: Uri?, val deviceOr
|
|||
}
|
||||
|
||||
if (activity.config.savePhotoMetadata && !isThirdPartyIntent) {
|
||||
val exifInterface = if (path.startsWith(activity.internalStoragePath) || !isNougatPlus()) {
|
||||
val exifInterface = if (path.startsWith(activity.internalStoragePath)) {
|
||||
ExifInterface(path)
|
||||
} else {
|
||||
val documentFile = activity.getSomeDocumentFile(path)
|
||||
|
|
Loading…
Reference in New Issue