update commons and camerax

This commit is contained in:
darthpaul 2022-07-13 02:11:38 +01:00
parent 210f3e35c0
commit 7a55969e6d
3 changed files with 33 additions and 23 deletions

View File

@ -62,13 +62,13 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:d1d5402388'
implementation 'com.github.SimpleMobileTools:Simple-Commons:7c48da6bef'
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation "androidx.exifinterface:exifinterface:1.3.3"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.0"
implementation 'androidx.window:window:1.1.0-alpha02'
def camerax_version = '1.1.0-rc02'
def camerax_version = '1.1.0'
implementation "androidx.camera:camera-core:$camerax_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-video:$camerax_version"

View File

@ -8,13 +8,19 @@ import com.simplemobiletools.camera.activities.SimpleActivity
import com.simplemobiletools.camera.extensions.config
import com.simplemobiletools.camera.models.MySize
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.models.RadioItem
import kotlinx.android.synthetic.main.dialog_change_resolution.view.*
import kotlinx.android.synthetic.main.dialog_change_resolution.view.change_resolution_photo
import kotlinx.android.synthetic.main.dialog_change_resolution.view.change_resolution_photo_holder
import kotlinx.android.synthetic.main.dialog_change_resolution.view.change_resolution_video
import kotlinx.android.synthetic.main.dialog_change_resolution.view.change_resolution_video_holder
class ChangeResolutionDialog(val activity: SimpleActivity, val isFrontCamera: Boolean, val photoResolutions: ArrayList<MySize>,
val videoResolutions: ArrayList<MySize>, val openVideoResolutions: Boolean, val callback: () -> Unit) {
private var dialog: AlertDialog
class ChangeResolutionDialog(
val activity: SimpleActivity, val isFrontCamera: Boolean, val photoResolutions: ArrayList<MySize>,
val videoResolutions: ArrayList<MySize>, val openVideoResolutions: Boolean, val callback: () -> Unit
) {
private var dialog: AlertDialog? = null
private val config = activity.config
init {
@ -23,11 +29,12 @@ class ChangeResolutionDialog(val activity: SimpleActivity, val isFrontCamera: Bo
setupVideoResolutionPicker(this)
}
dialog = AlertDialog.Builder(activity)
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok, null)
.setOnDismissListener { callback() }
.create().apply {
.apply {
activity.setupDialogStuff(view, this, if (isFrontCamera) R.string.front_camera else R.string.back_camera) {
dialog = it
if (openVideoResolutions) {
view.change_resolution_video_holder.performClick()
}
@ -49,7 +56,7 @@ class ChangeResolutionDialog(val activity: SimpleActivity, val isFrontCamera: Bo
} else {
config.backPhotoResIndex = it
}
dialog.dismiss()
dialog?.dismiss()
}
}
view.change_resolution_photo.text = items.getOrNull(selectionIndex)?.title
@ -68,7 +75,7 @@ class ChangeResolutionDialog(val activity: SimpleActivity, val isFrontCamera: Bo
} else {
config.backVideoResIndex = it
}
dialog.dismiss()
dialog?.dismiss()
}
}
view.change_resolution_video.text = items.getOrNull(selectionIndex)?.title

View File

@ -10,6 +10,7 @@ import com.simplemobiletools.camera.extensions.config
import com.simplemobiletools.camera.models.MySize
import com.simplemobiletools.camera.models.VideoQuality
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.models.RadioItem
import kotlinx.android.synthetic.main.dialog_change_resolution.view.change_resolution_photo
@ -24,7 +25,7 @@ class ChangeResolutionDialogX(
private val videoResolutions: List<VideoQuality>,
private val callback: () -> Unit,
) {
private var dialog: AlertDialog
private var dialog: AlertDialog? = null
private val config = activity.config
private val TAG = "ChangeResolutionDialogX"
@ -34,10 +35,12 @@ class ChangeResolutionDialogX(
setupVideoResolutionPicker(this)
}
dialog = AlertDialog.Builder(activity)
activity.getAlertDialogBuilder()
.setPositiveButton(R.string.ok, null)
.create().apply {
activity.setupDialogStuff(view, this, if (isFrontCamera) R.string.front_camera else R.string.back_camera)
.apply {
activity.setupDialogStuff(view, this, if (isFrontCamera) R.string.front_camera else R.string.back_camera){
dialog = it
}
}
}
@ -60,7 +63,7 @@ class ChangeResolutionDialogX(
} else {
config.backPhotoResIndex = it
}
dialog.dismiss()
dialog?.dismiss()
callback.invoke()
}
}
@ -89,7 +92,7 @@ class ChangeResolutionDialogX(
} else {
config.backPhotoResIndex = selectionIndex
}
dialog.dismiss()
dialog?.dismiss()
callback.invoke()
}
}