make the variables in MainActivity and FocusRectView non-static
This commit is contained in:
parent
a016f514f8
commit
eeb1077fc2
|
@ -16,13 +16,14 @@ import com.bumptech.glide.Glide
|
|||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.simplemobiletools.camera.*
|
||||
import com.simplemobiletools.camera.views.Preview.PreviewListener
|
||||
import com.simplemobiletools.camera.BuildConfig
|
||||
import com.simplemobiletools.camera.R
|
||||
import com.simplemobiletools.camera.extensions.config
|
||||
import com.simplemobiletools.camera.extensions.navBarHeight
|
||||
import com.simplemobiletools.camera.helpers.*
|
||||
import com.simplemobiletools.camera.views.FocusRectView
|
||||
import com.simplemobiletools.camera.views.Preview
|
||||
import com.simplemobiletools.camera.views.Preview.PreviewListener
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_CAMERA
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_RECORD_AUDIO
|
||||
|
@ -31,7 +32,6 @@ import com.simplemobiletools.commons.models.Release
|
|||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
|
||||
class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSavedListener {
|
||||
companion object {
|
||||
private val FADE_DELAY = 5000
|
||||
|
||||
lateinit var mFocusRectView: FocusRectView
|
||||
|
@ -49,7 +49,6 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
|||
private var mCurrVideoRecTimer = 0
|
||||
private var mCurrCameraId = 0
|
||||
var mLastHandledOrientation = 0
|
||||
}
|
||||
|
||||
lateinit var mOrientationEventListener: OrientationEventListener
|
||||
|
||||
|
|
|
@ -9,16 +9,14 @@ import android.view.ViewGroup
|
|||
import com.simplemobiletools.camera.extensions.config
|
||||
|
||||
class FocusRectView(context: Context) : ViewGroup(context) {
|
||||
companion object {
|
||||
private val RECT_SIZE = 50
|
||||
private val RECT_DURATION = 500
|
||||
|
||||
private var mDrawRect = false
|
||||
private var mHandler: Handler
|
||||
|
||||
lateinit var mPaint: Paint
|
||||
lateinit var mHandler: Handler
|
||||
lateinit var mRect: Rect
|
||||
}
|
||||
|
||||
init {
|
||||
setWillNotDraw(false)
|
||||
|
@ -53,9 +51,7 @@ class FocusRectView(context: Context) : ViewGroup(context) {
|
|||
invalidate()
|
||||
}
|
||||
|
||||
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
|
||||
|
||||
}
|
||||
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
|
|
|
@ -13,12 +13,12 @@ import android.view.ScaleGestureDetector
|
|||
import android.view.SurfaceHolder
|
||||
import android.view.SurfaceView
|
||||
import android.view.ViewGroup
|
||||
import com.simplemobiletools.camera.helpers.PhotoProcessor
|
||||
import com.simplemobiletools.camera.R
|
||||
import com.simplemobiletools.camera.activities.MainActivity
|
||||
import com.simplemobiletools.camera.dialogs.ChangeResolutionDialog
|
||||
import com.simplemobiletools.camera.extensions.*
|
||||
import com.simplemobiletools.camera.helpers.Config
|
||||
import com.simplemobiletools.camera.helpers.PhotoProcessor
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
@ -290,7 +290,8 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||
mCamera!!.enableShutterSound(false)
|
||||
}
|
||||
|
||||
mRotationAtCapture = MainActivity.mLastHandledOrientation
|
||||
|
||||
mRotationAtCapture = mActivity!!.mLastHandledOrientation
|
||||
mCamera!!.parameters = mParameters
|
||||
isWaitingForTakePictureCallback = true
|
||||
mIsPreviewShown = true
|
||||
|
@ -692,7 +693,7 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
|
|||
}
|
||||
|
||||
private fun getVideoRotation(): Int {
|
||||
val deviceRot = MainActivity.mLastHandledOrientation.compensateDeviceRotation(mCurrCameraId)
|
||||
val deviceRot = mActivity!!.mLastHandledOrientation.compensateDeviceRotation(mCurrCameraId)
|
||||
val previewRot = mActivity!!.getPreviewRotation(mCurrCameraId)
|
||||
return (deviceRot + previewRot) % 360
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue