show a list of available photo resolutions at pressing Change Resolution

This commit is contained in:
tibbi 2018-06-05 11:37:50 +02:00
parent d1000697cc
commit aae28aeb03
2 changed files with 10 additions and 2 deletions

View File

@ -48,7 +48,7 @@ class ChangeResolutionDialog(val activity: SimpleActivity, val isFrontCamera: Bo
dialog.dismiss()
}
}
view.change_resolution_photo.text = items[selectionIndex].title
view.change_resolution_photo.text = items.getOrNull(selectionIndex)?.title
}
private fun setupVideoResolutionPicker(view: View) {
@ -67,7 +67,7 @@ class ChangeResolutionDialog(val activity: SimpleActivity, val isFrontCamera: Bo
dialog.dismiss()
}
}
view.change_resolution_video.text = items[selectionIndex].title
view.change_resolution_video.text = items.getOrNull(selectionIndex)?.title
}
private fun getFormattedResolutions(resolutions: List<MySize>): ArrayList<RadioItem> {

View File

@ -17,9 +17,11 @@ import android.view.Surface
import android.view.TextureView
import android.view.ViewGroup
import com.simplemobiletools.camera.activities.MainActivity
import com.simplemobiletools.camera.dialogs.ChangeResolutionDialog
import com.simplemobiletools.camera.helpers.*
import com.simplemobiletools.camera.interfaces.MyPreview
import com.simplemobiletools.camera.models.FocusArea
import com.simplemobiletools.camera.models.MySize
import java.util.*
import java.util.concurrent.Semaphore
import java.util.concurrent.TimeUnit
@ -606,6 +608,12 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
override fun getCameraState() = mCameraState
override fun showChangeResolutionDialog() {
val configMap = getCameraCharacteristics().get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)
val photoResolutions = configMap.getOutputSizes(ImageFormat.JPEG).map { MySize(it.width, it.height) } as ArrayList
val videoResolutions = ArrayList<MySize>()
ChangeResolutionDialog(mActivity, mUseFrontCamera, photoResolutions, videoResolutions) {
}
}
override fun toggleFrontBackCamera() {