From 102b9c0c3a7facc9fba80733bb28793b0d9ac6b4 Mon Sep 17 00:00:00 2001 From: Rene de Groot Date: Thu, 9 Mar 2017 07:43:01 +0100 Subject: [PATCH] Fix some permission checking --- .../sogeti/android/gpstracker/ng/control/ControlFragment.kt | 2 +- .../nl/sogeti/android/gpstracker/ng/map/TrackMapFragment.kt | 6 +++++- .../android/gpstracker/ng/recording/RecordingFragment.kt | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/control/ControlFragment.kt b/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/control/ControlFragment.kt index 5375bff..82e7cca 100644 --- a/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/control/ControlFragment.kt +++ b/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/control/ControlFragment.kt @@ -64,7 +64,7 @@ class ControlFragment : Fragment() { override fun onStart() { super.onStart() - permissionRequester.checkPermissions(activity) { controlPresenter.start(activity) } + permissionRequester.checkPermissions(this, { controlPresenter.start(activity) }) } override fun onStop() { diff --git a/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/map/TrackMapFragment.kt b/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/map/TrackMapFragment.kt index d4f4a7c..ee5aa26 100644 --- a/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/map/TrackMapFragment.kt +++ b/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/map/TrackMapFragment.kt @@ -58,7 +58,7 @@ class TrackMapFragment : Fragment() { super.onStart() binding!!.fragmentMapMapview?.onStart() binding!!.fragmentMapMapview.getMapAsync(trackPresenter) - permissionRequester.checkPermissions(activity, { trackPresenter.start(activity) }) + permissionRequester.checkPermissions(this, { trackPresenter.start(activity) }) } override fun onResume() { @@ -94,4 +94,8 @@ class TrackMapFragment : Fragment() { super.onLowMemory() binding?.fragmentMapMapview?.onLowMemory() } + + override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + permissionRequester.onRequestPermissionsResult(requestCode, permissions, grantResults) + } } diff --git a/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/recording/RecordingFragment.kt b/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/recording/RecordingFragment.kt index c45e5ed..49a1b99 100644 --- a/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/recording/RecordingFragment.kt +++ b/studio/app/src/main/java/nl/sogeti/android/gpstracker/ng/recording/RecordingFragment.kt @@ -53,7 +53,7 @@ class RecordingFragment : Fragment() { override fun onStart() { super.onStart() - permissionRequester.checkPermissions(activity) { presenter.start(activity) } + permissionRequester.checkPermissions(this, { presenter.start(activity) }) } override fun onStop() { @@ -61,4 +61,8 @@ class RecordingFragment : Fragment() { permissionRequester.stop() presenter.stop() } + + override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + permissionRequester.onRequestPermissionsResult(requestCode, permissions, grantResults) + } }