let the Preview handle the changeResolutionDialog
This commit is contained in:
parent
af58be70dd
commit
c8af745297
|
@ -14,6 +14,7 @@ import android.view.SurfaceHolder
|
|||
import android.view.SurfaceView
|
||||
import android.view.ViewGroup
|
||||
import com.simplemobiletools.camera.activities.MainActivity
|
||||
import com.simplemobiletools.camera.dialogs.ChangeResolutionDialog
|
||||
import com.simplemobiletools.camera.extensions.*
|
||||
import com.simplemobiletools.commons.extensions.getNavBarHeight
|
||||
import com.simplemobiletools.commons.extensions.needsStupidWritePermissions
|
||||
|
@ -330,6 +331,14 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||
return Rect(rectLeft, rectTop, rectRight, rectBottom)
|
||||
}
|
||||
|
||||
fun showChangeResolutionDialog() {
|
||||
if (mCamera != null) {
|
||||
ChangeResolutionDialog(mActivity, config.lastUsedCamera == Camera.CameraInfo.CAMERA_FACING_BACK, mCamera!!) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun releaseCamera() {
|
||||
stopRecording()
|
||||
mCamera?.stopPreview()
|
||||
|
|
|
@ -21,7 +21,6 @@ import com.bumptech.glide.Glide
|
|||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.simplemobiletools.camera.*
|
||||
import com.simplemobiletools.camera.Preview.PreviewListener
|
||||
import com.simplemobiletools.camera.dialogs.ChangeResolutionDialog
|
||||
import com.simplemobiletools.camera.extensions.config
|
||||
import com.simplemobiletools.camera.views.FocusRectView
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
|
@ -154,7 +153,7 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||
shutter.setOnClickListener { shutterPressed() }
|
||||
settings.setOnClickListener { launchSettings() }
|
||||
toggle_photo_video.setOnClickListener { handleTogglePhotoVideo() }
|
||||
change_resolution.setOnClickListener { handleChangeResolution() }
|
||||
change_resolution.setOnClickListener { mPreview?.showChangeResolutionDialog() }
|
||||
}
|
||||
|
||||
private fun hasCameraAndStoragePermission() = hasCameraPermission() && hasWriteStoragePermission()
|
||||
|
@ -304,14 +303,6 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||
checkButtons()
|
||||
}
|
||||
|
||||
private fun handleChangeResolution() {
|
||||
if (Preview.mCamera != null) {
|
||||
ChangeResolutionDialog(this, mCurrCameraId == Camera.CameraInfo.CAMERA_FACING_BACK, Preview.mCamera!!) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun togglePhotoVideo() {
|
||||
if (!checkCameraAvailable()) {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue