Skip to content

Commit

Permalink
removed onRequestPermissionsResult handling in fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
mzorz committed Aug 13, 2019
1 parent e0f25fa commit bbcf4df
Showing 1 changed file with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ import androidx.camera.core.Preview
import androidx.camera.core.PreviewConfig
import androidx.camera.core.VideoCapture
import androidx.camera.core.VideoCaptureConfig
import androidx.core.app.ActivityCompat
import com.automattic.photoeditor.R
import com.automattic.photoeditor.camera.interfaces.VideoRecorderFragment
import com.automattic.photoeditor.util.FileUtils
import com.automattic.photoeditor.util.PermissionUtils
import com.automattic.photoeditor.views.background.video.AutoFitTextureView
import java.io.File

class CameraXBasicHandling : VideoRecorderFragment(),
ActivityCompat.OnRequestPermissionsResultCallback {
class CameraXBasicHandling : VideoRecorderFragment() {
private lateinit var videoCapture: VideoCapture

private var active: Boolean = false
Expand Down Expand Up @@ -51,21 +47,6 @@ class CameraXBasicHandling : VideoRecorderFragment(),
}
}

override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
grantResults: IntArray
) {
if (!PermissionUtils.allRequiredPermissionsGranted(activity!!)) {
ErrorDialog.newInstance(getString(R.string.request_permissions))
.show(childFragmentManager,
FRAGMENT_DIALOG
)
} else {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
}
}

// TODO remove this RestrictedApi annotation once androidx.camera:camera moves out of alpha
@SuppressLint("RestrictedApi")
private fun startCamera() {
Expand Down Expand Up @@ -110,7 +91,6 @@ class CameraXBasicHandling : VideoRecorderFragment(),
companion object {
private val instance = CameraXBasicHandling()

private val FRAGMENT_DIALOG = "dialog"
/**
* Tag for the [Log].
*/
Expand Down

0 comments on commit bbcf4df

Please sign in to comment.