aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx/trackermap/TrackerMap/android
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-20 01:39:43 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-20 01:39:43 -0600
commitdb0dd04682627b20df5acfc2bf01a1541cfa5696 (patch)
tree4753e754d20f4a6f7c389620be367715a92f7be7 /androidApp/src/main/java/mx/trackermap/TrackerMap/android
parentecc818705b9b523dbd1a85f017d14ba0d017849b (diff)
downloadetbsa-trackermap-mobile-db0dd04682627b20df5acfc2bf01a1541cfa5696.tar.gz
etbsa-trackermap-mobile-db0dd04682627b20df5acfc2bf01a1541cfa5696.tar.bz2
etbsa-trackermap-mobile-db0dd04682627b20df5acfc2bf01a1541cfa5696.zip
Proper handling of user permission requests
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt8
1 files changed, 8 insertions, 0 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt
index 56d5c4b..9633332 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt
@@ -5,6 +5,7 @@ import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import androidx.activity.result.contract.ActivityResultContracts
+import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import com.google.android.material.tabs.TabLayout
@@ -108,6 +109,13 @@ class DetailsActivity : AppCompatActivity() {
}
ActivityCompat.shouldShowRequestPermissionRationale(this, permission) -> {
Log.d("DetailsActivity", "shouldShowRequestPermissionRationale")
+ AlertDialog.Builder(this)
+ .setTitle(R.string.write_rationale_title)
+ .setMessage(R.string.write_rationale_msg)
+ .setPositiveButton(R.string.shared_ok) { _, _ ->
+ launcher.launch(permission)
+ }
+ .create().show()
}
else -> {
Log.d("DetailsActivity", "Requesting $permission permission")