diff --git a/app/build.gradle b/app/build.gradle index c0d4d3a7..dbde0964 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,13 +9,12 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 29 - buildToolsVersion "29.0.3" + compileSdkVersion 31 defaultConfig { applicationId "com.simplemobiletools.camera" minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 31 versionCode 77 versionName "5.3.1" setProperty("archivesBaseName", "camera") @@ -59,5 +58,5 @@ android { dependencies { implementation 'com.github.SimpleMobileTools:Simple-Commons:99a97f2e16' implementation 'androidx.documentfile:documentfile:1.0.1' - implementation "androidx.exifinterface:exifinterface:1.3.2" + implementation "androidx.exifinterface:exifinterface:1.3.3" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index fc6b36ad..4f548b53 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,32 +1,33 @@ + xmlns:tools="http://schemas.android.com/tools" + package="com.simplemobiletools.camera" + android:installLocation="auto"> + android:required="true" /> + android:required="false" /> + android:required="false" /> - - - - + + + + + tools:node="remove" /> + android:exported="false" + android:theme="@style/SplashTheme" /> - - + + - - + + - - + + - - + + - - + + - - + + - - + android:parentActivityName=".activities.SettingsActivity" /> - - + android:parentActivityName=".activities.SettingsActivity" /> + android:parentActivityName=".activities.MainActivity"> + + + + + + + android:name=".receivers.HardwareShutterReceiver" + android:exported="false"> + - + @@ -113,252 +117,271 @@ android:grantUriPermissions="true"> + android:resource="@xml/provider_paths" /> - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/views/CameraPreview.kt b/app/src/main/kotlin/com/simplemobiletools/camera/views/CameraPreview.kt index fc717fb9..0e651de2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/views/CameraPreview.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/views/CameraPreview.kt @@ -155,12 +155,12 @@ class CameraPreview : ViewGroup, TextureView.SurfaceTextureListener, MyPreview { stopBackgroundThread() } - override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) { + override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture, width: Int, height: Int) { closeCamera() openCamera(width, height) } - override fun onSurfaceTextureUpdated(surface: SurfaceTexture?) {} + override fun onSurfaceTextureUpdated(surface: SurfaceTexture) {} override fun onSurfaceTextureDestroyed(surface: SurfaceTexture) = true @@ -359,7 +359,8 @@ class CameraPreview : ViewGroup, TextureView.SurfaceTextureListener, MyPreview { configMap.getOutputSizes(SurfaceTexture::class.java) } - mPreviewSize = chooseOptimalPreviewSize(outputSizes, rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth, maxPreviewHeight, currentResolution) + mPreviewSize = + chooseOptimalPreviewSize(outputSizes, rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth, maxPreviewHeight, currentResolution) mActivity.runOnUiThread { mTextureView.setAspectRatio(mPreviewSize!!.height, mPreviewSize!!.width) @@ -378,7 +379,14 @@ class CameraPreview : ViewGroup, TextureView.SurfaceTextureListener, MyPreview { } } - private fun chooseOptimalPreviewSize(choices: Array, textureViewWidth: Int, textureViewHeight: Int, maxWidth: Int, maxHeight: Int, selectedResolution: MySize): Size { + private fun chooseOptimalPreviewSize( + choices: Array, + textureViewWidth: Int, + textureViewHeight: Int, + maxWidth: Int, + maxHeight: Int, + selectedResolution: MySize + ): Size { val bigEnough = ArrayList() val notBigEnough = ArrayList() val bigEnoughIncorrectAR = ArrayList() @@ -404,10 +412,10 @@ class CameraPreview : ViewGroup, TextureView.SurfaceTextureListener, MyPreview { } return when { - bigEnough.isNotEmpty() -> bigEnough.minBy { it.width * it.height }!! - notBigEnough.isNotEmpty() -> notBigEnough.maxBy { it.width * it.height }!! - bigEnoughIncorrectAR.isNotEmpty() -> bigEnoughIncorrectAR.minBy { it.width * it.height }!! - notBigEnoughIncorrectAR.isNotEmpty() -> notBigEnoughIncorrectAR.maxBy { it.width * it.height }!! + bigEnough.isNotEmpty() -> bigEnough.minByOrNull { it.width * it.height }!! + notBigEnough.isNotEmpty() -> notBigEnough.maxByOrNull { it.width * it.height }!! + bigEnoughIncorrectAR.isNotEmpty() -> bigEnoughIncorrectAR.minByOrNull { it.width * it.height }!! + notBigEnoughIncorrectAR.isNotEmpty() -> notBigEnoughIncorrectAR.maxByOrNull { it.width * it.height }!! else -> selectedResolution.toSize() } } @@ -822,7 +830,7 @@ class CameraPreview : ViewGroup, TextureView.SurfaceTextureListener, MyPreview { } try { - val texture = mTextureView.surfaceTexture + val texture = mTextureView.surfaceTexture!! texture.setDefaultBufferSize(mPreviewSize!!.width, mPreviewSize!!.height) mPreviewRequestBuilder = mCameraDevice!!.createCaptureRequest(CameraDevice.TEMPLATE_RECORD).apply { set(CaptureRequest.CONTROL_CAPTURE_INTENT, CaptureRequest.CONTROL_CAPTURE_INTENT_VIDEO_RECORD) diff --git a/app/src/main/res/drawable-hdpi/ic_settings_cog.png b/app/src/main/res/drawable-hdpi/ic_settings_cog.png deleted file mode 100644 index 97ded33b..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_settings_cog.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_settings_cog.png b/app/src/main/res/drawable-xhdpi/ic_settings_cog.png deleted file mode 100644 index 5caedc8e..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_settings_cog.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_settings_cog.png b/app/src/main/res/drawable-xxhdpi/ic_settings_cog.png deleted file mode 100644 index eabb0a2b..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_settings_cog.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_settings_cog.png b/app/src/main/res/drawable-xxxhdpi/ic_settings_cog.png deleted file mode 100644 index 507c5edd..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_settings_cog.png and /dev/null differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 62a739a1..71ec8765 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,6 +1,5 @@ - + android:layout_height="wrap_content" /> + android:background="@color/md_grey_black" /> + android:src="@drawable/ic_settings_cog_vector" /> + android:src="@drawable/ic_video_vector" /> + android:src="@drawable/ic_resolution_vector" /> + android:padding="@dimen/medium_margin" /> + android:src="@drawable/ic_camera_front_vector" /> + android:src="@drawable/ic_shutter_vector" /> + android:src="@drawable/ic_flash_off_vector" /> @@ -92,6 +91,6 @@ android:layout_centerHorizontal="true" android:text="00:00" android:textColor="@android:color/white" - android:visibility="gone"/> + android:visibility="gone" /> diff --git a/app/src/main/res/menu/menu.xml b/app/src/main/res/menu/menu.xml index 0cce6d24..57fdd575 100644 --- a/app/src/main/res/menu/menu.xml +++ b/app/src/main/res/menu/menu.xml @@ -1,8 +1,11 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + tools:ignore="AppCompatResource"> + app:showAsAction="never" /> diff --git a/build.gradle b/build.gradle index ac335a39..cf4af380 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.4.32' + ext.kotlin_version = '1.6.20' repositories { google() @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' + classpath 'com.android.tools.build:gradle:7.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a7b8a720..d0bc3e4b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip