use the activity config at showing resolution picker
This commit is contained in:
parent
9b27d22bf3
commit
4e3d8ae9ac
|
@ -4,9 +4,9 @@ import android.hardware.Camera
|
|||
import android.support.v7.app.AlertDialog
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import com.simplemobiletools.camera.Preview.Companion.config
|
||||
import com.simplemobiletools.camera.R
|
||||
import com.simplemobiletools.camera.activities.SimpleActivity
|
||||
import com.simplemobiletools.camera.extensions.config
|
||||
import com.simplemobiletools.camera.extensions.getAspectRatio
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
|
@ -32,7 +32,7 @@ class ChangeResolutionDialog(val activity: SimpleActivity, val isBackCamera: Boo
|
|||
|
||||
private fun setupPhotoResolutionPicker(view: View) {
|
||||
val items = getFormattedResolutions(camera.parameters.supportedPictureSizes)
|
||||
var selectionIndex = if (isBackCamera) config.backPhotoResIndex else config.frontPhotoResIndex
|
||||
var selectionIndex = if (isBackCamera) activity.config.backPhotoResIndex else activity.config.frontPhotoResIndex
|
||||
selectionIndex = Math.max(selectionIndex, 0)
|
||||
|
||||
view.change_resolution_photo_holder.setOnClickListener {
|
||||
|
@ -40,9 +40,9 @@ class ChangeResolutionDialog(val activity: SimpleActivity, val isBackCamera: Boo
|
|||
selectionIndex = it as Int
|
||||
view.change_resolution_photo.text = items[selectionIndex].title
|
||||
if (isBackCamera)
|
||||
config.backPhotoResIndex = it
|
||||
activity.config.backPhotoResIndex = it
|
||||
else
|
||||
config.frontPhotoResIndex = it
|
||||
activity.config.frontPhotoResIndex = it
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
@ -51,16 +51,16 @@ class ChangeResolutionDialog(val activity: SimpleActivity, val isBackCamera: Boo
|
|||
|
||||
private fun setupVideoResolutionPicker(view: View) {
|
||||
val items = getFormattedResolutions(camera.parameters.supportedVideoSizes ?: camera.parameters.supportedPreviewSizes)
|
||||
var selectionIndex = if (isBackCamera) config.backVideoResIndex else config.frontVideoResIndex
|
||||
var selectionIndex = if (isBackCamera) activity.config.backVideoResIndex else activity.config.frontVideoResIndex
|
||||
|
||||
view.change_resolution_video_holder.setOnClickListener {
|
||||
RadioGroupDialog(activity, items, selectionIndex) {
|
||||
selectionIndex = it as Int
|
||||
view.change_resolution_video.text = items[selectionIndex].title
|
||||
if (isBackCamera)
|
||||
config.backVideoResIndex = it
|
||||
activity.config.backVideoResIndex = it
|
||||
else
|
||||
config.frontVideoResIndex = it
|
||||
activity.config.frontVideoResIndex = it
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue