mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-02-17 03:40:38 +01:00
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.SurfaceView
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.simplemobiletools.camera.activities.MainActivity
|
import com.simplemobiletools.camera.activities.MainActivity
|
||||||
|
import com.simplemobiletools.camera.dialogs.ChangeResolutionDialog
|
||||||
import com.simplemobiletools.camera.extensions.*
|
import com.simplemobiletools.camera.extensions.*
|
||||||
import com.simplemobiletools.commons.extensions.getNavBarHeight
|
import com.simplemobiletools.commons.extensions.getNavBarHeight
|
||||||
import com.simplemobiletools.commons.extensions.needsStupidWritePermissions
|
import com.simplemobiletools.commons.extensions.needsStupidWritePermissions
|
||||||
@ -330,6 +331,14 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||||||
return Rect(rectLeft, rectTop, rectRight, rectBottom)
|
return Rect(rectLeft, rectTop, rectRight, rectBottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun showChangeResolutionDialog() {
|
||||||
|
if (mCamera != null) {
|
||||||
|
ChangeResolutionDialog(mActivity, config.lastUsedCamera == Camera.CameraInfo.CAMERA_FACING_BACK, mCamera!!) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun releaseCamera() {
|
fun releaseCamera() {
|
||||||
stopRecording()
|
stopRecording()
|
||||||
mCamera?.stopPreview()
|
mCamera?.stopPreview()
|
||||||
|
@ -21,7 +21,6 @@ import com.bumptech.glide.Glide
|
|||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import com.simplemobiletools.camera.*
|
import com.simplemobiletools.camera.*
|
||||||
import com.simplemobiletools.camera.Preview.PreviewListener
|
import com.simplemobiletools.camera.Preview.PreviewListener
|
||||||
import com.simplemobiletools.camera.dialogs.ChangeResolutionDialog
|
|
||||||
import com.simplemobiletools.camera.extensions.config
|
import com.simplemobiletools.camera.extensions.config
|
||||||
import com.simplemobiletools.camera.views.FocusRectView
|
import com.simplemobiletools.camera.views.FocusRectView
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
@ -154,7 +153,7 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||||||
shutter.setOnClickListener { shutterPressed() }
|
shutter.setOnClickListener { shutterPressed() }
|
||||||
settings.setOnClickListener { launchSettings() }
|
settings.setOnClickListener { launchSettings() }
|
||||||
toggle_photo_video.setOnClickListener { handleTogglePhotoVideo() }
|
toggle_photo_video.setOnClickListener { handleTogglePhotoVideo() }
|
||||||
change_resolution.setOnClickListener { handleChangeResolution() }
|
change_resolution.setOnClickListener { mPreview?.showChangeResolutionDialog() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hasCameraAndStoragePermission() = hasCameraPermission() && hasWriteStoragePermission()
|
private fun hasCameraAndStoragePermission() = hasCameraPermission() && hasWriteStoragePermission()
|
||||||
@ -304,14 +303,6 @@ class MainActivity : SimpleActivity(), SensorEventListener, PreviewListener, Pho
|
|||||||
checkButtons()
|
checkButtons()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleChangeResolution() {
|
|
||||||
if (Preview.mCamera != null) {
|
|
||||||
ChangeResolutionDialog(this, mCurrCameraId == Camera.CameraInfo.CAMERA_FACING_BACK, Preview.mCamera!!) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun togglePhotoVideo() {
|
private fun togglePhotoVideo() {
|
||||||
if (!checkCameraAvailable()) {
|
if (!checkCameraAvailable()) {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user