fix handling of third party video intent
This commit is contained in:
parent
854a865071
commit
16fdbf8d5a
|
@ -156,7 +156,6 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
|||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
if (it) {
|
||||
initializeCamera()
|
||||
handleIntent()
|
||||
} else {
|
||||
toast(R.string.no_storage_permissions)
|
||||
finish()
|
||||
|
@ -178,6 +177,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
|||
}
|
||||
} else if (intent?.action == MediaStore.ACTION_VIDEO_CAPTURE) {
|
||||
mIsVideoCaptureIntent = true
|
||||
mIsInPhotoMode = false
|
||||
hideIntentButtons()
|
||||
shutter.setImageResource(R.drawable.ic_video_rec)
|
||||
}
|
||||
|
@ -190,12 +190,13 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
|||
setContentView(R.layout.activity_main)
|
||||
initButtons()
|
||||
|
||||
handleIntent()
|
||||
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())
|
||||
|
||||
mPreview = if (isLollipopPlus()) PreviewCameraTwo(this, camera_texture_view) else PreviewCameraOne(this, camera_surface_view)
|
||||
mPreview = if (isLollipopPlus()) PreviewCameraTwo(this, camera_texture_view, mIsInPhotoMode) else PreviewCameraOne(this, camera_surface_view)
|
||||
view_holder.addView(mPreview as ViewGroup)
|
||||
|
||||
val imageDrawable = if (config.lastUsedCamera == mCameraImpl.getBackCameraId().toString()) R.drawable.ic_camera_front else R.drawable.ic_camera_rear
|
||||
|
|
|
@ -112,7 +112,7 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
|||
constructor(context: Context) : super(context)
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
constructor(activity: MainActivity, textureView: AutoFitTextureView) : super(activity) {
|
||||
constructor(activity: MainActivity, textureView: AutoFitTextureView, initPhotoMode: Boolean) : super(activity) {
|
||||
mActivity = activity
|
||||
mTextureView = textureView
|
||||
val cameraCharacteristics = try {
|
||||
|
@ -123,7 +123,7 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
|||
|
||||
val isFrontCamera = cameraCharacteristics?.get(CameraCharacteristics.LENS_FACING).toString() == activity.getMyCamera().getFrontCameraId().toString()
|
||||
mUseFrontCamera = !activity.config.alwaysOpenBackCamera && isFrontCamera
|
||||
mIsInVideoMode = !activity.config.initPhotoMode
|
||||
mIsInVideoMode = !initPhotoMode
|
||||
loadSounds()
|
||||
|
||||
mTextureView.setOnTouchListener { view, event ->
|
||||
|
|
Loading…
Reference in New Issue