summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-02-19 19:08:07 +0100
committerTobrun <tobrun@mapbox.com>2018-03-01 11:46:04 +0100
commit54c3fcdec86a46649fa22af169d88fc377554157 (patch)
tree39a4fba13ed6363d333d7287f03505629cbd6932
parent0fe1219bfd5dc93f6cf256cb247f58496022d2c7 (diff)
downloadqtlocation-mapboxgl-54c3fcdec86a46649fa22af169d88fc377554157.tar.gz
[android] - check if hosting Activity isn't finishing before showing an dialog
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java
index 2956d864e6..48de768e64 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java
@@ -1,5 +1,6 @@
package com.mapbox.mapboxsdk.maps;
+import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -49,7 +50,17 @@ class AttributionDialogManager implements View.OnClickListener, DialogInterface.
@Override
public void onClick(View view) {
attributionSet = new AttributionBuilder(mapboxMap).build();
- showAttributionDialog();
+
+ boolean isActivityFinishing = false;
+ if (context instanceof Activity) {
+ isActivityFinishing = ((Activity) context).isFinishing();
+ }
+
+ // check is hosting activity isn't finishing
+ // https://github.com/mapbox/mapbox-gl-native/issues/11238
+ if (!isActivityFinishing) {
+ showAttributionDialog();
+ }
}
private void showAttributionDialog() {