rename Preview to PreviewCameraOne
This commit is contained in:
parent
7bf69e1d04
commit
3e6aab0cb5
|
@ -22,8 +22,8 @@ import com.simplemobiletools.camera.implementations.MyCameraOneImpl
|
||||||
import com.simplemobiletools.camera.implementations.MyCameraTwoImpl
|
import com.simplemobiletools.camera.implementations.MyCameraTwoImpl
|
||||||
import com.simplemobiletools.camera.interfaces.MyCamera
|
import com.simplemobiletools.camera.interfaces.MyCamera
|
||||||
import com.simplemobiletools.camera.views.FocusCircleView
|
import com.simplemobiletools.camera.views.FocusCircleView
|
||||||
import com.simplemobiletools.camera.views.Preview
|
import com.simplemobiletools.camera.views.PreviewCameraOne
|
||||||
import com.simplemobiletools.camera.views.Preview.PreviewListener
|
import com.simplemobiletools.camera.views.PreviewCameraOne.PreviewListener
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.*
|
import com.simplemobiletools.commons.helpers.*
|
||||||
import com.simplemobiletools.commons.models.Release
|
import com.simplemobiletools.commons.models.Release
|
||||||
|
@ -37,7 +37,7 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
||||||
lateinit var mFadeHandler: Handler
|
lateinit var mFadeHandler: Handler
|
||||||
lateinit var mCameraImpl: MyCamera
|
lateinit var mCameraImpl: MyCamera
|
||||||
|
|
||||||
private var mPreview: Preview? = null
|
private var mPreview: PreviewCameraOne? = null
|
||||||
private var mPreviewUri: Uri? = null
|
private var mPreviewUri: Uri? = null
|
||||||
private var mFlashlightState = FLASH_OFF
|
private var mFlashlightState = FLASH_OFF
|
||||||
private var mIsInPhotoMode = false
|
private var mIsInPhotoMode = false
|
||||||
|
@ -193,10 +193,13 @@ class MainActivity : SimpleActivity(), PreviewListener, PhotoProcessor.MediaSave
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
initButtons()
|
initButtons()
|
||||||
|
|
||||||
|
camera_surface_view.beVisibleIf(!isLollipopPlus())
|
||||||
|
camera_texture_view.beVisibleIf(isLollipopPlus())
|
||||||
|
|
||||||
(btn_holder.layoutParams as RelativeLayout.LayoutParams).setMargins(0, 0, 0, (navBarHeight + resources.getDimension(R.dimen.activity_margin)).toInt())
|
(btn_holder.layoutParams as RelativeLayout.LayoutParams).setMargins(0, 0, 0, (navBarHeight + resources.getDimension(R.dimen.activity_margin)).toInt())
|
||||||
|
|
||||||
mCurrCameraId = config.lastUsedCamera
|
mCurrCameraId = config.lastUsedCamera
|
||||||
mPreview = Preview(this, camera_view, this)
|
mPreview = PreviewCameraOne(this, camera_surface_view, this)
|
||||||
mPreview!!.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
mPreview!!.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
||||||
view_holder.addView(mPreview)
|
view_holder.addView(mPreview)
|
||||||
toggle_camera.setImageResource(if (mCurrCameraId == mCameraImpl.getBackCameraId()) R.drawable.ic_camera_front else R.drawable.ic_camera_rear)
|
toggle_camera.setImageResource(if (mCurrCameraId == mCameraImpl.getBackCameraId()) R.drawable.ic_camera_front else R.drawable.ic_camera_rear)
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScanCompletedListener {
|
class PreviewCameraOne : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScanCompletedListener {
|
||||||
var mCamera: Camera? = null
|
var mCamera: Camera? = null
|
||||||
private val FOCUS_AREA_SIZE = 100
|
private val FOCUS_AREA_SIZE = 100
|
||||||
private val PHOTO_PREVIEW_LENGTH = 500L
|
private val PHOTO_PREVIEW_LENGTH = 500L
|
|
@ -7,7 +7,13 @@
|
||||||
android:background="@android:color/black">
|
android:background="@android:color/black">
|
||||||
|
|
||||||
<SurfaceView
|
<SurfaceView
|
||||||
android:id="@+id/camera_view"
|
android:id="@+id/camera_surface_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<com.simplemobiletools.camera.views.AutoFitTextureView
|
||||||
|
android:id="@+id/camera_texture_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue