updating target SDK to 31 and some small things
This commit is contained in:
parent
2da12d4165
commit
d717fe299c
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:appCategory="image"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_launcher_name"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
|
@ -35,10 +36,12 @@
|
|||
|
||||
<activity
|
||||
android:name=".activities.SplashActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/SplashTheme" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.MainActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:showOnLockScreen="true"
|
||||
android:theme="@style/FullScreenTheme">
|
||||
|
@ -76,31 +79,32 @@
|
|||
|
||||
<activity
|
||||
android:name="com.simplemobiletools.commons.activities.AboutActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/about"
|
||||
android:parentActivityName=".activities.SettingsActivity" />
|
||||
|
||||
<activity
|
||||
android:name="com.simplemobiletools.commons.activities.LicenseActivity"
|
||||
android:label="@string/third_party_licences"
|
||||
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/>
|
||||
|
||||
<activity
|
||||
android:name="com.simplemobiletools.commons.activities.CustomizationActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/customize_colors"
|
||||
android:parentActivityName=".activities.SettingsActivity" />
|
||||
|
||||
<activity
|
||||
android:name="com.simplemobiletools.commons.activities.FAQActivity"
|
||||
android:label="@string/frequently_asked_questions"
|
||||
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/>
|
||||
|
||||
<activity
|
||||
android:name=".activities.SettingsActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/settings"
|
||||
android:parentActivityName=".activities.MainActivity"/>
|
||||
android:parentActivityName=".activities.MainActivity">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
android:name=".receivers.HardwareShutterReceiver">
|
||||
android:name=".receivers.HardwareShutterReceiver"
|
||||
android:exported="false">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.CAMERA_BUTTON" />
|
||||
</intent-filter>
|
||||
|
@ -119,6 +123,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Red"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_red"
|
||||
android:roundIcon="@mipmap/ic_launcher_red"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -132,6 +137,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Pink"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_pink"
|
||||
android:roundIcon="@mipmap/ic_launcher_pink"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -145,6 +151,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Purple"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_purple"
|
||||
android:roundIcon="@mipmap/ic_launcher_purple"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -158,6 +165,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Deep_purple"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_deep_purple"
|
||||
android:roundIcon="@mipmap/ic_launcher_deep_purple"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -171,6 +179,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Indigo"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_indigo"
|
||||
android:roundIcon="@mipmap/ic_launcher_indigo"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -184,6 +193,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Blue"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_blue"
|
||||
android:roundIcon="@mipmap/ic_launcher_blue"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -197,6 +207,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Light_blue"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_light_blue"
|
||||
android:roundIcon="@mipmap/ic_launcher_light_blue"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -210,6 +221,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Cyan"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_cyan"
|
||||
android:roundIcon="@mipmap/ic_launcher_cyan"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -223,6 +235,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Teal"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_teal"
|
||||
android:roundIcon="@mipmap/ic_launcher_teal"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -236,6 +249,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Green"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_green"
|
||||
android:roundIcon="@mipmap/ic_launcher_green"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -249,6 +263,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Light_green"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_light_green"
|
||||
android:roundIcon="@mipmap/ic_launcher_light_green"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -262,6 +277,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Lime"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_lime"
|
||||
android:roundIcon="@mipmap/ic_launcher_lime"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -275,6 +291,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Yellow"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_yellow"
|
||||
android:roundIcon="@mipmap/ic_launcher_yellow"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -288,6 +305,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Amber"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_amber"
|
||||
android:roundIcon="@mipmap/ic_launcher_amber"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -301,6 +319,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Orange"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -313,6 +332,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Deep_orange"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_deep_orange"
|
||||
android:roundIcon="@mipmap/ic_launcher_deep_orange"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -326,6 +346,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Brown"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_brown"
|
||||
android:roundIcon="@mipmap/ic_launcher_brown"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -339,6 +360,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Blue_grey"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_blue_grey"
|
||||
android:roundIcon="@mipmap/ic_launcher_blue_grey"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -352,6 +374,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Grey_black"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_grey_black"
|
||||
android:roundIcon="@mipmap/ic_launcher_grey_black"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
|
|
@ -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<Size>, textureViewWidth: Int, textureViewHeight: Int, maxWidth: Int, maxHeight: Int, selectedResolution: MySize): Size {
|
||||
private fun chooseOptimalPreviewSize(
|
||||
choices: Array<Size>,
|
||||
textureViewWidth: Int,
|
||||
textureViewHeight: Int,
|
||||
maxWidth: Int,
|
||||
maxHeight: Int,
|
||||
selectedResolution: MySize
|
||||
): Size {
|
||||
val bigEnough = ArrayList<Size>()
|
||||
val notBigEnough = ArrayList<Size>()
|
||||
val bigEnoughIncorrectAR = ArrayList<Size>()
|
||||
|
@ -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)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 460 B |
Binary file not shown.
Before Width: | Height: | Size: 562 B |
Binary file not shown.
Before Width: | Height: | Size: 843 B |
Binary file not shown.
Before Width: | Height: | Size: 1.0 KiB |
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/view_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -16,7 +15,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:alpha="0"
|
||||
android:background="#000000" />
|
||||
android:background="@color/md_grey_black" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/settings"
|
||||
|
@ -24,7 +23,7 @@
|
|||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_alignParentRight="true"
|
||||
android:padding="@dimen/normal_margin"
|
||||
android:src="@drawable/ic_settings_cog"/>
|
||||
android:src="@drawable/ic_settings_cog_vector" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toggle_photo_video"
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:ignore="AppCompatResource">
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/about"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue