[android] - check if hosting Activity isn't finishing before showing an dialog
This commit is contained in:
@@ -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;
|
||||
@@ -48,7 +49,17 @@ public class AttributionDialogManager implements View.OnClickListener, DialogInt
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
attributionSet = new AttributionBuilder(mapboxMap).build();
|
||||
showAttributionDialog(getAttributionTitles());
|
||||
|
||||
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(getAttributionTitles());
|
||||
}
|
||||
}
|
||||
|
||||
protected void showAttributionDialog(String[] attributionTitles) {
|
||||
|
||||
Reference in New Issue
Block a user