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) {
|
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||||
if (it) {
|
if (it) {
|
||||||
initializeCamera()
|
initializeCamera()
|
||||||
handleIntent()
|
|
||||||
} else {
|
} else {
|
||||||
toast(R.string.no_storage_permissions)
|
toast(R.string.no_storage_permissions)
|
||||||
finish()
|
finish()
|
||||||
|
@ -178,6 +177,7 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
||||||
}
|
}
|
||||||
} else if (intent?.action == MediaStore.ACTION_VIDEO_CAPTURE) {
|
} else if (intent?.action == MediaStore.ACTION_VIDEO_CAPTURE) {
|
||||||
mIsVideoCaptureIntent = true
|
mIsVideoCaptureIntent = true
|
||||||
|
mIsInPhotoMode = false
|
||||||
hideIntentButtons()
|
hideIntentButtons()
|
||||||
shutter.setImageResource(R.drawable.ic_video_rec)
|
shutter.setImageResource(R.drawable.ic_video_rec)
|
||||||
}
|
}
|
||||||
|
@ -190,12 +190,13 @@ class MainActivity : SimpleActivity(), PhotoProcessor.MediaSavedListener {
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
initButtons()
|
initButtons()
|
||||||
|
|
||||||
|
handleIntent()
|
||||||
camera_surface_view.beVisibleIf(!isLollipopPlus())
|
camera_surface_view.beVisibleIf(!isLollipopPlus())
|
||||||
camera_texture_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())
|
||||||
|
|
||||||
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)
|
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
|
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)
|
constructor(context: Context) : super(context)
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
constructor(activity: MainActivity, textureView: AutoFitTextureView) : super(activity) {
|
constructor(activity: MainActivity, textureView: AutoFitTextureView, initPhotoMode: Boolean) : super(activity) {
|
||||||
mActivity = activity
|
mActivity = activity
|
||||||
mTextureView = textureView
|
mTextureView = textureView
|
||||||
val cameraCharacteristics = try {
|
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()
|
val isFrontCamera = cameraCharacteristics?.get(CameraCharacteristics.LENS_FACING).toString() == activity.getMyCamera().getFrontCameraId().toString()
|
||||||
mUseFrontCamera = !activity.config.alwaysOpenBackCamera && isFrontCamera
|
mUseFrontCamera = !activity.config.alwaysOpenBackCamera && isFrontCamera
|
||||||
mIsInVideoMode = !activity.config.initPhotoMode
|
mIsInVideoMode = !initPhotoMode
|
||||||
loadSounds()
|
loadSounds()
|
||||||
|
|
||||||
mTextureView.setOnTouchListener { view, event ->
|
mTextureView.setOnTouchListener { view, event ->
|
||||||
|
|
Loading…
Reference in New Issue